Hi! I noticed that defold.nvim configures lua_ls with its own diagnostics.globals:
diagnostics = {
globals = {
"final",
"fixed_update",
"init",
"on_input",
"on_message",
"on_reload",
"update",
},
},
This works well for Defold-specific globals, but it means that user-defined globals configured elsewhere are not available when editing Lua files inside a Defold project.
For example, I have the following in my regular lua_ls configuration:
diagnostics = {
globals = {
"vim",
"spine",
"firebase",
},
},
This works correctly in regular Lua files, but once defold.nvim attaches its lua_ls configuration, these globals are no longer recognized and I get warnings such as:
Undefined global firebase
Suggested solution
Would it be possible to make the Defold LSP globals configurable, or provide a way to extend the default list?
For example, something along these lines:
opts = {
lsp = {
diagnostics = {
globals = {
"vim",
"spine",
"firebase",
},
},
},
}
The plugin could then merge the user-provided globals with the built-in Defold globals rather than replacing them.
For example:
globals = vim.list_extend({
"final",
"fixed_update",
"init",
"on_input",
"on_message",
"on_reload",
"update",
}, user_globals or {})
This would preserve the built-in Defold globals while allowing projects/users to define additional globals.
Thanks!
Hi! I noticed that defold.nvim configures lua_ls with its own diagnostics.globals:
This works well for Defold-specific globals, but it means that user-defined globals configured elsewhere are not available when editing Lua files inside a Defold project.
For example, I have the following in my regular lua_ls configuration:
This works correctly in regular Lua files, but once defold.nvim attaches its lua_ls configuration, these globals are no longer recognized and I get warnings such as:
Undefined global
firebaseSuggested solution
Would it be possible to make the Defold LSP globals configurable, or provide a way to extend the default list?
For example, something along these lines:
The plugin could then merge the user-provided globals with the built-in Defold globals rather than replacing them.
For example:
This would preserve the built-in Defold globals while allowing projects/users to define additional globals.
Thanks!