diff --git a/README.md b/README.md index aff384f..59b54b3 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ return { ---lua_ls_integration = function() --- return vim.uv.cwd() == ('%s/.config/nvim'):format(vim.env.HOME) ---end, + ---This integration also works for emmylua_ls lua_ls_integration = true, ---Set filetype to jsonc when opening a file specified by `config_file_paths`, ---make sure you have the jsonc tree-sitter parser installed for highlighting @@ -176,7 +177,7 @@ return { } ``` -To get autocomplete in Lua files, either set `config.lua_ls_integration = true`, or use `---@module 'codesettings'` which will tell `lua_ls` as though `codesettings` +To get autocomplete in Lua files, either set `config.lua_ls_integration = true`, or (for `lua_ls` only, not `emmylua_ls`) use `---@module 'codesettings'` which will tell `lua_ls` as though `codesettings` has been `require`d, then you will have access to `---@type lsp.server_name` generated type annotations. ```lua @@ -438,4 +439,3 @@ This project would not exist without the hard work of some other open source pro - [x] [yamlls](https://github.com/redhat-developer/vscode-yaml/tree/master/package.json) - [x] [zeta_note](https://github.com/artempyanykh/zeta-note-vscode/tree/main/package.json) - [x] [zls](https://github.com/zigtools/zls-vscode/tree/master/package.json) - diff --git a/lua/codesettings/init.lua b/lua/codesettings/init.lua index 094c0e1..9d6601c 100644 --- a/lua/codesettings/init.lua +++ b/lua/codesettings/init.lua @@ -21,6 +21,7 @@ local SpecialCases = { end, } +---@class Codesettings local M = {} ---For more granular control, load settings manually through this @@ -53,7 +54,7 @@ end function M.with_local_settings(lsp_name, config, opts) opts = opts or {} local local_settings = M.local_settings(opts) - if SpecialCases[lsp_name] then + if SpecialCases[lsp_name] ~= nil then local_settings = SpecialCases[lsp_name](local_settings) else local_settings = local_settings:schema(lsp_name) diff --git a/lua/codesettings/setup/lua_ls.lua b/lua/codesettings/setup/lua_ls.lua index 3c0d92c..572fe6e 100644 --- a/lua/codesettings/setup/lua_ls.lua +++ b/lua/codesettings/setup/lua_ls.lua @@ -3,8 +3,8 @@ local Util = require('codesettings.util') local M = {} function M.setup() - ---@type lsp.lua_ls local config_update = { + ---@type lsp.lua_ls settings = { Lua = { workspace = { @@ -15,6 +15,7 @@ function M.setup() } Util.ensure_lsp_settings('lua_ls', config_update) + Util.ensure_lsp_settings('emmylua_ls', config_update) end return M