Closed KevinGamer3D2 closed 6 months ago
What is your neovim version, also check :LuauLog
to make sure that sourcemap is being generated
My neovim is on v0.9.5 and I also checked that sourcemap is being generated
Can you share the plugin setup?
Here:
local plugins = {}
table.insert(plugins, {
"lopi-py/luau-lsp.nvim",
opts = {
...
},
dependencies = {
"nvim-lua/plenary.nvim",
},
lazy = false
})
return plugins
If I use it with mason-lspconfig, the file won't be highlighted.
Are you passing the capabilities in the server field of the plugin setup?
Check the lsp logs (:LspLog
) with debug log level and make sure that luau-lsp is registering a file watcher for sourcemap.json
(use vim's search in the log buffer)
And yeah, neovim 0.9.x doesn't detect luau files, the plugin adds a custom detection for it on 0.9.x, so that's why it should be loaded at startup (in neovim 0.10, it can be loaded using mason-lspconfig.nvim)
Are you passing the capabilities in the server field of the plugin setup?
I'm not passing the capabilities in the server field of the plugin setup
Check the lsp logs (
:LspLog
) with debug log level and make sure that luau-lsp is registering a file watcher forsourcemap.json
(use vim's search in the log buffer)
I only have a warning that said [WARN][2024-03-16 15:26:10] ...lsp/handlers.lua:537 "client does not allow didChangeWatchedFiles registration - automatic updating on sourcemap/config changes will not be provided" and others are just unknown FFlags
And yeah, neovim 0.9.x doesn't detect luau files, the plugin adds a custom detection for it on 0.9.x, so that's why it should be loaded at startup (in neovim 0.10, it can be loaded using mason-lspconfig.nvim)
I tested this plugin on neovim 0.10 and the autocomplete now updates whenever I change or add a file, so I guess I will just use the neovim 0.10 then.
You can use 0.9.x, you just need to pass the capabilities in the server config and not lazy load the plugin, e.g:
require("luau-lsp").setup {
server = {
capabilities = capabilities,
},
}
If you are using nvim-cmp, check this guide
(Neovim 0.10 will set capabilities to vim.lsp.protocol.make_client_capabilities()
if not specified)
This plugin adds filetype detection for luau files, so you don't need 0.10, but I recommend it.
This issue still persist in 0.9.x, even if you pass the capabilities
I'll take a look into that, I remember it was working well on 0.9.x
@KevinGamer3D2 Ok, I've managed to get it working. It turns out that neovim 0.9 had disabled such capability even when it was working fine (maybe it was experimental), but you can manually enable it:
local capabilities = ...
capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = true
return {
server = {
capabilities = capabilities
},
}
I'll add this to the readme.
Whenever I rename or add a file the AutoCompletion won't update.
https://github.com/lopi-py/luau-lsp.nvim/assets/63291726/307cf205-dd68-4825-acd5-2e6fafdc9fa7
Currenty using NvChad as an IDE and my OS is Windows 11 Pro