- remove redundant autocmd list
This "grouped" list is useless, it only gets in the way when searching
for event names.
- intro.txt: cleanup
- starting.txt: update, revisit
- doc: `:help bisect`
- mbyte.txt: update aliases 1656367b90. closes#11960
- options: remove 'guifontset'. Why:
- It is complicated and is used by almost no one.
- It is unlikely to be implemented by Nvim GUIs (complicated to parse,
specific to Xorg...).
Since 1c3ca4f18f, 2c1d12d0be, #7836, the "unix" and "slash" behavior
of 'sessionoptions'/'viewoptions' is always enabled, and the flags are
just ignored. There is no reason for that behavior to be configurable.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem: Not so easy to interrupt a script programatically.
Solution: Add the interrupt() function. (Yasuhiro Matsumoto, closesvim/vim#2834)
67a2deb9cb
Problem: Cannot redefine user command without ! in same script
Solution: Allow redefining user command without ! in same script, like with
functions.
55d4691308
Problem: Sign column takes up space. (Adam Stankiewicz)
Solution: Optionally put signs in the number column. (Yegappan Lakshmanan,
closesvim/vim#4555, closesvim/vim#4515)
394c5d8870
I removed the SunOS stuff since no one uses SunOS and I've never tested
it on there.
I removed the section_flag init as we can just use -S instead of -s
and -S is used by every implementation as far as I know.
This brings man#init's time from 50-70ms to 15-20ms for me.
Closes#12318
Related #6766
Related #6815
* LSP: Add support for call hierarchies
* LSP: Add support for call hierarchies
* LSP: Add support for call hierarchies
* LSP: Jump to call location
Jump to the call site instead of jumping to the definition of the
caller/callee.
* LSP: add tests for the call hierarchy callbacks
* Fix linting error
Co-authored-by: Cédric Barreteau <>
Problem: When evaluating 'statusline' the current window is unknown.
(Daniel Hahler)
Solution: Set "g:actual_curwin" for %{} items. Set "g:statusline_winid"
when evaluationg %!. (closesvim/vim#4406, closesvim/vim#3299)
1c6fd1e100
Autoread now works in TUI too. The checktimestamp test is run at most once every 2 seconds not to poll too much and also because it doesn't make sense on some filesystems. A solution based on filesystem notifications should arrive soon.
* Fix some small doc issues
* doc: fixup
* doc: fixup
* Fix lint and rebase
* Remove bad advice
* Ugh, stupid mpack files...
* Don't let people include these for now until they specifically want to
* Prevent duplicate tag
* LSP: Add tests & use nvim_buf_get_lines in locations_to_items
This is to add support for cases where the server returns a URI in the
locations that does not have a file scheme but needs to be loaded via a
BufReadCmd event.
* LSP: Don't iterate through all lines in locations_to_items
* fixup! LSP: Don't iterate through all lines in locations_to_items
* fixup! fixup! LSP: Don't iterate through all lines in locations_to_items
* fixup! fixup! fixup! LSP: Don't iterate through all lines in locations_to_items
Problem: Syntax foldlevel is taken from the start of the line.
Solution: Add ":syn foldlevel" to be able to use the minimal foldlevel in the line.
e35a52aee7
With `foldmethod=syntax` the foldlevel of a line is computed based
on syntax items on the line. Previously we always used the level
of the syntax item containing the start of the line. This works
well in cases such as:
if (...) {
...
}
else if (...) {
...
}
else {
...
}
which folds like this:
+--- 3 lines: if (...) {---------------------------
+--- 3 lines: else if (...) {----------------------
+--- 3 lines: else {-------------------------------
However, the code:
if (...) {
...
} else if (...) {
...
} else {
...
}
folds like this:
+--- 7 lines: if (...) {---------------------------
We can make the latter case fold like this:
+--- 2 lines: if (...) {---------------------------
+--- 2 lines: } else if (...) {--------------------
+--- 3 lines: } else {-----------------------------
by choosing on each line the lowest fold level that is followed
by a higher fold level.
Add a syntax command
:syntax foldlevel [start | minimum]
to choose between these two methods of computing the foldlevel of
a line.
The client creates buffers on the fly to be able to apply text edits on
files that weren't previously open, which is great, but it uses the
bufadd() function, which creates unlisted buffers and can lead to a
weird experience in the text editor. Setting the buffer to buflisted
fixes this.
Closes#12488.
Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
* lsp: support custom hl groups in show_line_diagnostics
Closes#12472.
* runtime: add docs for the new lsp highlight groups
Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
According to the LSP spec[1], multiple edits can have the same starting
position, and if that is the case, they should be applied in the order
as they come in the array.
The implementation uses a reverse sort to not interfere with non applied
edits, but failed to take into account the spec.
[1] https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textedit
Not sure why this was added in 94f4469638
It doesn't seem to do anything and I can't reproduce the linked issue
with this patch so I think it's all working now.
cc @justinmk
Also, kudos to @zsugabubus for fixing a related issue in #12417
This also prevents any sorting of the paths from man. We need to
respect the order we get from it otherwise you end up loading
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man/man1/ls.1
on MacOS instead of /usr/share/man/man1/ls.1
Also cleaned it up a little and made it faster.
Closes#9159 and #9271
Also changes man#extract_sect_and_name_ref to only return a single
section at a time. This fixes a bug in its usage in man#goto_tag
where get_paths would be called with multiple sections and it does
not support that.
I noticed that our tagfunc doesn't obey b:man_default_sects and
I'll fix that next.
When UV_OVERLAPPED_PIPE was used for the pipe passed to the child process, a
problem occurred with the standard input of the .Net Framework application
(#11809). Therefore, add the overlapped option to jobstart() and change it so
that it is set only when necessary
* take wrapping into account when computing float height
* factor out size calculation
* add test
* accept and pass through opts.wrap_at in floating_preview
* make padding configurable
* slightly refactor fancy_floating_markdown to make use of make_position
* padding using string.format
* move trim and pad to separate function
* nit
Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
* remove mention of backward compat
* make lint happy
Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
* Add check for typeDefinition support in vim lsp server
* Check for typeDefinitionProvider in server
* Check for declarationProvider in server
* Add check for client support
* Fix typo
Old behavior is: foo(${placeholder: bar, ...)
with lots of random garbage you'd never want inserted.
New behavior is: foo(bar, baz)
(which maybe is good, maybe is bad [depends on user], but definitely better than it was).
-----
* Implement rudimentary snippet parsing
Add support for parsing and discarding snippet tokens from the completion items.
Fixes#11982
* Enable snippet support
* Functional tests for snippet parsing
Add simplified real-world snippet text examples to the completion items
test
* Add a test for nested snippet tokens
* Remove TODO comment
* Return the unmodified item if the format is plain text
* Add a plain text completion item
Problem: Terminal debugger: can't re-open source code window.
Solution: Add the :Source command. Also create the window if needed when
gdb stops at a source line.
c4b533e1e9
It's confusing because vim-lsp already has the same name as the plugin name that predates this built-in lsp.
Also, since "vim.fn.stdpath" is used, adding the prefix "nvim-" is redundant, so just "lsp.log" will suffice.
The `:lcd -` command, and `:tcd -` which returns to a previous directory, can be done with `:lc -` and `:tc -` respectively.
Basically, the d is optional, so I updated the documentation to indicate this in the traditional format.
* Change uri_to_fname to not convert non-file URIs
A URI with a scheme other than file doesn't have a local file path.
* fixup! Change uri_to_fname to not convert non-file URIs
* fixup! fixup! Change uri_to_fname to not convert non-file URIs
The callbacks for `textDocument/documentSymbol` and `workspace/symbol`
never received the `bufnr` argument because the logic that adds error
validation and logging swallowed the argument.
* add lua function to highlight yanked region
* extract namespace, better naming, default values
* add default for event argument
* free timer
* factor out mark to position calculation
* d'oh
* make sure timer stops before callback (cf. luv example)
* factor out timer, more documentation
* fixup
* validate function argument for schedule
* fix block selection past eol
* correct handling of multibyte characters
* move arguments around, some cleanup
* move utility functions to vim.lua
* use anonymous namespaces, avoid local api
* rename function
* add test for schedule_fn
* fix indent
* turn hl-yank into proper (hightlight) module
* factor out position-to-region function
mark extraction now part of highlight.on_yank
* rename schedule_fn to defer_fn
* add test for vim.region
* todo: handle double-width characters
* remove debug printout
* do not shadow arguments
* defer also callable table
* whitespace change
* move highlight to vim/highlight.lua
* add documentation
* add @return documentation
* test: add check before vim.defer fires
* doc: fixup
If the LSP sends an end line that is larger than what nvim considers to be the
last line, you get an Index out of bounds error when fetching the line from
nvim, a change that was introduced in #12223. This change removes the strict
indexing and checks the return value from nvim_buf_get_lines.
Problem: Cannot delete a match from another window. (Paul Jolly)
Solution: Add window ID argument to matchdelete(), clearmatches(),
getmatches() and setmatches(). (Andy Massimino, closesvim/vim#4178)
aff749145e
At least the `gopls` language server seems to return nil/null if no code
actions are available. Currently this results in an error:
> Error executing vim.schedule lua callback: shared.lua:199: Expected table, got nil
* Add textDocument/codeAction
* Add callback for workspace/executeCommand
* Escape newlines in codeAction titles
* Return empty list in get_line_diagnostics if no buffer diagnostics
* Add stub documentation
* Validate context parameter in code_action
* Add support for edit in CodeAction responses
* Group diagnostics by line in vim.lsp.util.get_line_diagnostics()
* Advertise code action literal support
* Make apply_text_edits non-ASCII safe
Use `vim.str_byteindex` to correct starting and ending positions for text edits if the line contains non-ASCII characters.
Fixes#12221
* text_edit may be applied to other buffers
* make sure the buffer is loaded
* add comments
* add test for non-ASCII edits
* lsp: handle kinds not specified in protocol
fix: #12200
If the client set "symbolKind.valueSet",
the client must handle it properly even if it receives a value outside the specification.
* test: add lsp.util.{get_completion_item_kind_name, get_symbol_kind_name} test case
* lsp: make lsp.util.{get_completion_item_kind_name, get_symbol_kind_name} private
Besides the special-case in get_scrolloff_value(), it makes sense for
'scrolloff' and 'sidescrolloff' to reflect the correct values (for
plugins, scripts, …).
ref 53d607af9c53accfd634435908fb79061f1212b9
ref #11915
ref #12230
* lsp: add workspace/symbol
* refactor symbol callback
* set hierarchical symbol support to true
* add documentation and default mapping
Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
This commit creates 4 new highlight groups:
- LspDiagnosticsErrorSign
- LspDiagnosticsWarningSign
- LspDiagnosticsInformationSign
- LspDiagnosticsHintSign
These highlight groups are linked to their corresponding LspDiagnostics
highlight groups by default.
This lets users choose a different color for their sign columns and
virtualtext diagnostics.
According to the spec there is the possibility that when a
VersionedTextDocumentIdentifier is used in a TextEdit the value may be
null. Currently we don't check for this and always assume that it's set.
So currently if a TextEdit comes in for a rename for example with the
version null, it fails as we are comparing the bufnumber with nil.
https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
The method with the name 'textDocument/peekDefinition' is not part of
the official language server protocol specification. Therefore no
language server can/will support this. Thereby all related code and
documentation as been removed.
Expose `vim.lsp.buf.diagnostics_by_buf`
This makes it easier to customize the diagnostics behavior. For example
to defer the update they can override the
`textDocument/publishDiagnostics` callback to only call
`buf_diagnostics_save_positions` and then defer the other actions to a
autocmd event.
In contrast to other callbacks for LSP requests like
`textDocument/documentSymbols`, does the one for references not open the
quickfix window after the quickfix list was filled. This left the user
in a situation he don't know what or if something had happen.
Related to: neovim/neovim#12170
Problem: The "last used" info of a buffer is under used.
Solution: Add "lastused" to getbufinfo(). List buffers sorted by last-used
field. (Andi Massimino, closesvim/vim#4722)
52410575be
Before this commit, the LSP client would throw errors when messages
without severity would be sent by the server. We make severity default
to `Error` as a kludge before proper heuristics to discover the severity
of a message are found.
[RFC] Update treesitter runtime
Get rid of our utf8proc dependency
Note that we unconditionnally escape treesitter queries, might need to be revisited.
Fix#12122
>Error executing vim.schedule lua callback: /usr/local/share/nvim/runtime/lua/vim/lsp/util.lua:560: Expected lua string
Some lsp server(e.g. https://github.com/bash-lsp/bash-language-server) not have kind in reference, reference["kind"] is nil
On some versions of Windows, WSL is unable to execute symbolic links to
Windows executables (microsoft/WSL#3999). As a workaround for that problem
this changes to use resolve() on WSL if win32yank was a symbolic link.
fixes#12113.
According to the LSP specification, showMessage is what is displayed and logMessage is what is stored.
Since these are different things, I devide the callback into those that match.
Problem: Can execute shell commands in rvim through interfaces.
Solution: Disable using interfaces in restricted mode. Allow for writing
file with writefile(), histadd() and a few others.
8c62a08faf
Problem: A plugin cannot easily expand a command like done internally.
Solution: Add the expandcmd() function. (Yegappan Lakshmanan, closesvim/vim#4514)
80dad48c50
Problem: :echomsg and :echoerr do not handle List and Dict like :echo does.
(Daniel Hahler)
Solution: Be more tolerant about the expression result type.
461a7fcfce
Add lua functional tests for :echo,:echon,:echomsg,:echoerr
because nvim did not port "test_" functions from Vim
that modify internal state.
Testing :echoerr via try/catch is sufficient.
This changes the `textDocument/references' callback to annotate the
locations returned by the server with the content present at the
locations range.
The quickfix list then looks as follows:
cr8/insert_fake_data.py|17 col 32| from .misc import parse_table, parse_version
cr8/insert_fake_data.py|43 col 15| version = parse_version(r['rows'][0][0])
cr8/java_magic.py|8 col 22| from cr8.misc import parse_version
cr8/java_magic.py|30 col 19| version = parse_version(fst)
cr8/java_magic.py|33 col 16| return parse_version(version_str)
Instead of:
cr8/insert_fake_data.py|17 col 32|
cr8/insert_fake_data.py|43 col 15|
cr8/java_magic.py|8 col 22|
cr8/java_magic.py|30 col 19|
cr8/java_magic.py|33 col 16|
haskell-ide-engine sends `hover` payloads as follows:
{
contents = {
kind = "markdown",
value = "\n```haskell\nfoo :: Either String (Integer, Text)\n```\n`foo` *local*"
},
range = {
end = {
character = 5,
line = 57
},
start = {
character = 2,
line = 57
}
}
}
`value` starts with `\n`. The logic in `convert_input_to_markdown_lines`
threw away the whole information.
Allow duplicates so that in languages with overloaded functions it will
show all signatures.
E.g. instead of having a single (last one wins)
add(int index, String element)
It shows all signatures:
add(String e) : boolean
add(int index, String element) : void
fix: #11826
Some lanuguage servers return complementary candidates whose prefixes do not match are also returned.
So we exclude completion candidates whose prefix does not match.
ex) Microsoft python-language-server, rust-analyzer
cpanm cannot look for Perl modules from root directories
without sudo so it creates '~/perl5/' and look for Perl modules in there.
Whether this directory existed before running cpanm or not,
cpanm returns a warning to advice the user to setup local::lib
in order to use modules in '~/perl5/' and exits with error code 0.
Each line in the warning always starts with '!'.
Display this warning to the user.
Continue parsing the version number if the warning can be ignored
because lines that are not prefixed with '!' are valid output.
Fix#11858