aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/semantic_tokens.lua
Commit message (Collapse)AuthorAge
* fix: resolve all remaining LuaLS diagnosticsLewis Russell2025-01-27
|
* refactor: use nvim.foo.bar format for autocommand groupsMaria José Solano2025-01-14
|
* refactor: use nvim.foo.bar format for namespacesMaria José Solano2025-01-14
|
* refactor: add vim._resolve_bufnrLewis Russell2024-12-07
|
* feat(lsp): deprecate non-method client functionsLewis Russell2024-11-20
| | | | | | | | | | | | | | Deprecated: - `client.request()` -> `client:request()` - `client.request_sync()` -> `client:request_sync()` - `client.notify()` -> `client:notify()` - `client.cancel_request()` -> `client:cancel_request()` - `client.stop()` -> `client:stop()` - `client.is_stopped()` `client:is_stopped()` - `client.supports_method()` -> `client:supports_method()` - `client.on_attach()` -> `client:on_attach()` Fixed docgen to link class fields to the full function doc.
* perf(lsp): use faster version of str_byteindexLewis Russell2024-11-11
|
* fix(lsp): fix infinite loopLewis Russell2024-11-09
| | | | Fixes #31129
* perf(lsp): do not apply semantic tokens to folded linesLewis Russell2024-11-08
| | | | Fixes #31106
* refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915Tristan Knight2024-10-26
| | | | | * deprecate old signatures * move to new str_byteindex/str_utfindex signature * use single-underscore name (double-underscore is reserved for Lua itself)
* refactor: rename vim.highlight => vim.hlJustin M. Keyes2024-10-21
| | | | | | | | | | | | Problem: - `vim.highlight` module does not follow `:help dev-name-common`, which documents the name for "highlight" as "hl". - Shorter names are usually preferred. Solution: Rename `vim.highlight` to `vim.hl`. This is not a breaking change until 2.0 (or maybe never).
* perf(validate): use lighter versionLewis Russell2024-10-17
| | | | | - Also fix `vim.validate()` for PUC Lua when showing errors for values that aren't string or number.
* fix(lsp): handle out-of-bounds character positions #30288Tristan Knight2024-09-08
| | | | | | | | | | | 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.
* refactor(lsp): use metatable for buf_versions (#29304)Ilia Choly2024-06-14
| | | | | | 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>
* refactor(lua): improve type annotationsLewis Russell2024-06-11
|
* fix(lsp): revert buf_versions deprecation/replacement (#29217)Mathias Fußenegger2024-06-07
| | | | | | | | | * 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.
* fix(lsp): remove superfluous on_detach callback from semantic tokens module ↵jdrouhard2024-06-04
| | | | | | | | | | | | (#29174) LspDetach is now triggered by the main on_detach callback that is added when an LSP client is attached to a buffer. The semantic_tokens module already includes a LspDetach handler that does the right thing. When the LspDetach trigger was added to the main LSP on_detach, it created a race condition in semantic tokens when a buffer was deleted that would trigger both its own on_detach and the LspDetach handlers. If the former came last, an error was thrown trying to delete a non-existent augroup (destroy() was being called twice).
* refactor(lsp): replace util.buf_versions with changedtick (#28943)Mathias Fußenegger2024-05-30
| | | | | | | `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.
* fix(lsp): semantic token functions allow "0" bufnr #28849Riley Bruins2024-05-21
| | | aligns with ":help dev-patterns"
* feat(api): add nvim__redraw for more granular redrawingLuuk van Baal2024-05-02
| | | | | | | | | | | Experimental and subject to future changes. Add a way to redraw certain elements that are not redrawn while Nvim is waiting for input, or currently have no API to do so. This API covers all that can be done with the :redraw* commands, in addition to the following new features: - Immediately move the cursor to a (non-current) window. - Target a specific window or buffer to mark for redraw. - Mark a buffer range for redraw (replaces nvim__buf_redraw_range()). - Redraw the 'statuscolumn'.
* docs(lua): improvements for LSP and DiagnosticLewis Russell2024-03-05
|
* docs: improve/add documentation of Lua typesLewis Russell2024-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* fix(lsp): semantic token defer loadingLewis Russell2024-02-12
| | | | Fixes #27424
* feat(lsp): more annotationsLewis Russell2023-12-14
|
* docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|
* fix(lua): improve annotations for stricter luals diagnostics (#24609)Christian Clason2023-08-09
| | | | | | | | | | | | | | | Problem: luals returns stricter diagnostics with bundled luarc.json Solution: Improve some function and type annotations: * use recognized uv.* types * disable diagnostic for global `vim` in shared.lua * docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type) * add type alias for lpeg pattern * fix return annotation for `vim.secure.trust` * rename local Range object in vim.version (shadows `Range` in vim.treesitter) * fix some "missing fields" warnings * add missing required fields for test functions in eval.lua * rename lsp meta files for consistency
* refactor(lsp): use protocol.Methods instead of strings #24537Raphael2023-08-03
|
* docs(lua): more improvements (#24387)Lewis Russell2023-07-18
| | | | | | | | | | | | | | | | | * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* perf(lsp): load buffer contents once when processing semantic tokens ↵jdrouhard2023-05-05
| | | | | | | | | | | | | | | | | | | | | | | | | | responses (#23484) perf(lsp): load buffer contents once when processing semantic token responses Using _get_line_byte_from_position() for each token's boundaries was a pretty huge bottleneck, since that function would load individual buffer lines via nvim_buf_get_lines() (plus a lot of extra overhead). So each token caused two calls to nvim_buf_get_lines() (once for the start position, and once for the end position). For semantic tokens, we only attach to buffers that have already been loaded, so we can safely just get all the lines for the entire buffer at once, and lift the rest of the _get_line_byte_from_position() implementation directly while bypassing the part that loads the buffer line. While I was looking at get_lines (used by _get_line_byte_from_position), I noticed that we were checking for non-file URIs before we even looked to see if we already had the buffer loaded. Moving the buffer-loaded check to be the first thing done in get_lines() more than halved the average time spent transforming the token list into highlight ranges vs when it was still using _get_line_byte_from_position. I ended up improving that loop more by not using get_lines, but figured the performance improvement it provided was worth leaving in.
* perf(lsp): process semantic tokens response in a coroutine that yields every ↵jdrouhard2023-05-01
| | | | 5ms (#23375)
* perf(lsp): better binary search mid calculation in semantic token (#22607)Null Chilly2023-03-10
| | | This commit replaces the usage of math.floor((lo + hi) / 2) with the faster and equivalent bit.rshift(lo + hi, 1) for calculating the midpoint in binary search.
* fix(lsp): change LspTokenUpdate to use buffer instead of pattern (#22559)jdrouhard2023-03-07
|
* docs(lsp): change type annotations from number → integer (#22510)Jaehwang Jung2023-03-07
|
* feat(lsp)!: add rule-based sem token highlighting (#22022)swarn2023-03-06
| | | | | | | | | | | | | feat(lsp)!: change semantic token highlighting Change the default highlights used, and add more highlights per token. Add an LspTokenUpdate event and a highlight_token function. :Inspect now shows any highlights applied by token highlighting rules, default or user-defined. BREAKING CHANGE: change the default highlight groups used by semantic token highlighting.
* perf(lsp): only redraw the windows containing LSP tokensbfredl2023-02-28
| | | | | | | | redraw! redraws the entire screen instead of just the windows with the buffer which were actually changed. I considered trying to calculating the range for the delta but it looks tricky. Could a follow-up.
* refactor(lsp): remove workaround for missing bit module (#22373)Mathias Fußenegger2023-02-23
|
* fix(lsp): revert semantic token gravity change from #21574 (#21763)jdrouhard2023-01-12
|
* fix(lsp): partially revert semantic token gravity change from #21574 (#21680)jdrouhard2023-01-08
|
* fix(lsp): adjust gravity of semantic tokens extmarks (#21574)jdrouhard2022-12-30
| | | | | Fixes #21543 This should provide a better user experience when appending or prepending text to a word that has a semantic token extmark. More often than not, the appended/prepended text to the word will end up becoming part of the token anyway, so just use that extmark as the user types.
* fix(lsp): token_edit.data might be null on deletion (#21462)tiagovla2022-12-19
|
* feat: `vim.inspect_pos`, `vim.show_pos`, `:Inspect`Folke Lemaitre2022-12-17
|
* feat(lsp): add function to get semantic tokens at cursorChristian Clason2022-12-13
|
* feat(lsp): highlight semantic token modifiers (#21390)Christian Clason2022-12-12
| | | | | | | | Apply semantic token modifiers as separate extmarks with corresponding highlight groups (e.g., `@readonly`). This is a low-effort PR to enable the most common use cases (applying, e.g., italics or backgrounds on top of type highlights; language-specific fallbacks like `@global.lua` are also available). This can be replaced by more complicated selector-style themes later on.
* perf(lsp): update semantic tokens algorithm for parsing modifiers (#21383)jdrouhard2022-12-12
| | | | | | | | Instead of testing for every possible modifier type, only test bits up to the highest set in the token array. Saves many bit ops and comparisons when there are no modifiers or when the highest set bit is a lower bit than the highest possible in the legend on average. Can be further simplified when non-luaJIT gets the full bit module (see #21222)
* docs #20986Justin M. Keyes2022-12-11
| | | | | | - https://github.com/neovim/tree-sitter-vimdoc v1.2.4 eliminates most errors in pi_netrw.txt, so we can remove that workaround from ignore_parse_error(). - improved codeblock
* fix(lsp): ignore null responses for semanticTokens request (#21364)fsouza2022-12-10
| | | | | | | | The spec indicates that the response may be `null`, but it doesn't really say what a `null` response means. Since neovim raises an error if the response is `null`, I figured that ignoring it would be the safest bet. Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): followup fixes for semantic tokens support (#21357)jdrouhard2022-12-09
| | | | | | | | | | | | | | | | 1. The algorithm for applying edits was slightly incorrect. It needs to preserve the original token list as the edits are applied instead of mutating it as it iterates. From the spec: Semantic token edits behave conceptually like text edits on documents: if an edit description consists of n edits all n edits are based on the same state Sm of the number array. They will move the number array from state Sm to Sm+1. 2. Schedule the semantic token engine start() call in the client._on_attach() function so that users who schedule_wrap() their config.on_attach() functions (like nvim-lspconfig does) can still disable semantic tokens by deleting the semanticTokensProvider from their server capabilities.
* feat(lsp): initial support for semantic token highlightingJohn Drouhard2022-12-08
* credit to @smolck and @theHamsta for their contributions in laying the groundwork for this feature and for their work on some of the helper utility functions and tests