aboutsummaryrefslogtreecommitdiff
path: root/scripts/lua2dox.lua
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).
* fix(doc): prevent doxygen confusionLewis Russell2024-02-06
|
* fix(diagnostic): typingLewis Russell2024-01-16
|
* 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.
* fix(doc): improve doc generation of types using lpegLewis Russell2024-01-11
| | | | Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
* 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.
* feat(lua): add vim.func._memoizeLewis Russell2023-09-20
| | | | | | | | | | | | | | | Memoizes a function, using a custom function to hash the arguments. Private for now until: - There are other places in the codebase that could benefit from this (e.g. LSP), but might require other changes to accommodate. - Invalidation of the cache needs to be controllable. Using weak tables is an acceptable invalidation policy, but it shouldn't be the only one. - I don't think the story around `hash_fn` is completely thought out. We may be able to have a good default hash_fn by hashing each argument, so basically a better 'concat'.
* fix(filetype): add typing and dry (#24573)Lewis Russell2023-08-08
|
* docs: remove "#" comment char in @returnJustin M. Keyes2023-08-03
| | | | | | | Everything after a "#" char is a "description" comment, i.e. luals won't treat it as a type, name, etc. But "#" should not be present in the generated docs (such as :help docs). https://github.com/LuaLS/lua-language-server/wiki/Annotations#return
* 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(lua2dox): overhaul (#24386)Lewis Russell2023-07-18
|
* fix: doc errorsLewis Russell2023-07-17
|
* docs(lua): change *lua-foo* -> *vim.foo*Lewis Russell2023-07-17
|
* docs: handle whitespace in emmycommentsLewis Russell2023-07-17
|
* feat(lua): add `vim.system()`Lewis Russell2023-06-07
| | | | | | | | | | | | | | | feat(lua): add vim.system() Problem: Handling system commands in Lua is tedious and error-prone: - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval. - vim.loop.spawn is too low level Solution: Add vim.system(). Partly inspired by Python's subprocess module Does not expose any libuv objects.
* fix(treesitter): annotationsLewis Russell2023-03-23
| | | | | | - Begin using `@package` in place of `@private` for functions that are accessed internally but outside their defined class. - Rename Node -> TSP.Node
* refactor(treesitter): add Range type aliase for Range4|Range6Lewis Russell2023-03-11
|
* 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.
* perf(treesitter): smarter languagetree invalidationLewis Russell2023-02-23
| | | | | | | | | | | | | | Problem: Treesitter injections are slow because all injected trees are invalidated on every change. Solution: Implement smarter invalidation to avoid reparsing injected regions. - In on_bytes, try and update self._regions as best we can. This PR just offsets any regions after the change. - Add valid flags for each region in self._regions. - Call on_bytes recursively for all children. - We still need to run the query every time for the top level tree. I don't know how to avoid this. However, if the new injection ranges don't change, then we re-use the old trees and avoid reparsing children. This should result in roughly a 2-3x reduction in tree parsing when the comment injections are enabled.
* fix(treesitter): fix most diagnosticsLewis Russell2023-02-04
|
* 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_.
* docs: fix typosdundargoc2022-11-02
|
* refactor(lua2dox): tidyLewis Russell2022-10-10
|
* refactor(lua2dox): format with styluaLewis Russell2022-10-10
|
* feat: added support for specifying types for lua2doxFolke Lemaitre2022-10-06
|
* feat: added support for optional params to lua2doxFolke Lemaitre2022-10-06
|
* feat: added support for @generic to lua2dox.luaFolke Lemaitre2022-10-06
|
* build(lua2dox): add parenthesis around parameter types in documentation (#18532)dundargoc2022-05-12
| | | | | | | | | | This will check if the string after the variable in a @param is either "number", "string", "table", "boolean" and "function" and if so add a parenthesis around it. This will help separate the variable type with the following text. Had all our functions been annotated with emmylua then a more robust solution might have been preferable (such as always assuming the third string is parameter type without making any checks). I believe however this is a clear improvement over the current situation and will suffice for now.
* docs: typo fixes (#17859)dundargoc2022-04-15
| | | | | | | | | | Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com> Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com> Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: rwxd <rwxd@pm.me> Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
* build(lint): check scripts/*.luaJustin M. Keyes2021-09-19
|
* 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>
* 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)
* gen_vimdoc.py: generate LSP docsJustin M. Keyes2019-12-31
|
* doc: fix typosBrian Wignall2019-11-27
| | | | close #11459
* scripts/lua2dox.lua: Remove class declaration blockHirokazu Hata2019-10-27
| | | | | | | Judging class definitions in the form "string.find (line, '=% s * class% (')" must force writing class definitions in this format, but such a mechanism is Absent. Also, Lua has no formal class in the language specification, and implements inheritance with setmetadable. To detect this, we should have a parser for it, not a simple regular expression.
* 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: get Lua docs via lua2dox.lua #9740KillTheMule2019-05-18