<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/scripts/lua2dox.lua, branch rahm</title>
<subtitle>Neovim fork with Rahm's personal hacks.</subtitle>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/'/>
<entry>
<title>feat(docs): replace lua2dox.lua</title>
<updated>2024-02-27T14:41:17+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2024-02-15T17:16:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=9beb40a4db5613601fc1a4b828a44e5977eca046'/>
<id>9beb40a4db5613601fc1a4b828a44e5977eca046</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(doc): prevent doxygen confusion</title>
<updated>2024-02-06T15:29:01+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2024-02-06T15:08:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c4417ae70c03815c2fb64edb479017e79d223cf7'/>
<id>c4417ae70c03815c2fb64edb479017e79d223cf7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(diagnostic): typing</title>
<updated>2024-01-16T09:33:10+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2024-01-09T12:47:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=50284d07b6f020c819aeb07bfb30d88453e63b6d'/>
<id>50284d07b6f020c819aeb07bfb30d88453e63b6d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua2dox): filter out the entire `---@alias` block</title>
<updated>2024-01-14T14:04:08+00:00</updated>
<author>
<name>Jongwook Choi</name>
<email>wookayin@gmail.com</email>
</author>
<published>2024-01-13T23:36:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=a7df0415ab6ae9a89ca12c6765758bfd54fa69c9'/>
<id>a7df0415ab6ae9a89ca12c6765758bfd54fa69c9</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(doc): improve doc generation of types using lpeg</title>
<updated>2024-01-11T16:24:12+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2024-01-09T17:36:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=2f9ee9b6cfc61a0504fc0bc22bdf481828e2ea91'/>
<id>2f9ee9b6cfc61a0504fc0bc22bdf481828e2ea91</id>
<content type='text'>
Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
</pre>
</div>
</content>
</entry>
<entry>
<title>build: enable lintlua for scripts/ dir #26391</title>
<updated>2023-12-04T20:38:31+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-12-04T20:38:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=517f0cc634b985057da5b95cf4ad659ee456a77e'/>
<id>517f0cc634b985057da5b95cf4ad659ee456a77e</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lua): add vim.func._memoize</title>
<updated>2023-09-20T12:42:41+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2023-09-16T22:10:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=877d04d0fb83b5fc602dbab22b58f26a793ec236'/>
<id>877d04d0fb83b5fc602dbab22b58f26a793ec236</id>
<content type='text'>
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'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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'.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(filetype): add typing and dry (#24573)</title>
<updated>2023-08-08T15:36:06+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2023-08-08T15:36:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c6c21db82b31ea43ce878ab3725dcd901db1e7a1'/>
<id>c6c21db82b31ea43ce878ab3725dcd901db1e7a1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>docs: remove "#" comment char in @return</title>
<updated>2023-08-03T12:01:53+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-08-03T11:41:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=b1fb04475e6fa0c44895cb6fe97b75816d74c297'/>
<id>b1fb04475e6fa0c44895cb6fe97b75816d74c297</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>docs(lua): more improvements (#24387)</title>
<updated>2023-07-18T14:42:30+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2023-07-18T14:42:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=be74807eef13ff8c90d55cf8b22b01d6d33b1641'/>
<id>be74807eef13ff8c90d55cf8b22b01d6d33b1641</id>
<content type='text'>
* 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 &lt;justinkz@gmail.com&gt;

---------

Co-authored-by: Justin M. Keyes &lt;justinkz@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 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 &lt;justinkz@gmail.com&gt;

---------

Co-authored-by: Justin M. Keyes &lt;justinkz@gmail.com&gt;</pre>
</div>
</content>
</entry>
</feed>
