About five months ago, the biggest update of Nvim comes with its v0.5.0 release. With v0.5, we finally get the official LSP support in Nvim core and better Lua support, among other features and bug fixes1.
TL;DR: My LSP-related config can be found here.
This Tuesday, the Nvim v0.6.0 version is released. During the five months, the LSP module has been revamped and enhanced, though with some breaking changes.
Below are some the changes we need or can make based on this release.
Initially, diagnostic module is part of vim.lsp module. In order to support
external plugins such as null-ls.nvim, the nvim team has refactor the
diagnostic module to its module vim.diagnostic. So we need to change our config accordingly.
vim.lsp.diagnostic.show_line_diagnostics() has been changed to
vim.diagnostic.open_float(). Previously, there is no easy to show
diagnostic source unless with some hack, you can now show source in
diagnostics in open_float() easily:
vim.diagnostic.open_float(nil, {
source = 'always'
})vim.lsp.diagnostic.goto_prev() and vim.lsp.diagnostic.goto_next() has
been renamed to vim.diagnostic.goto_prev() and vim.diagnostic.goto_next()
respectively.
vim.lsp.diagnostic.set_loclist() and vim.lsp.diagnostic.set_qflist()
has been renamed to vim.diagnostic.setloclist() and
vim.diagnostic.setqflist() instead.
Diagnostics signs has been renamed, for example (old –> new):
LspDiagnosticsSignError –> DiagnosticSignError (Lsp is removed, Diagnostics is changed to singular from Diagnostic)LspDiagnosticsSignWarning –> DiagnosticSignWarnLspDiagnosticsSignInformation –> DiagnosticSignInfoLspDiagnosticsSignHint –> DiagnosticSignHintAlso, related highlight has been renamed too:
DiagnosticsDefaultError –> DiagnosticSignErrorDiagnosticsDefaultWarning –> DiagnosticSignWarnDiagnosticsDefaultInformation –> DiagnosticSignInfoDiagnosticsDefaultHint –> DiagnosticSignHintNow, we can use the following lua snippet to change diagnostic signs:
vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })For more details on diagnostic change, see this commit.
There are also changes to options and mappings that you might be interested.
Option default value changes:
backupdir can now be created automatically and double backslash is used, see this commit.inccommand is set to nosplitset nojoinspaces by defaultMapping changes:
<C-L> now defaults to nohlsearch and diffupdate, see this commit.Y is mapped to y$, see this commit, no need for nnoremap Y y$ anymore.About five months ago, the biggest update of Nvim comes with its v0.5.0 release. With v0.5, we finally get the official LSP support in Nvim core and better Lua support, among other features and bug fixes1.
TL;DR: My LSP-related config can be found here.
This Tuesday, the Nvim v0.6.0 version is released. During the five months, the LSP module has been revamped and enhanced, though with some breaking changes.
Below are some the changes we need or can make based on this release.
Initially, diagnostic module is part of vim.lsp module. In order to support
external plugins such as null-ls.nvim, the nvim team has refactor the
diagnostic module to its module vim.diagnostic. So we need to change our config accordingly.
vim.lsp.diagnostic.show_line_diagnostics() has been changed to
vim.diagnostic.open_float(). Previously, there is no easy to show
diagnostic source unless with some hack, you can now show source in
diagnostics in open_float() easily:
vim.diagnostic.open_float(nil, {
source = 'always'
})vim.lsp.diagnostic.goto_prev() and vim.lsp.diagnostic.goto_next() has
been renamed to vim.diagnostic.goto_prev() and vim.diagnostic.goto_next()
respectively.
vim.lsp.diagnostic.set_loclist() and vim.lsp.diagnostic.set_qflist()
has been renamed to vim.diagnostic.setloclist() and
vim.diagnostic.setqflist() instead.
Diagnostics signs has been renamed, for example (old –> new):
LspDiagnosticsSignError –> DiagnosticSignError (Lsp is removed, Diagnostics is changed to singular from Diagnostic)LspDiagnosticsSignWarning –> DiagnosticSignWarnLspDiagnosticsSignInformation –> DiagnosticSignInfoLspDiagnosticsSignHint –> DiagnosticSignHintAlso, related highlight has been renamed too:
DiagnosticsDefaultError –> DiagnosticSignErrorDiagnosticsDefaultWarning –> DiagnosticSignWarnDiagnosticsDefaultInformation –> DiagnosticSignInfoDiagnosticsDefaultHint –> DiagnosticSignHintNow, we can use the following lua snippet to change diagnostic signs:
vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })For more details on diagnostic change, see this commit.
There are also changes to options and mappings that you might be interested.
Option default value changes:
backupdir can now be created automatically and double backslash is used, see this commit.inccommand is set to nosplitset nojoinspaces by defaultMapping changes:
<C-L> now defaults to nohlsearch and diffupdate, see this commit.Y is mapped to y$, see this commit, no need for nnoremap Y y$ anymore.