aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
Commit message (Collapse)AuthorAge
...
| * fix(gen_lsp.lua): no notifications in lsp.Methods #24530Raphael2023-08-03
| | | | | | | | | | | | | | | | | | Problem: - Notifications are missing from `lsp.Methods`. - Need a way to represent `$/` prefixed methods. Solution: - Generate notifications. - Use "dollar_" prefix for `$/` methods.
| * docs(lua): fix generated `fname` param annotations #24533Marc Jakobi2023-08-02
| |
| * docs(builtin): fix alignment of comments in code blocks (#24529)zeertzjq2023-08-02
| |
| * docs: drop "Can also be used as a method" #24508Justin M. Keyes2023-08-01
| | | | | | | | | | | | | | | | Now that we "own" builtin.txt, we cant remove the repetitive mention of Vimscript's UFCS syntax. It's noisy to mention this for each function, and it's also not a Vimscript feature that should be encouraged. Also change the builtin.txt heading to "NVIM REFERENCE MANUAL", which indicates when a help file is Nvim-owned.
| * feat(lua): add meta file for vim submodules (#24525)Lewis Russell2023-08-01
| |
| * fix(loader): cache path ambiguity #24491Tyler Miller2023-08-01
| | | | | | | | | | | | | | | | | | | | | | Problem: cache paths are derived by replacing each reserved/filesystem- path-sensitive char with a `%` char in the original path. With this method, two different files at two different paths (each containing `%` chars) can erroneously resolve to the very same cache path in certain edge-cases. Solution: derive cache paths by url-encoding the original (path) instead using `vim.uri_encode()` with `"rfc2396"`. Increment `Loader.VERSION` to denote this change.
| * Merge #24504 feat(lsp): protocol.MethodsJustin M. Keyes2023-08-01
| |\
| | * feat(gen_lsp.lua): sort by name, handle failure #24504Justin M. Keyes2023-08-01
| | |
| | * feat(gen_lsp.lua): protocol.Methods #24504mathew2023-08-01
| | |
| * | feat(lua-types): types for vim.api.* (#24523)Lewis Russell2023-08-01
| |/
| * fix(lsp): inlay hints: "Failed to delete autocmd" when closing buffer #24469Chris AtLee2023-08-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: "Failed to delete autocmd" error when deleting LspNotify autocmd. #24456 Solution: Change a few things in the inlay_hint and diagnostic LSP code: 1. Re-introduce the `enabled` flag for the buffer state tables. Previously I was relying on the presence of an autocmd id in the state table to track whether inlay_hint / diagnostic was enabled for a buffer. There are two reasons why this doesn't work well: - Each time inlay_hint / diagnostic is enabled, we call `nvim_buf_attach` on the buffer, resulting in multiple `on_reload` or `on_detach` callbacks being registered. - Commands like `bwipeout` delete buffer local autocmds, sometimes before our `on_detach` callbacks have a chance to delete them first. This causes the - Use module local enabled state for diagnostic as well. bwipeout can race with on_detach callbacks for deleting autocmds. Error referenced in #24456. 2. Change the `LspDetach` autocmd to run each time (i.e., remove the `once` flag). Since we're only registering autocmds once per buffer now, we need to make sure that we set the enabled flag properly each time the LSP client detaches from the buffer. - Remove `once` from the LspDetach autocmds for inlay_hint and diagnostic. We only set up the autocmd once now. Gets removed when buffer is deleted. 3. Have the `LspNotify` handler also refresh the inlay_hint / diagnostics when receiving the `textDocument/didOpen` event. Before this point, the LSP backend doesn't have the contents of the buffer, so can't provide inlay hints or diagnostics. Downsides of this approach: * When inlay_hint / diagnostics are disabled on a buffer, it will continue to receive `LspNotify` events for that buffer. The callback exits early since the `enabled` flag is false. Alternatives: * Can we wrap the call to `nvim_del_autocmd` in `pcall` to swallow any errors resulting from trying to delete the autocmd? Fixes #24456 Helped-by: Maria José Solano <majosolano99@gmail.com>
| * fix(defaults): don't use nvim_feedkeys in default mappings (#24520)zeertzjq2023-08-01
| | | | | | | | | | | | | | Problem: Using nvim_feedkeys in default mappings makes it hard to use them as a part of another mapping. Solution: Use an expression mapping and stop Visual mode later. Fix #24518.
| * docs(builtin): fix and annotate language blocks (#24506)Lewis Russell2023-08-01
| |
| * feat(lsp): add actionable advice to lsp client quit error msg (#24510)Mathias Fußenegger2023-07-29
| | | | | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
| * docs(lua): vim.str_utf_{start,end,pos} #24424altermo2023-07-29
| | | | | | Closes #24422
| * feat(docs): generate builtin.txt (#24493)Lewis Russell2023-07-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - eval.lua is now the source of truth. - Formatting is much more consistent. - Fixed Lua type generation for polymorphic functions (get(), etc). - Removed "Overview" section from builtin.txt - Can generate this if we really want it. - Moved functions from sign.txt and testing.txt into builtin.txt. - Removed the *timer* *timers* tags since libuv timers via vim.uv should be preferred. - Removed the temp-file-name tag from tempname() - Moved lueval() from lua.txt to builtin.txt. * Fix indent * fixup! * fixup! fixup! * fixup! better tag formatting * fixup: revert changes no longer needed * fixup! CI --------- Co-authored-by: zeertzjq <zeertzjq@outlook.com>
| * fix(gen_vimfn_types): don't include tag before signature's line (#24492)zeertzjq2023-07-26
| | | | | | | | | | | | | | When signature is a bit long or there are too many tags, the tags appear before the signature's line. Don't include the line with tags in the previous function' docs. Also fix lint warnings.
| * feat(lua): typing for vim.fn.* (#24473)Lewis Russell2023-07-26
| | | | | | | | | | | | | | Problem: No LSP information for `vim.fn.*` Solution: Add meta file for `vim.fn.*`.
| * fix(lsp): fix multi client handling workspace_folder methods (#18839)Mathias Fußenegger2023-07-25
| | | | | | | | `buf_notify` sends the notification to all clients of a buffer, calling that inside a loop over clients multiplies the amount of notifications.
| * fix(lsp): SignatureHelp docstring is not escaped #16702Christoph Hasse2023-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Nvim LSP client always treats signature.documentation as markdown, even if the server returns a plain string. Per https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#signatureInformation in a SignatureInformation response, the documentation field can be either "string" or "MarkupContent". Solution: If signature.documentation is a string, treat it as "plaintext". Closes #16563
| * fix(lsp): E403 if doc contains multiple codeblocks #24458Raphael2023-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Content that has codeblocks with different languages, results in multiple calls to: syntax include vim syntax/vim.vim which raises error: E403: syntax sync: line continuations pattern specified twice Before ba8f19ebb67ca27d746f4b1cd902ab3d807eace3, this was avoided by using pcall() to ignore the error. Solution: Restore the use of pcall() to ignore the error. We plan to replace this logic with a treesitter approach, so this is good enough for now. Fix #24431
| * fix(lsp): replace @private with @nodoc for public client functions (#24415)Mathias Fußenegger2023-07-24
| | | | | | | | | | | | | | | | | | * fix(lsp): replace @private with @nodoc for public client functions To prevent lua-ls warnings in plugins which use the functions. * fix(lsp): remove duplicate type annotations/class definitions These annotations became duplicate with https://github.com/neovim/neovim/pull/23750
| * fix(lsp): announce publishDiagnostics.dataSupport (#24442)Bruce Weirdan2023-07-24
| | | | | | | | | | | | | | | | | | | | | | Neovim already passed `data` element from published diagnostic to code action, but failed to announce it in client capabilities. Here is the test that shows that `data` element is returned by `vim.lsp.diagnostic.get_line_diagnostics()`: https://github.com/neovim/neovim/blob/f56c1848091bb64c63b5bc25ec74bcbd2f52bdde/test/functional/plugin/lsp/diagnostic_spec.lua#L103-L115 and then `get_line_diagnostics()` is used to construct the context for code action request: https://github.com/neovim/neovim/blob/f56c1848091bb64c63b5bc25ec74bcbd2f52bdde/runtime/lua/vim/lsp/buf.lua#L742
| * fix(lsp): send empty "added" list when removing workspace folder #24440Mitchell Hanberg2023-07-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding `workspace/didChangeWorkspaceFolders` support to my [language server](https://github.com/elixir-tools/next-ls), I noticed that when neovim removes a workspace, it sends an empty table (which is serialized to an empty JSON array) for the value in the `added` field. This does not follow the spec; the `added` table should just be empty. The following error led me to this discovery. Note the payload includes `"added" => [[]]`: ``` 22:46:48.476 [error] LSP Exited. Last message received: handle_notification %{"jsonrpc" => "2.0", "method" => "workspace/didChangeWorkspaceFolders", "params" => %{"event" => %{"added" => [[]], "removed" => [%{"name" => "/Users/mitchell/src/gen_lsp", "uri" => "file:///Users/mitchell/src/gen_lsp"}]}}} ** (MatchError) no match of right hand side value: {:error, %{"params" => %{"event" => %{"added" => [error: "expected a map"]}}}} (gen_lsp 0.4.0) lib/gen_lsp.ex:265: anonymous fn/4 in GenLSP.loop/3 (gen_lsp 0.4.0) lib/gen_lsp.ex:292: GenLSP.attempt/3 (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3 ```
| * fix(lsp): noisy warning about offset_encodings #24441Keith Smiley2023-07-24
| | | | | | | | | | In the case you hit this warning in a buffer (like with C++ and clangd), this message potentially fires over and over again making it difficult to use the editor at all.
| * fix(gx): move to to _init_default_mappings #24420marshmallow2023-07-24
| | | | | | | | | | | | | | | | Problem: netrw may conflict with the Nvim default "gx" mapping. Solution: Initialize keymapping earlier by moving it to vim._init_default_mappings(). That also avoids needing to check maparg().
| * fix(treesitter): stop() should treat 0 as current buffer #24450Micah Halter2023-07-24
| |
| * refactor(lsp): use LspNotify for inlay_hint (#24411)Chris AtLee2023-07-22
| |
| * fix(api/options): validate buf and winLewis Russell2023-07-22
| | | | | | Fixes #24398
| * docs(lua): add missing word in docs for vim.empty_dict (#24401)Gnik2023-07-22
| |
| * fix(ui.open): some URLs fail on Windowsmarshmallow2023-07-21
| | | | | | | | | | | | | | | | | | | | | | | | Problem: On Windows, `explorer.exe` fails to open some URLs, for example: :lua vim.ui.open('https://devdocs.io/#q=lua%20lua_call') https://github.com/neovim/neovim/pull/23401#issuecomment-1641015704 Solution: Use rundll32 instead.
| * feat(lsp): implement textDocument/diagnostic (#24128)Chris AtLee2023-07-20
| |
| * docs(lua): clarify fs.find() documentation #24394futsuuu2023-07-19
| |
| * feat(lsp): handle multiple clients in omnifunc (#24381)Mathias Fußenegger2023-07-19
| | | | | | | | | | Also fixes https://github.com/neovim/neovim/issues/24369 by adding an extra `vim.schedule` to ensure the `vim.fn.complete` call happens outside of a luv callback
| * 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>
| * fix(fs.lua): normalize slash truncation (#23753)Mike2023-07-18
| | | | | | Preserve last slash in windows' root drive directories
| * Merge pull request #24363 from lewis6991/docs/luatypesLewis Russell2023-07-17
| |\ | | | | | | docs(lua): move some function docs to lua files
| | * fix: doc errorsLewis Russell2023-07-17
| | |
| | * fix: luacheckLewis Russell2023-07-17
| | |
| | * docs(lua): change *lua-foo* -> *vim.foo*Lewis Russell2023-07-17
| | |
| | * docs(lua): move function docs to lua filesLewis Russell2023-07-17
| | |
| | * refactor: rename _meta.lua to _options.luaLewis Russell2023-07-17
| | |
| * | feat(lsp)!: rename vim.lsp.get_active_clients to get_clients (#24113)Mathias Fußenegger2023-07-17
| | |
| * | fix(lsp): markdown code fence should allow space before info string #24364Mike2023-07-16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Bash language server returns "hover" markdown content that starts with a code fence and info string of `man` preceded by whitespace, which Nvim does not render properly. See https://github.com/bash-lsp/bash-language-server/blob/0ee73c53cebdc18311d4a4ad9367185ea4d98a03/server/src/server.ts#L821C15-L821C15 ```typescript function getMarkdownContent(documentation: string, language?: string): LSP.MarkupContent { return { value: language ? // eslint-disable-next-line prefer-template ['``` ' + language, documentation, '```'].join('\n') : documentation, kind: LSP.MarkupKind.Markdown, } } ``` For example, ``` ``` man NAME git - the stupid content tracker ``` ``` If I remove the white space, then it is properly formatted. ``` ```man instead of ``` man ``` Per CommonMark Spec https://spec.commonmark.org/0.30/#info-string whitespace is allowed before and after the `info string` which identifies the language in a codeblock. > The line with the opening code fence may optionally contain some text > following the code fence; this is trimmed of leading and trailing > spaces or tabs and called the [info > string](https://spec.commonmark.org/0.30/#info-string). If the [info > string](https://spec.commonmark.org/0.30/#info-string) comes after > a backtick fence, it may not contain any backtick characters. (The > reason for this restriction is that otherwise some inline code would > be incorrectly interpreted as the beginning of a fenced code block.) Solution: Adjust stylize_markdown() to allow whitespace before codeblock info.
| * feat(lsp): map K to hover by default #24331Mathias Fußenegger2023-07-14
| | | | | | Related: https://github.com/neovim/neovim/issues/24252
| * fix(lsp): remove unknown LSP protocol property (#24345)Techatrix2023-07-14
| | | | | | 'hierarchicalWorkspaceSymbolSupport' is not part of the LSP Specification
| * docs(lua): adds links to related keymap functions to keymap.set (#24337)Mathias Fußenegger2023-07-13
| | | | | | Might help with discovery, given that there is no `keymap.get()`
| * feat(lsp): add method filter to get_active_clients (#24319)Mathias Fußenegger2023-07-12
| |
| * fix(lint): lint warnings #24226Raphael2023-07-10
| |
| * fix(defaults): visual star (*) on text with "?"Justin M. Keyes2023-07-08
| | | | | | | | regression from 6318edadc32acce3ed41a6995a5faa5395b5f562