Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

3 changes: 2 additions & 1 deletion lua/codesettings/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local SpecialCases = {
end,
}

---@class Codesettings
local M = {}

---For more granular control, load settings manually through this
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion lua/codesettings/setup/lua_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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