Skip to content

Add support for lua-language-server annotations (comments prefixed with 3 hyphens) #35

@Josef-Friedrich

Description

@Josef-Friedrich

The lua-language-server only analyses docstrings and annotations if the comment lines begin with three hyphens.

If I rewrap this example:

---
---Set a limit for the size of the backtrack stack used by LPeg to
---track calls and choices.
---
---The default limit is `400`.
---Most well-written patterns need little backtrack levels and
---therefore you seldom need to change this limit;
---before changing it you should try to rewrite your
---pattern to avoid the need for extra space.
---Nevertheless, a few useful patterns may overflow.
---Also, with recursive grammars,
---subjects with deep recursion may also need larger limits.
---
---@param max integer
---
---😱 [Types](https://github.com/LuaCATS/lpeg/blob/main/library/lpeg.lua) incomplete or incorrect? 🙏 [Please contribute!](https://github.com/LuaCATS/lpeg/pulls)

I get:

--- -Set a limit for the size of the backtrack stack used by LPeg to -track
--calls and choices.
---
---The default limit is `400`. -Most well-written patterns need little backtrack
--levels and -therefore you seldom need to change this limit; -before changing
--it you should try to rewrite your -pattern to avoid the need for extra space.
---Nevertheless, a few useful patterns may overflow. -Also, with recursive
--grammars, -subjects with deep recursion may also need larger limits.
---
---@param max integer
---
---😱 [Types](https://github.com/LuaCATS/lpeg/blob/main/library/lpeg.lua)
--incomplete or incorrect? 🙏 [Please
--contribute!](https://github.com/LuaCATS/lpeg/pulls)

This is what the desired result should look like:

---
---Set a limit for the size of the backtrack stack used by LPeg to track calls
---and choices.
---
---The default limit is `400`. Most well-written patterns need little backtrack
---levels and therefore you seldom need to change this limit; before changing it
---you should try to rewrite your pattern to avoid the need for extra space.
---Nevertheless, a few useful patterns may overflow. Also, with recursive
---grammars, subjects with deep recursion may also need larger limits.
---
---@param max integer
---
---😱 [Types](https://github.com/LuaCATS/lpeg/blob/main/library/lpeg.lua) incomplete or incorrect? 🙏 [Please contribute!](https://github.com/LuaCATS/lpeg/pulls)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions