aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_vimdoc.py
Commit message (Collapse)AuthorAge
* feat(docs): replace lua2dox.luaLewis Russell2024-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* refactor(api): use keydict and arena for more api return valuesbfredl2024-02-08
| | | | | | | Implement api_keydict_to_dict as the complement to api_dict_to_keydict Fix a conversion error when nvim_get_win_config gets called from lua, where Float values "x" and "y" didn't get converted to lua numbers.
* docs: auto-generate docs for `vim.lpeg` and `vim.re`Jongwook Choi2024-01-14
| | | | | | | | | | | | | | | | | - Add section `VIM.LPEG` and `VIM.RE` to docs/lua.txt. - Add `_meta/re.lua` which adds luadoc and type annotations, for the vendored `vim.re` package. - Fix minor style issues on `_meta/lpeg.lua` luadoc for better vimdocs generation. - Fix a bug on `gen_vimdoc` where non-helptags in verbatim code blocks were parsed as helptags, affecting code examples on `vim.lpeg.Cf`, etc. - Also move the `vim.regex` section below so that it can be located closer to `vim.lpeg` and `vim.re`.
* fix(doc): improve doc generation of types using lpegLewis Russell2024-01-11
| | | | Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
* fix(docs): make lines not overflow in vim docsJongwook Choi2024-01-09
| | | | | | | | | Problem: Some lines in the generated vim doc are overflowing, not correctly wrapped at 78 characters. This happens when docs body contains several consecutive 'inline' elements generated by doxygen. Solution: Take into account the current column offset of the last line, and prepend some padding before doc_wrap().
* fix(gen_vimdoc): INCLUDE_DEPRECATED not generating docs for deprecatedsJongwook Choi2024-01-02
| | | | | | Since some point INCLUDE_DEPRECATED stopped working as it is usually turned off when generating an actual vimdoc. This commit fixes this hidden feature back again (used for devel purposes only).
* refactor(gen_vimdoc): refactor section and defgroup doc generationJongwook Choi2024-01-02
| | | | | | | | | | Problem: main() has too much logic implemented there, too difficult to read. Solution: Do more OOP, introduce `Section` dataclass that stores information about a "section", with documentation and concrete examples about what each field and variable would mean. Extract all the lines for rendering a section into `section.render()` pulled out of `main()`.
* refactor(gen_vimdoc): generate function doc from metadata, not from xmlJongwook Choi2024-01-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: For function definitions to be included in the vimdoc (formatted) and to be exported as mpack data (unformatted), we had two internal representations of the same function/API metadata in duplicate; one is FunctionDoc (which was previously a dict), and the other is doxygen XML DOM from which vimdoc (functions sections) was generated. Solution: We should have a single path and unified data representation (i.e. FunctionDoc) that contains all the metadata and information about function APIs, from which both of mpack export and vimdoc are generated. I.e., vimdocs are no longer generated directly from doxygen XML nodes, but generated via: (XML DOM Nodes) ------------> FunctionDoc ------> mpack (unformatted) Recursive Internal | Formatting Metadata +---> vimdoc (formatted) This refactoring eliminates the hacky and ugly use of `fmt_vimhelp` in `fmt_node_as_vimhelp()` and all other helper functions! This way, `fmt_node_as_vimhelp()` can simplified as it no longer needs to handle generating of function docs, which needs to be done only in the topmost level of recursion.
* refactor(gen_vimdoc): use typing for function API vimdoc generationJongwook Choi2024-01-02
|
* refactor(gen_vimdoc): use stronger typing for CONFIG, avoid dictJongwook Choi2024-01-02
|
* docs(glob): add glob module (#26853)Mathias Fußenegger2024-01-02
|
* docs: support @since for api level #25574LW2023-11-27
| | | close #25416
* feat: add vim.text module (#26069)Gregory Anders2023-11-16
|
* docs: fix vim.snippet help tags (#26068)Gregory Anders2023-11-16
|
* feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512LW2023-11-12
| | | | | | | | | | | | | | | | | | refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()` Problem: The LSP specification allows inlay hints to include tooltips, clickable label parts, and code actions; but Neovim provides no API to query for these. Solution: Add minimal viable extension point from which plugins can query for inlay hints in a range, in order to build functionality on top of. Possible Next Steps --- - Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for usage in mappings of `<LeftMouse>`, `<C-LeftMouse>`, etc
* feat(stdlib): add vim.base64 module (#25843)Gregory Anders2023-10-31
| | | Add base64 encode() and decode() functions to a vim.base64 module.
* feat(lsp): add snippet API (#25301)Maria José Solano2023-10-21
|
* docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|
* feat(vimdoc): support Markdown code blocks (#25127)Gregory Anders2023-09-13
| | | | | | Support Markdown code blocks in addition to <pre> blocks in Doxygen doc comments. Update doc comments in iter.lua as a test.
* docs(generators): bake into cmakeLewis Russell2023-08-23
|
* feat(lua-types): types for vim.api.* (#24523)Lewis Russell2023-08-01
|
* 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>
* 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>
* refactor(gen_vimdoc): put defgroup handling in a functionLewis 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
|
* docs(lua): do not render self argsLewis Russell2023-07-17
|
* docs: gather @notes items into one sectionJustin M. Keyes2023-07-08
| | | | related: 21eacbfef399
* docs: "Return (multiple)" headingJustin M. Keyes2023-07-08
| | | | | | | | | | | Problem: Lua functions that return multiple results are declared by using multiple `@return` docstring directives. But the generated docs don't make it obvious what this represents. Solution: - Generate a "Return (multiple)" heading for multiple-value functions. - Fix `@note` directives randomly placed after `@return`.
* fix(api): use text_locked() to check textlockSean Dewar2023-07-05
| | | | | | | | | | | | | | | Problem: some API functions that check textlock (usually those that can change curwin or curbuf) can break the cmdwin. Solution: make FUNC_API_CHECK_TEXTLOCK call text_locked() instead, which already checks for textlock, cmdwin and `<expr>` status. Add FUNC_API_TEXTLOCK_ALLOW_CMDWIN to allow such functions to be usable in the cmdwin if they can work properly there; the opt-in nature of this attribute should hopefully help mitigate future bugs. Also fix a regression in #22634 that made functions checking textlock usable in `<expr>` mappings, and rename FUNC_API_CHECK_TEXTLOCK to FUNC_API_TEXTLOCK.
* docs: autocmds, miscJustin M. Keyes2023-06-25
|
* feat(lsp): inlay hints #23984Chinmay Dalal2023-06-19
| | | | | | | | | | | Add automatic refresh and a public interface on top of #23736 * add on_reload, on_detach handlers in `enable()` buf_attach, and LspDetach autocommand in case of manual detach * unify `__buffers` and `hint_cache_by_buf` * use callback bufnr in `on_lines` callback, bufstate: remove __index override * move user-facing functions into vim.lsp.buf, unify enable/disable/toggle Closes #18086
* feat(lsp): add handlers for inlay hints (#23736)Chinmay Dalal2023-06-11
| | | initial support; public API left for a follow-up PR
* refactor!: rename "playground" => "dev" #23919Justin M. Keyes2023-06-06
| | | | | | | | | | | | Problem: "playground" is new jargon that overlaps with existing concepts: "dev" (`:help dev`) and "view" (also "scratch" `:help scratch-buffer`) . Solution: We should consistently use "dev" as the namespace for where "developer tools" live. For purposes of a "throwaway sandbox object", we can use the name "view". - Rename `TSPlayground` => `TSView` - Rename `playground.lua` => `dev.lua`
* docs(lsp): remove vim.lsp.sync (#23416)Mathias Fußenegger2023-05-01
| | | | The module is used internally and not intended to be used by plugins or users.
* refactor(iter): move helper functions under vim.iterGregory Anders2023-04-25
| | | | vim.iter is now both a function and a module (similar to vim.version).
* feat(lua): add vim.iter (#23029)Gregory Anders2023-04-17
| | | | | vim.iter wraps a table or iterator function into an `Iter` object with methods such as `filter`, `map`, and `fold` which can be chained to produce iterator pipelines that do not create new tables at each step.
* feat(lua): add `vim.loader`Folke Lemaitre2023-03-26
| | | feat: new faster lua loader using byte-compilation
* feat(treesitter)!: deprecate top level indexes to modules (#22761)Lewis Russell2023-03-24
| | | | | | | | | | | | | | | | | The following top level Treesitter functions have been moved: - vim.treesitter.inspect_language() -> vim.treesitter.language.inspect() - vim.treesitter.get_query_files() -> vim.treesitter.query.get_files() - vim.treesitter.set_query() -> vim.treesitter.query.set() - vim.treesitter.query.set_query() -> vim.treesitter.query.set() - vim.treesitter.get_query() -> vim.treesitter.query.get() - vim.treesitter.query.get_query() -> vim.treesitter.query.get() - vim.treesitter.parse_query() -> vim.treesitter.query.parse() - vim.treesitter.query.parse_query() -> vim.treesitter.query.parse() - vim.treesitter.add_predicate() -> vim.treesitter.query.add_predicate() - vim.treesitter.add_directive() -> vim.treesitter.query.add_directive() - vim.treesitter.list_predicates() -> vim.treesitter.query.list_predicates() - vim.treesitter.list_directives() -> vim.treesitter.query.list_directives() - vim.treesitter.query.get_range() -> vim.treesitter.get_range() - vim.treesitter.query.get_node_text() -> vim.treesitter.get_node_text()
* docs(html): render @see items as a list #22675Justin M. Keyes2023-03-15
| | | | | | | | | | | Needed for "flow" HTML layout. Flow layout before: See also: https://github.com/kikito/inspect.lua https://github.com/mpeterv/vinspect Flow layout after: See also: - https://github.com/kikito/inspect.lua - https://github.com/mpeterv/vinspect
* refactor(vim.version): cleanupJustin M. Keyes2023-03-06
| | | | | | | - version.cmp(): assert valid version - add test for loading vim.version (the other tests use shared.lua in the test runner) - reduce test scopes, reword test descriptions
* feat(lua): add semver apiKelly Lin2023-03-06
|
* docs: module-level docstrings (@defgroup) #22498Justin M. Keyes2023-03-05
| | | | | | | | | | | | Problem: gen_vimdoc.py / lua2dox.lua does not support @defgroup or \defgroup except for "api-foo" modules. Solution: Modify `gen_vimdoc.py` to look for section names based on `helptag_fmt`. TODO: - Support @module ? https://github.com/LuaLS/lua-language-server/wiki/Annotations#module
* docs: lua2dox.lua debuggingJustin M. Keyes2023-03-03
|
* docs: fix vim.treesitter tagsJustin M. Keyes2023-03-03
| | | | | | | | | Problem: Help tags like vim.treesitter.language.add() are confusing because `vim.treesitter.language` is (thankfully) not a user-facing module. Solution: Ignore the "fstem" when generating "treesitter" tags.
* ci(fix): repair regen-api-docs (#22403)Mathias Fußenegger2023-02-25
| | | | | | | https://github.com/neovim/neovim/pull/22398 broke the job because there is no `build/bin/nvim` This keeps the preference for `build/bin/nvim` but adds back `nvim` as fallback if it doesn't exist.
* docs: use build/bin/nvim instead of nvim in gen_vimdoc (#22398)Mathias Fußenegger2023-02-25
| | | | | | | | | | Problem: `nvim` could point to stable release missing the `nvim -l` functionality. Solution: Require to build nvim first and use `build/bin/nvim`
* feat(lua)!: execute Lua with "nvim -l"Justin M. Keyes2023-01-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Nvim has Lua but the "nvim" CLI can't easily be used to execute Lua scripts, especially scripts that take arguments or produce output. Solution: - support "nvim -l [args...]" for running scripts. closes #15749 - exit without +q - remove lua2dox_filter - remove Doxyfile. This wasn't used anyway, because the doxygen config is inlined in gen_vimdoc.py (`Doxyfile` variable). - use "nvim -l" in docs-gen CI job Examples: $ nvim -l scripts/lua2dox.lua --help Lua2DoX (0.2 20130128) ... $ echo "print(vim.inspect(_G.arg))" | nvim -l - --arg1 --arg2 $ echo 'print(vim.inspect(vim.api.nvim_buf_get_text(1,0,0,-1,-1,{})))' | nvim +"put ='text'" -l - TODO? -e executes Lua code -l loads a module -i enters REPL _after running the other arguments_.
* feat: `vim.inspect_pos`, `vim.show_pos`, `:Inspect`Folke Lemaitre2022-12-17
|
* 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