mirror of
https://github.com/neovim/neovim.git
synced 2025-10-22 17:11:49 +00:00
LSP: highlight groups test, doc
This commit is contained in:
@@ -57,24 +57,39 @@ use of |v:lua| to call Lua from Vimscript): >
|
|||||||
autocmd Filetype python setlocal omnifunc=v:lua.vim.lsp.omnifunc
|
autocmd Filetype python setlocal omnifunc=v:lua.vim.lsp.omnifunc
|
||||||
|
|
||||||
|
|
||||||
FAQ ~
|
================================================================================
|
||||||
|
FAQ *lsp-faq*
|
||||||
|
|
||||||
> How to force-reload LSP?
|
- Q: How to force-reload LSP?
|
||||||
|
A: Stop all clients, then reload the buffer. >
|
||||||
Stop all clients, then reload the buffer. >
|
|
||||||
|
|
||||||
:lua vim.lsp.stop_all_clients()
|
:lua vim.lsp.stop_all_clients()
|
||||||
:edit
|
:edit
|
||||||
|
|
||||||
> Why isn't completion working?
|
- Q: Why isn't completion working?
|
||||||
|
A: In the buffer where you want to use LSP, check that 'omnifunc' is set to
|
||||||
In the buffer where you want to use LSP, check that 'omnifunc' is set to
|
"v:lua.vim.lsp.omnifunc": >
|
||||||
"v:lua.vim.lsp.omnifunc": >
|
|
||||||
|
|
||||||
:verbose set omnifunc?
|
:verbose set omnifunc?
|
||||||
|
|
||||||
Some other plugin may be overriding the option. To avoid that, you could set
|
< Some other plugin may be overriding the option. To avoid that, you could
|
||||||
the option in an |after-directory| ftplugin, e.g. "after/ftplugin/python.vim".
|
set the option in an |after-directory| ftplugin, e.g.
|
||||||
|
"after/ftplugin/python.vim".
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
LSP HIGHLIGHT *lsp-highlight*
|
||||||
|
|
||||||
|
When LSP is activated these highlight groups are defined:
|
||||||
|
|
||||||
|
LspDiagnosticsError
|
||||||
|
LspDiagnosticsHint
|
||||||
|
LspDiagnosticsInformation
|
||||||
|
LspDiagnosticsUnderline
|
||||||
|
LspDiagnosticsUnderlineError
|
||||||
|
LspDiagnosticsUnderlineHint
|
||||||
|
LspDiagnosticsUnderlineInformation
|
||||||
|
LspDiagnosticsUnderlineWarning
|
||||||
|
LspDiagnosticsWarning
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
LSP API *lsp-api*
|
LSP API *lsp-api*
|
||||||
|
@@ -549,7 +549,9 @@ do
|
|||||||
local underline_highlight_name = "LspDiagnosticsUnderline"
|
local underline_highlight_name = "LspDiagnosticsUnderline"
|
||||||
vim.cmd(string.format("highlight default %s gui=underline cterm=underline", underline_highlight_name))
|
vim.cmd(string.format("highlight default %s gui=underline cterm=underline", underline_highlight_name))
|
||||||
for kind, _ in pairs(protocol.DiagnosticSeverity) do
|
for kind, _ in pairs(protocol.DiagnosticSeverity) do
|
||||||
vim.cmd(string.format("highlight default link %s%s %s", underline_highlight_name, kind, underline_highlight_name))
|
if type(kind) == 'string' then
|
||||||
|
vim.cmd(string.format("highlight default link %s%s %s", underline_highlight_name, kind, underline_highlight_name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local severity_highlights = {}
|
local severity_highlights = {}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
|
local buf_lines = helpers.buf_lines
|
||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
@@ -709,14 +710,9 @@ describe('LSP', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('LSP util', function()
|
describe('LSP', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
insert(dedent([[
|
|
||||||
First line of text
|
|
||||||
Second line of text
|
|
||||||
Third line of text
|
|
||||||
Fourth line of text]]))
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function make_edit(y_0, x_0, y_1, x_1, text)
|
local function make_edit(y_0, x_0, y_1, x_1, text)
|
||||||
@@ -729,8 +725,29 @@ describe('LSP util', function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it('highlight groups', function()
|
||||||
|
eq({'LspDiagnosticsError',
|
||||||
|
'LspDiagnosticsHint',
|
||||||
|
'LspDiagnosticsInformation',
|
||||||
|
'LspDiagnosticsUnderline',
|
||||||
|
'LspDiagnosticsUnderlineError',
|
||||||
|
'LspDiagnosticsUnderlineHint',
|
||||||
|
'LspDiagnosticsUnderlineInformation',
|
||||||
|
'LspDiagnosticsUnderlineWarning',
|
||||||
|
'LspDiagnosticsWarning',
|
||||||
|
},
|
||||||
|
exec_lua([[require'vim.lsp'; return vim.fn.getcompletion('Lsp', 'highlight')]]))
|
||||||
|
end)
|
||||||
|
|
||||||
describe('apply_edits', function()
|
describe('apply_edits', function()
|
||||||
it('should apply simple edits', function()
|
before_each(function()
|
||||||
|
insert(dedent([[
|
||||||
|
First line of text
|
||||||
|
Second line of text
|
||||||
|
Third line of text
|
||||||
|
Fourth line of text]]))
|
||||||
|
end)
|
||||||
|
it('applies apply simple edits', function()
|
||||||
local edits = {
|
local edits = {
|
||||||
make_edit(0, 0, 0, 0, {"123"});
|
make_edit(0, 0, 0, 0, {"123"});
|
||||||
make_edit(1, 0, 1, 1, {"2"});
|
make_edit(1, 0, 1, 1, {"2"});
|
||||||
@@ -744,8 +761,7 @@ describe('LSP util', function()
|
|||||||
'Fourth line of text';
|
'Fourth line of text';
|
||||||
}, buf_lines(1))
|
}, buf_lines(1))
|
||||||
end)
|
end)
|
||||||
|
it('applies complex edits', function()
|
||||||
it('should apply complex edits', function()
|
|
||||||
local edits = {
|
local edits = {
|
||||||
make_edit(0, 0, 0, 0, {"", "12"});
|
make_edit(0, 0, 0, 0, {"", "12"});
|
||||||
make_edit(0, 0, 0, 0, {"3", "foo"});
|
make_edit(0, 0, 0, 0, {"3", "foo"});
|
||||||
|
Reference in New Issue
Block a user