aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_vimdoc.py
Commit message (Collapse)AuthorAge
* fix(docgen): add tagfunc.luaMichael Lingelbach2021-11-18
|
* fix(docs): add sync.lua to gen_vimdoc (#16285)Michael Lingelbach2021-11-11
|
* refactor(api): break out Vim script functions to its own fileBjörn Linse2021-10-29
|
* ci: add newly added api file extmark.c to gen-vimdoc (#16158)dundargoc2021-10-27
|
* fix(gen_vimdoc.py): spacing around inline elements #16092Gregory Anders2021-10-19
| | | | | The spacing fix drew attention to a couple of places that were using incorrect formatting such as the key listing for `nvim_open_win`, so those were fixed too.
* fix(docs): add win_config.cJustin M. Keyes2021-10-05
|
* feat(ui): add vim.ui.select and use in code actions (#15771)Mathias Fußenegger2021-09-27
| | | | | | | | | | | | | Continuation of https://github.com/neovim/neovim/pull/15202 A plugin like telescope could override it with a fancy implementation and then users would get the telescope-ui within each plugin that utilizes the vim.ui.select function. There are some plugins which override the `textDocument/codeAction` handler solely to provide a different UI. With custom client commands and soon codeAction resolve support, it becomes more difficult to implement the handler right - so having a dedicated way to override the picking function will be useful.
* Merge #15585 refactor: move vim.lsp.diagnostic to vim.diagnosticJustin M. Keyes2021-09-16
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Overview - Move vim.lsp.diagnostic to vim.diagnostic - Refactor client ids to diagnostic namespaces - Update tests - Write/update documentation and function signatures Currently, non-LSP diagnostics in Neovim must hook into the LSP subsystem. This is what e.g. null-ls and nvim-lint do. This is necessary because none of the diagnostic API is exposed separately from the LSP subsystem. This commit addresses this by generalizing the diagnostic subsystem beyond the scope of LSP. The `vim.lsp.diagnostic` module is now simply a specific diagnostic producer and primarily maintains the interface between LSP clients and the broader diagnostic API. The current diagnostic API uses "client ids" which only makes sense in the context of LSP. We replace "client ids" with standard API namespaces generated from `nvim_create_namespace`. This PR is *mostly* backward compatible (so long as plugins are only using the publicly documented API): LSP diagnostics will continue to work as usual, as will pseudo-LSP clients like null-ls and nvim-lint. However, the latter can now use the new interface, which looks something like this: ```lua -- The namespace *must* be given a name. Anonymous namespaces will not work with diagnostics local ns = vim.api.nvim_create_namespace("foo") -- Generate diagnostics local diagnostics = generate_diagnostics() -- Set diagnostics for the current buffer vim.diagnostic.set(ns, diagnostics, bufnr) ``` Some public facing API utility methods were removed and internalized directly in `vim.diagnostic`: * `vim.lsp.util.diagnostics_to_items` ## API Design `vim.diagnostic` contains most of the same API as `vim.lsp.diagnostic` with `client_id` simply replaced with `namespace`, with some differences: * Generally speaking, functions that modify or add diagnostics require a namespace as their first argument, e.g. ```lua vim.diagnostic.set({namespace}, {bufnr}, {diagnostics}[, {opts}]) ``` while functions that read or query diagnostics do not (although in many cases one may be supplied optionally): ```lua vim.diagnostic.get({bufnr}[, {namespace}]) ``` * We use our own severity levels to decouple `vim.diagnostic` from LSP. These are designed similarly to `vim.log.levels` and currently include: ```lua vim.diagnostic.severity.ERROR vim.diagnostic.severity.WARN vim.diagnostic.severity.INFO vim.diagnostic.severity.HINT ``` In practice, these match the LSP diagnostic severity levels exactly, but we should treat this as an interface and not assume that they are the same. The "translation" between the two severity types is handled transparently in `vim.lsp.diagnostic`. * The actual "diagnostic" data structure is: (**EDIT:** Updated 2021-09-09): ```lua { lnum = <number>, col = <number>, end_lnum = <number>, end_col = <number>, severity = <vim.diagnostic.severity>, message = <string> } ``` This differs from the LSP definition of a diagnostic, so we transform them in the handler functions in vim.lsp.diagnostic. ## Configuration The `vim.lsp.with` paradigm still works for configuring how LSP diagnostics are displayed, but this is a specific use-case for the `publishDiagnostics` handler. Configuration with `vim.diagnostic` is instead done with the `vim.diagnostic.config` function: ```lua vim.diagnostic.config({ virtual_text = true, signs = false, underline = true, update_in_insert = true, severity_sort = false, }[, namespace]) ``` (or alternatively passed directly to `set()` or `show()`.) When the `namespace` argument is `nil`, settings are set globally (i.e. for *all* diagnostic namespaces). This is what user's will typically use for their local configuration. Diagnostic producers can also set configuration options for their specific namespace, although this is generally discouraged in order to respect the user's global settings. All of the values in the table passed to `vim.diagnostic.config()` are resolved in the same way that they are in `on_publish_diagnostics`; that is, the value can be a boolean, a table, or a function: ```lua vim.diagnostic.config({ virtual_text = function(namespace, bufnr) -- Only enable virtual text in buffer 3 return bufnr == 3 end, }) ``` ## Misc Notes * `vim.diagnostic` currently depends on `vim.lsp.util` for floating window previews. I think this is okay for now, although ideally we'd want to decouple these completely.
| * refactor: move vim.lsp.diagnostic to vim.diagnosticGregory Anders2021-09-15
| | | | | | | | | | | | | | | | | | | | | | This generalizes diagnostic handling outside of just the scope of LSP. LSP clients are now a specific case of a diagnostic producer, but the diagnostic subsystem is decoupled from the LSP subsystem (or will be, eventually). More discussion at [1]. [1]: https://github.com/neovim/neovim/pull/15585
* | fix(docs): ignore _*.lua files from auto doc generation #15678Gregory Anders2021-09-16
|/
* docs(gen_vimdoc.py): ignore health.lua files #15614Gregory Anders2021-09-09
|
* chore: add log hander to gen_vimdocMatthieu Coudron2021-07-10
| | | | | so it actually dumps output. Plus a description of what it does in the argparser.
* feat(lsp): Add codelens supportMathias Fussenegger2021-06-14
|
* docs: Treesitter (#13260)TJ DeVries2021-05-01
| | | | | | | | | * doc & fixes: Generate treesitter docs * fixup to treesitter-core * docs(treesitter): fix docs for most functions Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
* fix: section_name must be a dict {filename:name}Matthieu Coudron2021-03-04
| | | | else it was triggering an error during regeneration of the files.
* docs: add check_textlock attributenotomo2020-12-16
|
* lsp: vim.lsp.diagnostic (#12655)TJ DeVries2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Breaking Changes: - Deprecated all `vim.lsp.util.{*diagnostics*}()` functions. - Instead, all functions must be found in vim.lsp.diagnostic - For now, they issue a warning ONCE per neovim session. In a "little while" we will remove them completely. - `vim.lsp.callbacks` has moved to `vim.lsp.handlers`. - For a "little while" we will just redirect `vim.lsp.callbacks` to `vim.lsp.handlers`. However, we will remove this at some point, so it is recommended that you change all of your references to `callbacks` into `handlers`. - This also means that for functions like |vim.lsp.start_client()| and similar, keyword style arguments have moved from "callbacks" to "handlers". Once again, these are currently being forward, but will cease to be forwarded in a "little while". - Changed the highlight groups for LspDiagnostic highlight as they were inconsistently named. - For more information, see |lsp-highlight-diagnostics| - Changed the sign group names as well, to be consistent with |lsp-highlight-diagnostics| General Enhancements: - Rewrote much of the getting started help document for lsp. It also provides a much nicer configuration strategy, so as to not recommend globally overwriting builtin neovim mappings. LSP Enhancements: - Introduced the concept of |lsp-handlers| which will allow much better customization for users without having to copy & paste entire files / functions / etc. Diagnostic Enhancements: - "goto next diagnostic" |vim.lsp.diagnostic.goto_next()| - "goto prev diagnostic" |vim.lsp.diagnostic.goto_prev()| - For each of the gotos, auto open diagnostics is available as a configuration option - Configurable diagnostic handling: - See |vim.lsp.diagnostic.on_publish_diagnostics()| - Delay display until after insert mode - Configure signs - Configure virtual text - Configure underline - Set the location list with the buffers diagnostics. - See |vim.lsp.diagnostic.set_loclist()| - Better performance for getting counts and line diagnostics - They are now cached on save, to enhance lookups. - Particularly useful for checking in statusline, etc. - Actual testing :) - See ./test/functional/plugin/lsp/diagnostic_spec.lua - Added `guisp` for underline highlighting NOTE: "a little while" means enough time to feel like most plugins and plugin authors have had a chance to refactor their code to use the updated calls. Then we will remove them completely. There is no need to keep them, because we don't have any released version of neovim that exposes these APIs. I'm trying to be nice to people following HEAD :) Co-authored: [Twitch Chat 2020](https://twitch.tv/teej_dv)
* doc: Add docs for uri functions (#12887)TJ DeVries2020-09-14
|
* docs, remove 'guifontset' #11708Justin M. Keyes2020-08-31
| | | | | | | | | | | | | - 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 1656367b90bd. 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...).
* gen_vimdoc: Allow to keep intermediary outputPatrice Peterson2020-08-23
|
* Add docs for most vim.lsp methodsPatrice Peterson2020-08-23
| | | | Most of the lsp.log will be addressed in a separate PR.
* script: simplify python version check (#12672)jnozsc2020-07-24
|
* doc: fix scripts and regenerate (#12506)TJ DeVries2020-07-02
| | | | | | | | | | | | | | | | | * 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
* doc [ci skip] #11656Justin M. Keyes2020-01-12
|
* gen_vimdoc.py: rename `mode` to `target`Justin M. Keyes2019-12-31
|
* gen_vimdoc.py: generate LSP docsJustin M. Keyes2019-12-31
|
* gen_vimdoc.py: sort by nameJustin M. Keyes2019-12-30
|
* gen_vimdoc.py: better handling of inline (non-block) nodesJustin M. Keyes2019-12-30
|
* gen_vimdoc.py: fix deprecated checkJustin M. Keyes2019-12-30
|
* gen_vimdoc.py: lint #11593Daniel Hahler2019-12-23
|
* Merge #11396 'gen_vimdoc.py: mpack result' [ci skip]Justin M. Keyes2019-12-22
|\
| * gen_vimdoc.py: rename for clarityJustin M. Keyes2019-12-21
| | | | | | | | | | - render_para => fmt_node_as_vimhelp - Inline parse_parblock() in fmt_node_as_vimhelp()
| * gen_vimdoc.py: mpack: collect functions in 1 dictJustin M. Keyes2019-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All Nvim API, core Vimscript, and core Lua functions are globally unique, so there is no need for per-module nested dicts. BEFORE (generated mpack structure): [ { "buffer.c": { "nvim__buf_stats": { ... }, ... }, "window.c": { "nvim_win_close": { ... }, ... }, ... } ] AFTER (generated mpack structure): [ { "nvim__buf_stats": { ... }, "nvim_buf_attach": { ... }, "nvim_tabpage_set_var": { ... }, "nvim_ui_attach": { ... }, "nvim_win_close": { ... } } ]
| * gen_vimdoc.py: fix "seealso", "xrefs"Justin M. Keyes2019-12-21
| | | | | | | | | | | | - Also fix xrefs ("Deprecated" section) - Fix "Deprecated" rendering by a weird hack (see comment). - Eliminate unnecessary use of render_para()
| * gen_vimdoc.py: mpack: exclude deprecated functionsJustin M. Keyes2019-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `mpack` variable was a tuple, which manifests as an array in the generated msgpack structure. - Removes noise from the mpack data (deprecated functions are deprecated). - Eliminates 1 level of nesting. BEFORE: [ { "buffer.c": [ { "nvim__buf_stats": { ... }, ... }, { "buffer_del_line": { ... }, ... }, ], ... } ] AFTER: [ { "buffer.c": { "nvim__buf_stats": { ... }, ... }, ... ]
| * gen_vimdoc.py: fix mpack generatorJustin M. Keyes2019-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - make parameters_doc a dict intead of a list BEFORE: "parameters_doc": [ { "buffer": "Buffer handle, or 0 for current buffer" } ], AFTER: "parameters_doc": { "buffer": "Buffer handle, or 0 for current buffer" }, - make "return", "seealso", lists instead of strings
| * gen_vimdoc.py: DRYJustin M. Keyes2019-12-21
| |
| * [scripts/gen_vimdoc.py] Generate better-formatted mpacksmolck2019-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes the generated msgpack result values in the runtime/doc/*.mpack files to be formatted like this (instead of being formatted like Vim help text): [ 'nvim_win_get_var': { 'signature': 'nvim_win_get_var({window}, {name}, {err})', 'parameters': [('Window', 'window'), ('String', 'name'), ('Error *', 'err')], 'parameters_doc': [{'window': 'Window handle, or 0 for current window', 'name': 'Variable name'}], 'doc': ['Gets a window-scoped (w:) variable'], 'return': ['Variable value'], 'seealso': [] } }, ... ]
* | doc: Lua [ci skip] #11378Justin M. Keyes2019-11-17
|/ | | | - Rework :help lua-commands - Rename if_lua.txt => lua.txt
* lintJustin M. Keyes2019-10-26
|
* gen_vimdoc.py: dump API docs to msgpack #11296smolck2019-10-26
| | | | | | | | | | | | | | | | | | | | | | | Convenient for API clients who want to reuse the API docs in their own docs. Could be used e.g. to eliminate nvim.net's own doxygen parser: https://github.com/neovim/nvim.net/tree/3a736232a4e7b7a2a1eff4bded24d2bf27a918c2/src/NvimClient.APIGenerator/Docs TODO: currently the result values are formatted as Vim help docs. We should change the values to have structure, something like this: [{ 'nvim_win_get_var': [ 'line1, 'line2', [ 'item1', 'item2', ... ] ], 'nvim_win_set_var': [ ... ], ... }] close #11296
* doc: |api-fast| [ci skip]Justin M. Keyes2019-09-09
|
* py: flake8 fixesDaniel Hahler2019-07-29
|
* scripts: autopep8Daniel Hahler2019-07-29
|
* doc #10017Justin M. Keyes2019-05-25
| | | | | - gen_vimdoc.py: fancy "bullet" - rework `:help channel-callback` - rename `:help buffered` to `:help channel-buffered`
* gen_vimdoc.py: support lua/shared.lua module [ci skip]Justin M. Keyes2019-05-19
|
* gen_vimdoc.py: get Lua docs via lua2dox.lua #9740KillTheMule2019-05-18
|
* gen_vimdoc.py: support <pre> preformatted text [ci skip]Justin M. Keyes2019-05-01
|
* gen_vimdoc.py: skip "Parameters" header if all excludedJustin M. Keyes2019-04-22
|
* gen_vimdoc.py: render nested lists, etc [ci skip]Justin M. Keyes2019-03-26
- render_node() is now the main rendering function: it traverses a node and builds the Vim help text recursively. - render_para() is weird and ugly, it is the entry-point for rendering the help text for one docstring'd function.