walk icon indicating copy to clipboard operation
walk copied to clipboard

Syntax highlighting in preview mode

Open danisvaliev001 opened this issue 1 year ago • 3 comments

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

danisvaliev001 avatar Jun 30 '24 18:06 danisvaliev001

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

antonmedv avatar Jul 01 '24 17:07 antonmedv

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?

danisvaliev001 avatar Jul 03 '24 20:07 danisvaliev001

About using chroma

antonmedv avatar Jul 04 '24 05:07 antonmedv

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'

0xTadash1 avatar Jan 01 '25 16:01 0xTadash1

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

antonmedv avatar Jan 01 '25 19:01 antonmedv

Is embedding moar can help?

danisvaliev001 avatar Jan 02 '25 12:01 danisvaliev001

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

antonmedv avatar Jan 02 '25 13:01 antonmedv

lipgloss seems to support layouting.

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

0xTadash1 avatar Jan 06 '25 13:01 0xTadash1

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.

antonmedv avatar Jan 06 '25 14:01 antonmedv

What do you think about gocui?

danisvaliev001 avatar Jan 07 '25 11:01 danisvaliev001

Gocui looks cool.

antonmedv avatar Jan 07 '25 12:01 antonmedv