lopi-py/luau-lsp.nvim

AutoCompletion nor Treesitter working

Nizarll opened this issue · 18 comments

image

Here's my mason_lspconfig
plugin is installed and everything is okay idk why its not working ?

btw im new on nvim

  • sourcemap and types options should not be there, please read the README.md
  • ["luau_lsp"] = { should be under settings table, read the README.md
  • require("luau-lsp").treesitter() should be before your tree-sitter config (again, check the README.md), after that you need to run :TSInstall luau
  • make sure that the lsp is actually installed via mason

all of this is documented in the readme.md so check it again to make sure you have set it up properly

image
image

Still not working also i got this error when putting require('luau-lsp').treesitter() before the tree sitter configuration file
image

for treesitter to work you need to reinstall the psrser. whats your output of :LspInfo when you enter a luau buffer? (luau lsp work for projects, not standalone scripts)

So I can't see if the Lsp is working on a simple luau script ?

Nope, you need to work in a luau project with root markers

image
when reinstalling treesitter luau

I can't tell if the treesitter parser isn't working, or if the way vim.lsp.buf.hover renders luau is janky.

This is from a hover request on nvim nightly:
image

Here is a hover request from nvim v0.9.4/v0.9.1(same for both):
image

Strangely, it actually looks (mostly?) fine within a markdown file:
image

I've verified that I ran require("luau-lsp").treesitter() before my treesitter config, and my lua-lsp.nvim config is the same as the example. I've also verified that I uninstalled the original luau parser, and reinstalled after adding require("luau-lsp").treesitter() to my config.

I'm using nvim-treesitter commit 3da5cfb, and luau-lsp version 1.26.0

Not sure if my issue is related, however I didn't want to open a new issue as they seemed similar. Would appreciate any help :)

Yeah its working as expected, only on nightly nvim makes markdown stuff to use treesitter (thats why only hover renders properly on nightly 🙂)

Any clue why it would highlight/color the function keyword differently between a markdown file and hover? the function DataModel:GetService(className: string): Instance example looks different between the markdown file and the hover, and I have no idea why :P

That is not related to this, it depends on how luau lsp returns the hover markdown, If you notice, function signatures aren't actual luau, just a pseudo-like luau so its expected to not render properly, vscode has also this problem afaik, but it is better than just a plain and uncolored text!

@Nizarll that happens when you have the parser running so you need to not run the luau parser (dont enter any buffer when you are reinstalling) or delete the parser manually (you have got the path in the screenshot I believe)

I'll document better the stuff about the parser and make it optional in case you want to use the default one

That is not related to this, it depends on how luau lsp returns the hover markdown, If you notice, function signatures aren't actual luau, just a pseudo-like luau so its expected to not render properly, vscode has also this problem afaik, but it is better than just a plain and uncolored text!

That makes sense, I'm assuming that pre v.10/nightly used markdown_fenced_languages to render markdown, which is why there was no highlighting as it simply didn't recognize luau(much like discord, and I think github still?)

However, I'm still confused why these get highlighted differently:

hover -
image

markdown file -
image

Those appear to be the exact same, and I'm assuming that a markdown file and hover both use treesitter on nightly, so I'm wondering why they would behave different o_O. Doesn't seem to be an issue with this plugin, but do you experience the same issue by chance?

Maybe because in the hover the end token is missing and its present in your markdown file, maybe the built-in parser works better for this cases, anyway always will be there minor issues like this in other cases, Ill make optional the custom parser soon (today or tomorrow), and yes, I also have that issue but I don't mind about it, I know it wont be perfecto all the time

I would have assumed that treesitter would be used in both markdown files, and hover, as if you run :set filetype? in the context of hover, and the context of a markdown file both return that the filetype is markdown.

Also the markdown file is the exact same as the hover, I just copy pasted that single line from the hover into it.

Super disturbing behavior, but luau is super jank so I'm not really surprised. I'm not rly bothered about it, I just wanted to make sure that it isn't just me seeing this behavior

Yeah I would asume it has to do with the parser but idk

@jasonpanosso I made the treesitter parser optional now, so try the latest release and have fun, just make sure to only have 1 neovim instance and no buffers opened, then reinstall the parser.

@Nizarll Did you manage it to work? try what I suggested you, it should work, otherwise, you can stick to the default parser.