jrmoulton / tree-sitter-slint

A Tree Sitter parser for slint
MIT License
2 stars 2 forks source link

No syntax highlight in Neovim (LazyVim by Folke) #11

Open Memnoc opened 8 months ago

Memnoc commented 8 months ago

Hello 👋🏻

I have just today attempted to use this project as I am starting to work with slint. I can successfully install the treesitter and lsp via Mason and TSInstall slint respectively.

However, I get completely white text, no syntax highlighting, linting or formatting provided. I have then tried to manually override the config offered from LazyVim to no avail.

I have tested this on three different machines with Debian, Fedora, MacOS Sonoma respectively.

just to make sure, I have tested the same code on VSCode with the slint-extension and there I get all the features and functionalities.

Let me know if I can help this in any way - thank you!

jrmoulton commented 8 months ago

Hi!

I should probably mark this repo as public archive as I haven't maintained it in a while. Slint manages their own version of the Grammer in their main repository under the editors folder.

If the nvim lsp points here it should probably be changed to the slint version

Memnoc commented 8 months ago

Hey! Thank you for your answer!

Do you think submitting a PR to treesitter asking them to point to the new resources would be helpful?

jrmoulton commented 8 months ago

I do think that would be a good idea. What do you think @hunger?

hunger commented 8 months ago

@jrmoulton: My last state was that you wanted to continue working on your version and maybe even eventually merge that work into the official slint repo. I did not want to interfeer, so I did not do anything wrt. tree-sitter in a while.

If you are archiving this repository, then pointing Mason/etc. to the tree-sitter in the Slint repo would make a lot of sense.

Memnoc commented 7 months ago

@jrmoulton @hunger any news on this? Do you want me to submit the PR to tree-sitter? Happy to help :)

hunger commented 7 months ago

Feel free to do the PR:-) Any help with tree-sitter is appreciated!

Memnoc commented 7 months ago

PR opened here: https://github.com/nvim-treesitter/nvim-treesitter/issues/5984

Memnoc commented 7 months ago

PR was not accepted - sorry lads

Memnoc commented 7 months ago

However for anyone reading, if you attach a file type manually with :set filetype=slint you do get syntax highlighting at least

wookayin commented 7 months ago

PR opened here: nvim-treesitter/nvim-treesitter#5984

That was not a PR, but invalid usage question. slint is supported by nvim-treesitter and highlight should work fine as the parser and query files exist. Looking at your specific issue what you can refer to is

jrmoulton commented 7 months ago

I have no issue with this issue being open. Just seems like there was some misunderstanding.

I opened an actual PR to point nvim treesitter to the official slint repo

wookayin commented 7 months ago

Sorry for my misunderstanding, the request the OP wanted is now going to be addressed by replacing with a new tree-sitter parser, as you already did.

https://github.com/nvim-treesitter/nvim-treesitter/pull/5985

jrmoulton commented 7 months ago

@wookayin no problem. I got taken for a ride for a bit too.

@Memnoc PR is short for pull request which refers to the merging of changes into a repository.

It is separate from an issue.

Thanks for taking initiative to help improve things!

Memnoc commented 7 months ago

@jrmoulton @wookayin thank you both and sorry for the misunderstanding.

For the record, I know and work with PR's daily, and yet I've misused the term here, causing confusion. My bad!

I'll make sure to look into the technical aspect of this issue as there some things I don't understand (clearly) but I appreciate the help nonetheless.

Thank you all 👍🏻

hunger commented 7 months ago

Ah, progress, just in time when I just did something on our tree-sitter code :-)

Thanks @Memnoc and @jrmoulton for doing all this.

Memnoc commented 6 months ago

Hey @hunger I saw your PR was merge days ago, congrats and thank you for all the hard work! I am still clearly missing something I think because even after updating the LSP via Mason and reinstalling the Tresitter part I still get no highlighting just like before.

I apologise in advance if I am missing some basic neovim 101 here, but based on basically any other language I use, when I install LSP and Treesitter I get code highlights and completion and all the rest, but it does not seem to be the case here.

jrmoulton commented 6 months ago

@Memnoc can you run a :checkhealth and check in the tree sitter section if slint is listed there and has a checkmark for H (highlights)

Memnoc commented 6 months ago

@jrmoulton sure thing, it checks out all the boxes

- slint ✓ ✓ ✓ ✓ ✓

If I do a filetype=slint on the buffer, I do get highlighting but not formatting or autocompletion, and a LspInfo on the buffer shows


Language client log: /home/memnoc/.local/state/nvim/lsp.log
 Detected filetype:   

 0 client(s) attached to this buffer: 

 1 active client(s) not attached to this buffer: 

 Client: rust_analyzer (id: 1, bufnr: [3])
    filetypes:       rust
    autostart:       true
    root directory:  Running in single file mode.
    cmd:             /home/memnoc/.local/share/nvim/mason/bin/rust-analyzer

 Configured servers list: rust_analyzer, clangd, tailwindcss, cmake, yamlls, lua_ls, emmet_ls, tsserver, neocmake, jdtls, jsonls, astro, svelte, eslint, taplo, cssls, slint_lsp, html, gopls

Seems to me the issue is that .slint is not detected as filetype, but I have no idea why is that

jrmoulton commented 6 months ago

You need to configure the filetype for slint in your configs. Neovim doesn't know about it natively. That will fix this issue with the highlighting.

The lsp issue is unrelated to the tree-sitter config and nothing with the tree-sitter highlighting affects it. You'll need to check the lsp configs (tree-sitter is also not involved with formatting or autocompletion. That is also the lsp)