Repository navigation
Switch from lua_ls to emmylua_ls - #2163
oriori1703 wants to merge 2 commits into
Conversation
|
BTW, I also open a PR to add type hints for emmylua's lsp settings. |
|
Is there a reason for not merging this? Whats the holdup? |
Mainly because I'm looking for feedback (positive or negative), and because I'm on vacation and don't have the time right now :) |
| -- NOTE: this is a lot slower and will cause issues when working on your own configuration. | ||
| -- See https://github.com/neovim/nvim-lspconfig/issues/3189 | ||
| library = vim.api.nvim_get_runtime_file('', true), | ||
| format = { enable = false }, -- Disable formatting (formatting is done by stylua) |
There was a problem hiding this comment.
It seems that emmylua_ls does not provide an option to disable its formatting capability.
See:
There was a problem hiding this comment.
According to this https://github.com/EmmyLuaLs/emmylua-analyzer-rust/blob/main/docs/external_format/external_formatter_options_EN.md you can use external formatter by making emmyrc.json file.
nathanzeng
left a comment
There was a problem hiding this comment.
I don't know if it's just my machine or the fact that I'm on nightly, but I'm seeing a lot of additional diagnostic warnings from this PR.
I'm seeing missing required field warnings on which-key, mason, conform, and blink.
| ======== ||:Tutor || |:::::| ======== | ||
| ======== |'-..................-'| |____o| ======== | ||
| ======== `"")----------------(""` ___________ ======== | ||
| ======== /::::::::::| |::::::::::\ \ no mouse \ ======== |
| -- See `:help lua-options` | ||
| -- and `:help lua-guide-options` | ||
| vim.o.list = true | ||
| vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } |
There was a problem hiding this comment.
- Missing required fields in type
vim.Option:append,get,prepend,remove[missing-fields]
Diagnostic warning here. Could disable with
---@diagnostic disable-next-line: missing-fields or do something like
vim.o.listchars = 'tab:»·,trail:·,nbsp:␣'
a5e45ad to
8eba8d5
Compare
|
hm, with emmylua_ls I am getting errors(undefined global variables: gitsigns) in the following code: gitsigns.nav_hunk 'next'
end
end, { desc = 'Jump to next git [c]hange', buf = bufnr })
vim.keymap.set('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal { '[c', bang = true }
else
gitsigns.nav_hunk 'prev'
end
end, { desc = 'Jump to previous git [c]hange', buf = bufnr })
-- Visual mode actions
vim.keymap.set('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk', buf = bufnr })
vim.keymap.set('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk', buf = bufnr })
-- Normal mode actions
vim.keymap.set('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk', buf = bufnr })
vim.keymap.set('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk', buf = bufnr })
vim.keymap.set('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer', buf = bufnr })
vim.keymap.set('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer', buf = bufnr })
vim.keymap.set('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk', buf = bufnr })
vim.keymap.set('n', '<leader>hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline', buf = bufnr })
vim.keymap.set('n', '<leader>hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line', buf = bufnr })
vim.keymap.set('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index', buf = bufnr })
vim.keymap.set('n', '<leader>hD', function() gitsigns.diffthis '~' end, { desc = 'git [D]iff against last commit', buf = bufnr })
vim.keymap.set('n', '<leader>hQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)', buf = bufnr })
vim.keymap.set('n', '<leader>hq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)', buf = bufnr })
-- Toggles
vim.keymap.set('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line', buf = bufnr })
vim.keymap.set('n', '<leader>tw', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff', buf = bufnr })
-- Text object
vim.keymap.set({ 'o', 'x' }, 'ih', gitsigns.select_hunk, { desc = 'text object [i]nside [h]unk', buf = bufnr })
end,lua_ls does not, and gitsigns work Edit: corrected the code block |

Recently neovim maintainers switched from lua_ls to emmylua for the neovim/neovim repo (neovim/neovim#41750).
I thought this was probably a good time to try to switch to emmylua in kickstart.
I'm going to test this for bit before making a descision.
I would greatly appreciate if other people could check this out and report on their experience :)
related to #2147
closes: #1975
EmmyLua compatibility tracking
Testing this configuration with EmmyLua exposed several differences between EmmyLua and LuaLS in plugin annotations. The following upstream issues and fixes track those diagnostics:
The proposed annotation changes were checked with EmmyLua 0.25.1 and lua-language-server 3.19.1.