~hadronized/kak-tree-sitter-bugs#17: 
Unison highlighting doesn't work

using kak-tree-sitter v1.1.1 and the default config, I'm unable to get highlighting working for unison files.

Output with -vvvvv.

shell stderr: <<<
tree-sitter 2024-07-07T07:38:50.771523383+00:00 (kak_tree_sitter_config) [DEBUG]: loading default configuration
tree-sitter 2024-07-07T07:38:50.772737061+00:00 (kak_tree_sitter_config) [DEBUG]: loading user configuration
tree-sitter 2024-07-07T07:38:50.772744856+00:00 (kak_tree_sitter_config) [DEBUG]: loading configuration at /home/rishi/.config/kak-tree-sitter/config.toml
tree-sitter 2024-07-07T07:38:50.792322620+00:00 (kak_tree_sitter) [DEBUG]: removing previous PID file
tree-sitter 2024-07-07T07:38:50.792365460+00:00 (kak_tree_sitter) [DEBUG]: removing previous socket file
>>>

In stderr.txt I do see:

tree-sitter 2024-07-07T07:42:25.006352750+00:00 (kak_tree_sitter::tree_sitter::languages) [INFO]: loading configuration for unison
.......

 tree-sitter 2024-07-07T07:42:25.371076254+00:00 (kak_tree_sitter::server) [TRACE]: sending response: Response { sessio
       │ n: "64078", client: None, buffer: None, payload: Init { enabled_langs: [("awk", true), ("go", true), ("nu", true), ("j
       │ ava", true), ("toml", true), ("koka", true), ("scheme", true), ("bibtex", true), ("kotlin", true), ("unison", true), (
       │ "elixir", true), ("json", true), ("git-commit", true), ("tsx", true), ("fish", true), ("diff", true), ("html", true),
       │ ("cmake", true), ("cpp", true), ("javascript", true), ("ruby", true), ("nix", true), ("yaml", true), ("verilog", true)
       │ , ("typescript", true), ("css", true)] } }

Other languages like TOML, Elixir and Nix work just fine.

Status
REPORTED
Submitter
~zetashift
Assigned to
No-one
Submitted
4 months ago
Updated
17 days ago
Labels
ktsctl prio:medium

~zetashift 26 days ago*

Seems to work now, but only after I do a :tree-sitter-reload. Steps to reproduce:

  1. touch scratch.u
  2. Paste in some content like:
x = do
  _ = 1 + 1	
  "testing"

You'll notice that there is no highlighting

  • Run :tree-sitter-reload
  • After a small delay highlighting kicks in

~hadronized 22 days ago

Seems to work now, but only after I do a :tree-sitter-reload.

So this command is useful whenever you update some grammar / queries while KTS is running. If not, I don’t think it should change anything.

~zetashift 22 days ago

Mhmhm that is weird, highlighting seems to only kick in when doing a :tree-sitter-reload. Log:

tree-sitter 2024-11-12T17:39:41.654922083+00:00 (kak_tree_sitter_config) [DEBUG]: loading default configuration
tree-sitter 2024-11-12T17:39:41.656213919+00:00 (kak_tree_sitter_config) [DEBUG]: loading user configuration
tree-sitter 2024-11-12T17:39:41.656226473+00:00 (kak_tree_sitter_config) [DEBUG]: loading configuration at /home/rishi/.config/kak-tree-sitter/config.toml

~hadronized 22 days ago

That is indeed weird. Have you tried to run KTS in its own terminal and then open another terminal with your unison file opened in Kakoune, and see what log you get?

~zetashift 22 days ago*

Ah I didn't know you could do that!

I see the following when loading an Unison file(I snipped out the "loading grammar" logs):

2024-11-12T20:12:17.850Z DEBUG [kak_tree_sitter::server] creating response queue
2024-11-12T20:12:17.850Z INFO  [kak_tree_sitter::server] starting server
2024-11-12T20:12:17.850Z DEBUG [kak_tree_sitter::server] starting event loop
2024-11-12T20:12:52.472Z DEBUG [kak_tree_sitter::server] client connected: UnixStream { fd: FileDesc(OwnedFd { fd: 9 }), local: "/run/user/1000/kak-tree-sitter/socket" (pathname), peer: (unnamed) }
2024-11-12T20:12:52.472Z TRACE [mio::poll] registering event source with poller: token=Token(2), interests=READABLE
2024-11-12T20:12:52.472Z DEBUG [kak_tree_sitter::server] UnixStream { fd: FileDesc(OwnedFd { fd: 9 }), local: "/run/user/1000/kak-tree-sitter/socket" (pathname), peer: (unnamed) } will be using token Token(2)
2024-11-12T20:12:52.472Z INFO  [kak_tree_sitter::server] registering session 1316716
2024-11-12T20:12:52.472Z TRACE [kak_tree_sitter::server] sending response: Response { session: "1316716", client: None, buffer: None, payload: Init { enabled_langs: [("bibtex", true), ("yaml", true), ("json", true), ("fish", true), ("verilog", true), ("nix", true), ("scheme", true), ("cpp", true), ("unison", true), ("css", true), ("git-commit", true), ("elixir", true), ("nu", true), ("java", true), ("svelte", true), ("diff", true), ("typescript", true), ("kotlin", true), ("cmake", true), ("go", true), ("javascript", true), ("toml", true), ("tsx", true), ("ruby", true), ("koka", true), ("awk", true), ("html", true)] } }

Then after running :tree-sitter-reload

2024-11-12T20:15:08.375Z DEBUG [kak_tree_sitter::server] client connected: UnixStream { fd: FileDesc(OwnedFd { fd: 13 }), local: "/run/user/1000/kak-tree-sitter/socket" (pathname), peer: (unnamed) }
2024-11-12T20:15:08.375Z TRACE [mio::poll] registering event source with poller: token=Token(6), interests=READABLE
2024-11-12T20:15:08.376Z DEBUG [kak_tree_sitter::server] UnixStream { fd: FileDesc(OwnedFd { fd: 13 }), local: "/run/user/1000/kak-tree-sitter/socket" (pathname), peer: (unnamed) } will be using token Token(6)
2024-11-12T20:15:08.376Z INFO  [kak_tree_sitter::server] buffer metadata scratch.u (unison)
2024-11-12T20:15:08.376Z TRACE [mio::poll] registering event source with poller: token=Token(7), interests=READABLE
2024-11-12T20:15:08.376Z TRACE [kak_tree_sitter::server] sending response: Response { session: "1316716", client: None, buffer: Some("scratch.u"), payload: BufferSetup { fifo_path: "/run/user/1000/kak-tree-sitter/bufs/1689dfd2-6ba5-4f6a-9130-11e58988e8ca", sentinel: "46a63072-9600-466c-b94f-6dae9840ad98" } }
2024-11-12T20:15:08.378Z DEBUG [kak_tree_sitter::server::handler] updating BufferId { session: "1316716", buffer: "scratch.u" }, token Token(7)
2024-11-12T20:15:08.378Z TRACE [kak_tree_sitter::server::fifo] found sentinel 46a63072-9600-466c-b94f-6dae9840ad98 in buffer /run/user/1000/kak-tree-sitter/bufs/1689dfd2-6ba5-4f6a-9130-11e58988e8ca
2024-11-12T20:15:08.378Z TRACE [kak_tree_sitter::server::fifo] new buffer content:

My config:

[language.unison.grammar.source.git]
url = "https://github.com/kylegoetz/tree-sitter-unison"
pin = "3c97db76d3cdbd002dfba493620c2d5df2fd6fa9"

[language.unison.grammar]
path = "src"
compile = "cc"
compile_args = ["-c", "-fpic", "../scanner.c", "../parser.c", "-I", ".."]
compile_flags = ["-O3"]
link = "cc"
link_args = ["-shared", "-fpic", "scanner.o", "parser.o", "-o", "unison.so"]
link_flags = ["-O3"]

[language.unison.queries.source.git]
url = "https://github.com/zetashift/helix"
pin = "ce66e10c8305de20b8cfe5a3255952f3b428b606"

[language.unison.queries]
path = "runtime/queries/unison"

~zetashift 17 days ago

The log when I try to invoke some tree-sitter functions:

shell stderr: <<<
tree-sitter 2024-11-17T21:00:58.490754308+00:00 (kak_tree_sitter_config) [DEBUG]: loading default configuration
tree-sitter 2024-11-17T21:00:58.492018061+00:00 (kak_tree_sitter_config) [DEBUG]: loading user configuration
tree-sitter 2024-11-17T21:00:58.492029562+00:00 (kak_tree_sitter_config) [DEBUG]: loading configuration at /home/rishi/.config/kak-tree-sitter/config.toml
tree-sitter 2024-11-17T21:00:58.492137885+00:00 (kak_tree_sitter::server::resources) [DEBUG]: checking whether kak-tree-sitter (494476) is still running
tree-sitter 2024-11-17T21:00:58.513589714+00:00 (kak_tree_sitter) [DEBUG]: server already running
tree-sitter 2024-11-17T21:00:58.513600524+00:00 (kak_tree_sitter) [DEBUG]: initiating first session 495303
tree-sitter 2024-11-17T21:00:58.513640739+00:00 (kak_tree_sitter::client) [DEBUG]: connected to KTS
>>>
Enabling LSP for filetype unison
shell stderr: <<<
tree-sitter 2024-11-17T21:01:10.377337335+00:00 (kak_tree_sitter) [ERROR]: fatal error: cannot connect to server; is it running?: Connection refused (os error 111)
>>>
Register here or Log in to comment, or comment via email.