lopi-py / luau-lsp.nvim

A luau-lsp extension to improve your experience in neovim.
MIT License
46 stars 10 forks source link

Unknown global with definitions_file provided #31

Closed eriickz closed 2 months ago

eriickz commented 2 months ago

Hello!.

This is my config: image

But I getting unkown global error: image

Don't mind these dots in these paths, they are just placeholders. I can remove the documentation_files option and the completions still works fine

lopi-py commented 2 months ago

You don't need to add the roblox types and docs path, it will be done automatically. You just need to pass your custom definition file

definition_files = {
  "path/to/robloxTypes.d.luau",
},

Also can you show the result of :checkhealth luau-lsp, :LspInfo and :LuauLsp log?

eriickz commented 2 months ago

I removed the documentation_files and definition_files but the problem persist.

:checkhealth luau-lsp image

:LspInfo image

:LuauLsp log 12:53:08[INFO] Starting sourcemap generation for 'default.project.json'

Also i got this error every time I tried to modify the file: image

Config setup: image

Regards!

lopi-py commented 2 months ago

The server is working as expected, but you have called lspconfig.luau_lsp.setup somewhere so that's creating another server that does not receive any configuration from luau-lsp.nvim. As you can see in :LspInfo, you have 2 servers spawned. Try to search in your config for lspconfig calls.

Check this comment for the error when you try to edit a file: https://github.com/lopi-py/luau-lsp.nvim/issues/30#issuecomment-2307929937

eriickz commented 2 months ago

I managed to fix it.

I'm using LunarVim and the default configuration of Mason that automatically install language servers, so I and included luau-lsp to the skipped servers and run :LvimResetCache (also I removed the language server that Mason installed before).

I included this in my config.lua: vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "luau-lsp" })

Now it worked as expected. Thanks for you support @lopi-py!