Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting in preview mode #154

Open
danisvaliev001 opened this issue Jun 30, 2024 · 11 comments
Open

Syntax highlighting in preview mode #154

danisvaliev001 opened this issue Jun 30, 2024 · 11 comments

Comments

@danisvaliev001
Copy link

It will be super if preview mode will support syntax highlighting. As I see it can be implemented using LSP.

@antonmedv
Copy link
Owner

LSP for highlighting seems like a completely an overkill. Starting a LSP per language just for highlighting?

@danisvaliev001
Copy link
Author

LSP for highlighting seems like a completely an overkill. Starting a LSP per language just for highlighting?

yeah, you're right. What do you think about using chroma library or wrapping bat tool?

@antonmedv
Copy link
Owner

About using chroma

@0xTadash1
Copy link

How about using environment variables, like WALK_REMOVE_CMD?

I use bat with a custom highlighting theme and indentation size.
This approach is convenient as it removes the need to configure similar settings in walk.

export WALK_PREVIEW_CMD='bat'

@antonmedv
Copy link
Owner

Problem is with tge way bubbletea works. We have to join together two strings. Getting output and joining with walk list is difficult.

@danisvaliev001
Copy link
Author

Is embedding moar can help?

@antonmedv
Copy link
Owner

moar is very cool. The problem is with vertical joining.

@0xTadash1
Copy link

lipgloss seems to support layouting.

However, using them may require not a few changes to the current implementation...

@antonmedv
Copy link
Owner

Joining i what I use now. The problem is with "spilling". Here explanation with html:
List of files:

file.txt
another.txt
more.txt

And some highlighted code:

yaml: <green>string
with goes multiline</green>

We join the together:

file.txt     yaml: <green>string
another.txt  with goes multiline</green>
more.txt    

And now another.txt also will be colored green.

This also happens with we truncate part of the string with "closing" escape code:

file.txt     yaml: <green>string | </green>
another.txt                      |
more.txt                         |

IF we cut stuff of screen at | we will color another.txt and more.txt as green too.

@danisvaliev001
Copy link
Author

What do you think about gocui?

@antonmedv
Copy link
Owner

Gocui looks cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants