| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
|
|
|
|
|
| |
Problem:
str_byteindex_enc could return an error if the index was longer than the
lline length. This was handled in each of the calls to it individually
Solution:
* Fix the call at the source level so that if the index is higher than
the line length, line length is returned as per LSP specification
* Remove pcalls on str_byteindex_enc calls. No longer needed now that
str_byteindex_enc has a bounds check.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
LSP spec [states](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position)
that "if the character value is greater than the line length it defaults
back to the line length", but `locations_to_items` fails in that case.
Solution:
Adjust locations_to_items to follow the spec.
closes #28281
|
|
|
|
|
|
|
| |
- Merge all the top level 'LSP' describe blocks
- Refactor text edit tests
- Fix typing errors
- Add linebreaks between tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reverts https://github.com/neovim/neovim/pull/29212 and adds a few
additional test cases
From the spec
> All text edits ranges refer to positions in the document they are
> computed on. They therefore move a document from state S1 to S2 without
> describing any intermediate state. Text edits ranges must never overlap,
> that means no part of the original document must be manipulated by more
> than one edit. However, it is possible that multiple edits have the same
> start position: multiple inserts, or any number of inserts followed by a
> single remove or replace edit. If multiple inserts have the same
> position, the order in the array defines the order in which the inserted
> strings appear in the resulting text.
The previous fix seems wrong. The important part:
> If multiple inserts have the same position, the order in the array
> defines the order in which the inserted strings appear in the
> resulting text.
Emphasis on _appear in the resulting text_
Which means that in:
local edits1 = {
make_edit(0, 3, 0, 3, { 'World' }),
make_edit(0, 3, 0, 3, { 'Hello' }),
}
`World` must appear before `Hello` in the final text. That means the old
logic was correct, and the fix was wrong.
|
|
|
|
|
| |
This mostly means replacing `nvim_buf_call` and `nvim_win_call` with
`vim._with`.
|
|
|
|
|
|
| |
This reduces the number of nil checks around buf_versions usage
Test changes were lifted from 5c33815
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Problem:
Text edits with the same position (both line and character) were being
reverse sorted prior to being applied which differs from the lsp spec
Solution:
Change the sort order for just the same position edits
|
|
|
|
|
|
|
|
|
| |
* Revert "fix(lsp): account for changedtick version gap on modified reset (#29170)"
This reverts commit 2e6d295f799c27372e5c0c44727fa613c81717fd.
* Revert "refactor(lsp): replace util.buf_versions with changedtick (#28943)"
This reverts commit 5c33815448e11b514678f39cecc74e68131d4628.
|
|
|
|
| |
Follow up to https://github.com/neovim/neovim/pull/28943
Fixes https://github.com/neovim/neovim/issues/29163
|
| |
|
|
|
|
|
|
|
| |
`lsp.util.buf_versions` was already derived from changedtick (`on_lines`
from `buf_attach` synced the version)
As far as I can tell there is no need to keep track of the state in a
separate table.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove following functions:
- vim.lsp.util.extract_completion_items
- vim.lsp.util.get_progress_messages
- vim.lsp.util.parse_snippet()
- vim.lsp.util.text_document_completion_list_to_complete_items
- LanguageTree:for_each_child
- health#report_error
- health#report_info
- health#report_ok
- health#report_start
- health#report_warn
- vim.health.report_error
- vim.health.report_info
- vim.health.report_ok
- vim.health.report_start
- vim.health.report_warn
|
|
|
|
|
|
|
|
| |
Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com>
Co-authored-by: Ynda Jas <yndajas@gmail.com>
Co-authored-by: Owen Hines <TheOdd@users.noreply.github.com>
Co-authored-by: Wanten <41904684+WantenMN@users.noreply.github.com>
Co-authored-by: lukasvrenner <118417051+lukasvrenner@users.noreply.github.com>
Co-authored-by: cuinix <915115094@qq.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
`vim.lsp.util.rename()` deletes the buffers that are affected by
renaming. This has undesireable side effects. For example, when renaming
a directory, all buffers under that directory are deleted and windows
displaying those buffers are closed. Also, buffer options may change
after renaming.
Solution:
Rename the buffers with :saveas.
An alternative approach is to record all the relevant states and restore
it after renaming, but that seems to be more complex. In fact, the older
version was attempting to restore the states but only partially and
incorrectly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added `@inlinedoc` so single use Lua types can be inlined into the
functions docs. E.g.
```lua
--- @class myopts
--- @inlinedoc
---
--- Documentation for some field
--- @field somefield integer
--- @param opts myOpts
function foo(opts)
end
```
Will be rendered as
```
foo(opts)
Parameters:
- {opts} (table) Object with the fields:
- somefield (integer) Documentation
for some field
```
- Marked many classes with with `@nodoc` or `(private)`.
We can eventually introduce these when we want to.
|
|
|
|
|
|
|
| |
Problem:
After `rename()`, the undo information for the renamed file(s) are lost.
Solution:
Rename the undofile as well.
|
|
|
|
|
|
|
|
|
| |
Previously rename would unconditionally read the to-be-renamed file from the
disk and write it to the disk. This is redundant in some cases
If the file is not already loaded, it's not attached to lsp client, so nvim
doesn't need to care about this file.
If the file is loaded but has no change, it doesn't need to be written.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.
Solution:
Re-implement the flow using Lua, LPEG and treesitter.
- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
- LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
- LPEG for C parsing (see `scripts/cdoc_parser.lua`)
- Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
- Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
- `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
|
|
|
|
|
| |
Assert that the buffer number passed to apply_text_edits is fully
resolved (not 0 or null). Pass the known buffer number to
apply_text_edits from lsp.formatexpr().
|
|
|
|
|
| |
For example, when renaming /path/to/dir, buffers like
fern://drawer/file:///path/to/dir, /path/to/dir123 should not be
matched.
|
|
|
|
| |
* use builtin function
* buffer:// was removed in 236c20795eb9f11e21e0719b735ea741711acc08.
|
| |
|
|
|
|
|
|
|
|
| |
Problem:
If a rename results in a path that has missing parent directory(s), it
will fail.
Solution:
Do a recursive mkdir before attempting the rename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The benefit of this is that users only pay for what they use. If e.g.
only `vim.lsp.buf_get_clients()` is called then they don't need to load
all modules under `vim.lsp` which could lead to significant startuptime
saving.
Also `vim.lsp.module` is a bit nicer to user compared to
`require("vim.lsp.module")`.
This isn't used for some nested modules such as `filetype` as it breaks
tests with error messages such as "attempt to index field 'detect'".
It's not entirely certain the reason for this, but it is likely it is
due to filetype being precompiled which would imply deferred loading
isn't needed for performance reasons.
|
|
|
|
|
|
|
|
| |
This function is used only in the `workspace/configuration` handler,
and does not warrant a public API because of its confusing return types.
The only caller `vim.lsp.handlers["workspace.configuration"]` is also
refactored to use `vim.tbl_get()` instead.
|
| |
|
|
|
|
| |
Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
|
|
|
|
|
| |
These non-docstring comments can be included into doxygen's brief
description and then appear in the succeeding function documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 5cb906e91cb56302d0737aa80e2d890dde452029.
They were intentionally fast-tracked.
- `parse_snippet()` because of limited scope, and given that it's kinda
semi-broken (arbitrary formatting rules, not that useful for what it
was used for)
- `extract_completion_items()` doesn't work if we want to add the LSP
completionlist capability
- `text_document_completion_list_to_complete_items()` also doesn't work
for completionlist
|
|
|
|
|
|
|
|
|
| |
The following functions should be removed in 0.12 according to the
deprecation strategy in MAINTAIN.md:
- vim.lsp.util.extract_completion_items()
- vim.lsp.util.parse_snippet()
- vim.lsp.util.text_document_completion_list_to_complete_items()
|
| |
|
|
|
|
| |
Problem: luals reported many warnings
Solution: Add type annotations
|
| |
|
|
|
|
| |
Relates to https://github.com/neovim/neovim/issues/25272
|
|
|
|
|
| |
To reduce cross-chatter between modules and for https://github.com/neovim/neovim/issues/25272
Also preparing for https://github.com/neovim/neovim/issues/25714
|
| |
|
| |
|
|
|
| |
Fix #25610
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #24339
rust-analyzer sends "Invalid offset" error in such cases. Some other
servers handle it specially.
LSP spec mentions that "A range is comparable to a selection in an
editor". Most editors don't handle trailing newlines the same way
Neovim/Vim does, it's clearly visible if it's present or not. With that
in mind it's understandable why sending end position as simply the start
of the line after the last one is considered invalid in such cases.
|
| |
|
| |
|
|
|
|
| |
Fixes #22526
|
| |
|