aboutsummaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAge
...
* fix(treesitter): return correct match table in iter_captures()Lewis Russell2024-03-27
|
* feat(tui): support undercurl in WezTerm (#28037)zeertzjq2024-03-26
| | | | | Also fix some typos in windows.ti while at it. Close #21699
* refactor(lua): type annotationsLewis Russell2024-03-16
|
* docs(editorconfig): move to sourceLewis Russell2024-03-10
|
* docs: support inline markdownLewis Russell2024-03-09
| | | | | | - Tags are now created with `[tag]()` - References are now created with `[tag]` - Code spans are no longer wrapped
* 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(types): rename win_get_config return type to win_configWill Hopkins2024-03-02
| | | Follow-up to #27397
* feat!: rewrite TOhtml in luaaltermo2024-02-28
| | | | | | Co-authored-by: wookayin <wookayin@gmail.com> Co-authored-by: clason <c.clason@uni-graz.at> Co-authored-by: Lewis Russell <me@lewisr.dev>
* refactor(metadata): generate all metadata in luabfredl2024-02-28
| | | | | | | | Then we can just load metadata in C as a single msgpack blob. Which also can be used directly as binarly data, instead of first unpacking all the functions and ui_events metadata to immediately pack it again, which was a bit of a silly walk (and one extra usecase of `msgpack_rpc_from_object` which will get yak shaved in the next PR)
* vim-patch:e84d2d4432cdChristian Clason2024-02-28
| | | | | | | | | | | | runtime(sh): Update ftplugin, fix vim/vim#14101 (vim/vim#14102) Add the 'b' flag to 'comments', so that the shebang line is not detected as comment. Fixes vim/vim#14101. https://github.com/vim/vim/commit/e84d2d4432cd6e43f2bb300d02abc90d551bcf4a Co-authored-by: dkearns <dougkearns@gmail.com>
* 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).
* docs(builtin): show tag at first line with multiple signatures (#27577)zeertzjq2024-02-22
| | | | | | | | Problem: When a function has multiple signatures, putting its tag at the last one may make one think that's its only signature. Solution: When a function has multiple signatures, put its tag at the first one.
* fix(lsp): add parentheses to generated union array types (#27560)Maria José Solano2024-02-21
|
* build(vim-patch.sh): don't add vim/vim to issue of another repo (#27493)zeertzjq2024-02-16
|
* 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.
* fix(doc): prevent doxygen confusionLewis Russell2024-02-06
|
* build: various fixesdundargoc2024-02-01
| | | | | | | - Consistently use the variable CMAKE_BUILD_TYPE to select build type. - Remove broken `doc_html` target. - Remove swap files created by oldtest when cleaning. - Only rerun `lintdoc` if any documentation files has changed.
* build: update builtin terminfo (#27272)zeertzjq2024-01-31
| | | | | - Update to ncurses 6.4.20230520 - Disable smglp and smgrp for vtpcon and conemu - Add xterm+sl to vtpcon, fix #26880
* fix(gen_help_html): type warnings, spell_ignore_files #27254Jongwook Choi2024-01-29
| | | | | - Add type annotations, fix most of the type warnings. - Fix a minor bug on `spell_ignore_files`: nil error when an invalid spelling is found but the file is not ignored.
* docs: enforce "treesitter" spelling #27110Jongwook Choi2024-01-28
| | | It's the "tree-sitter" project, but "treesitter" in our code and docs.
* build(docs): separate lint job to validate vimdoc #27227Jongwook Choi2024-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Separate the lint job (`make lintdoc`) to validate runtime/doc, it is no longer as a part of functionaltest (help_spec). Build (cmake) and CI: - `make lintdoc`: validate vimdoc files and test-generate HTML docs. CI will run this as a part of the "docs" workflow. - `scripts/lintdoc.lua` is added as an entry point (executable script) for validating vimdoc files. scripts/gen_help_html.lua: - Move the tests for validating docs and generating HTMLs from `help_spec.lua` to `gen_help_html`. Added: - `gen_help_html.run_validate()`. - `gen_help_html.test_gen()`. - Do not hard-code `help_dir` to `build/runtime/doc`, but resolve from `$VIMRUNTIME`. Therefore, the `make lintdoc` job will check doc files on `./runtime/doc`, not on `./build/runtime/doc`. - Add type annotations for gen_help_html.
* feat: improve return type annotations for vim.api.*Lewis Russell2024-01-26
|
* build: make genappimage.sh work with existing CMAKE_INSTALL_PREFIXdundargoc2024-01-22
| | | | | | Using CMAKE_INSTALL_PREFIX is unreliable as it's a cache variable, meaning the users previous value will be used if not supplied. Instead, use the `--prefix` flag which is guaranteed to always work.
* Merge pull request #27076 from glepnir/extmark_hlgroupbfredl2024-01-22
|\ | | | | refactor(api): use hl id directly in nvim_buf_set_extmark
| * refactor(api): give "hl_group" more accurate _meta typebfredl2024-01-22
| | | | | | | | | | These can either be number or string in lua, so we can specify this directly as "number|string".
* | fix(lsp): clean up duplicate and unused meta type annotationsJongwook Choi2024-01-20
|/
* fix(lua): return after assert returns assert message (#27064)altermo2024-01-17
|
* fix(diagnostic): typingLewis Russell2024-01-16
|
* docs(builtin): overload functions with union return typesaltermo2024-01-14
|
* fix(lua2dox): filter out the entire `---@alias` blockJongwook Choi2024-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Any preceding luadocs block that define alias types with `@alias` magic would be prepended to the documentation of functions that follow, despite the "blank line" separator. For example: ``` --- @alias some.type.between.functions --- Blah blah long documentation for alias --- | "foo" # foo --- | "bar" # bar --- The documentation that should appear in vimdoc. function M.function_to_include_in_doc() ... end ``` then the vimdoc generated for `function_to_include_in_doc` would include the text from the alias block (e.g., "Blah blah ... for alias"). Solution: - refactor: Lua2DoxFilter should maintain its own internal state `generics`, rather than carrying it as a parameter to local helper functions. - Add another boolean state `boolean_state` which represents whether to ignore the current docstring block (magic lines). This flag will be reset as soon as the block is end. Note: As expected, there is no change at all in the current docs generated, because we have been working around and writing luadoc comments so that such erroneous docstring resulting from preceding `@alias` blocks won't appear.
* 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: convert BACKERS.md to backers.txtdundargoc2023-12-28
| | | | | | There is no reason for this file to be in project root, which is crowded as is. This also fits nicely part of the ongoing work towards gathering as much of the documentation as possible into one place.
* fix(gen_lsp.lua): improve type name, and fix wrong type inheritanceJongwook Choi2023-12-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Style improvements: 1. Anonymous classes derived from `StructureLiteralType` should have a better name. The class name can be also nested. Examples: ```diff ----@field serverInfo? anonym1 +---@field serverInfo? lsp._anonym1.serverInfo ``` ```diff ----@field insertTextModeSupport? anonym26 +---@field insertTextModeSupport? lsp._anonym26.completionItem.insertTextModeSupport ``` 2. Add one separate empty line before each `@field` definition. Without these, empty lines the doc can look confusing because descriptions also may contain empty lines. See `lsp.CompletionItem` for example: ```lua ---The kind of this completion item. Based of the kind ---an icon is chosen by the editor. ---@field kind? lsp.CompletionItemKind ---Tags for this completion item. --- ---@since 3.15.0 ---@field tags? lsp.CompletionItemTag[] ``` It might feel like "Tags for this completion item" belongs to `kind`, not `tags` due to the lack of separator blank lines. The following (after this commit) should look much better: ```diff ---The kind of this completion item. Based of the kind ---an icon is chosen by the editor. ---@field kind? lsp.CompletionItemKind +--- ---Tags for this completion item. --- ---@since 3.15.0 ---@field tags? lsp.CompletionItemTag[] ``` 3. Escape some LSP-specific annotations that can't be recognized by lua-ls. It'd be better to make them visible in LSP hover doc windows. Example: `@sample ...`. Fixes: 1. A type may extend from more than one base types (as well as mixin types). Previously only the first base class was being considered, resulting incomplete base classes for `@class` definitions. Example: `InlayHintOptions` (should have both of `resolveProvider` and `workDoneProgress`, the latter is from `WorkDoneProgressOptions`) ```diff ----@class lsp.InlayHintOptions +---@class lsp.InlayHintOptions: lsp.WorkDoneProgressOptions ``` 2. Remove `<200b>` (zero-width space) unicode characters. 3. Add the missing newline at EOF.
* refactor(gen_lsp.lua): add typing for the LSP protocol JSON data modelJongwook Choi2023-12-27
| | | | | | | | | | | | | Enhance readability and intellisense by incorporating type annotations. Types are not very strict and may not encompass th entire LSP Protocol metamodel; the scope is up to what's relevant for generating type annotations for LSP (`_meta/protocol.lua`). Based on the model schema: https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/lsp/3.18/metaModel/metaModel.schema.json No behavioral changes (and hence no diff on _meta/protocol.lua) should exist in this commit.
* feat: generate types and docs for v variablesLewis Russell2023-12-21
|
* refactor(options): remove option type macrosFamiu Haque2023-12-14
| | | | | | | | Problem: We have `P_(BOOL|NUM|STRING)` macros to represent an option's type, which is redundant because `OptValType` can already do that. The current implementation of option type flags is also too limited to allow adding multitype options in the future. Solution: Remove `P_(BOOL|NUM|STRING)` and replace it with a new `type_flags` attribute in `vimoption_T`. Also do some groundwork for adding multitype options in the future. Side-effects: Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error.
* docs: move vim-patch wiki page to runtime documentationdundargoc2023-12-13
|
* docs: add wiki FAQ to the runtime documentation (#26539)dundargoc2023-12-13
| | | | | | Problem: Wiki contents are not discoverable and hard to maintain. Solution: Move FAQ to runtime docs. Co-authored-by: Christian Clason <c.clason@uni-graz.at>
* feat(gen_lsp.lua): validate CLI args #26514Jongwook Choi2023-12-11
| | | | | | | | - Improve CLI argument parsing, rejects invalid argument and commands as early as possible. Also prints USAGE in the command line. - No longer allows `--<outfile>`, use `--out <outfile>` instead. - Print a little bit of verbose messages to better know what's going on rather than remaining silent at all times. - Add type annotation `gen_lsp._opt` to avoid type warnings.
* build: enable lintlua for scripts/ dir #26391Justin M. Keyes2023-12-04
| | | | | | | | | | | Problem: We don't enable stylua for many Lua scripts. Automating code-style is an important tool for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `scripts/` directory. - Specify `call_parentheses = "Input"`, we should allow kwargs-style function invocations.
* ci(lintcommit): fix empty and period check with multiple colons (#26312)zeertzjq2023-11-30
|