apple / pkl-neovim

Pkl language support for Neovim
https://pkl-lang.org/neovim/current/index.html
Apache License 2.0
144 stars 14 forks source link

nvim-treesitter fails to load the pkl parser #15

Closed marmoute closed 1 month ago

marmoute commented 3 months ago

I installed pkl-neovim using the recommanded config for "lazy.nvim" but it did not result in a working install. :checkhealth nvim-treesitter give me the following error

The following errors have been detected: ~
- ERROR pkl(locals): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid structure at position 1024 for language pkl
  pkl(locals) is concatenated from the following files:
  | [ERROR]:"/home/marmoute/.local/share/nvim/lazy/pkl-neovim/queries/pkl/locals.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid structure at position 1024 for language pkl

I tried the recommandation at https://github.com/nvim-treesitter/nvim-treesitter#i-get-query-error-invalid-node-type-at-position without success.

Any idea of what's going wrong ?

bioball commented 1 month ago

This is fixed by https://github.com/apple/pkl-neovim/pull/14

driverkt commented 1 month ago

This is fixed by #14

It doesn't seem to be fixed.

image
bioball commented 1 month ago

Given that error message, it sounds like you need to run :TSInstall pkl

driverkt commented 1 month ago
image
driverkt commented 1 month ago
image
bioball commented 1 month ago

Can you run :TSUpdate, then :TSInstall pkl?

As for that undefined global, seems like it's some editor setting that you need to configure.

driverkt commented 1 month ago

:TSUpdate followed by :TSInstall pkl has no effect.

driverkt commented 1 month ago

@marmoute can you confirm whether your issue is resolved?

driverkt commented 1 month ago

As for that undefined global, seems like it's some editor setting that you need to configure.

Thanks for this, btw!

driverkt commented 1 month ago

@bioball: FWIW, pkl doesn't appear here: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages

Is something else we're doing in the lazy file ensuring that it is loaded some other way? I also tried changing my pkl.lua to match the current one on your README, but no luck.

bioball commented 1 month ago

We extend nvim-treesitter to add pkl as a language here: https://github.com/apple/pkl-neovim/blob/main/lua/pkl-neovim/internal.lua

Maybe try adding that code directly to your init.vim and see if that helps?

Personally, I use vim-plug, which works just fine for me.

CC @gibfahn who also uses Lazy

driverkt commented 1 month ago

@bioball: I appreciate your attempts to troubleshoot with me. :) I can confirm that it has worked in the past via lazy. I'm not sure what would have changed.

marmoute commented 1 month ago

@marmoute can you confirm whether your issue is resolved?

I ran TSUpdarte and TSInstall and I still get the following error.

The following errors have been detected:
- ERROR pkl(locals): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid structure at position 1024 for language pkl
  pkl(locals) is concatenated from the following files:
  | [ERROR]:"/home/marmoute/.local/share/nvim/lazy/pkl-neovim/queries/pkl/locals.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid structure at position 1024 for language pkl
bioball commented 1 month ago

Can you try the instructions provided in https://github.com/apple/pkl-neovim/pull/20?

See https://github.com/apple/pkl-neovim/pull/20/files