Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: better emmylua grammar support #37

Merged
merged 1 commit into from
Sep 11, 2022
Merged

chore!: better emmylua grammar support #37

merged 1 commit into from
Sep 11, 2022

Conversation

numToStr
Copy link
Owner

@numToStr numToStr commented Sep 7, 2022

Resolve #34

Changes

These changes make lemmy-help compliant to https://github.com/sumneko/lua-language-server/wiki/Annotations

  1. Removed [desc] from ---@type Reverted in fix: bring back [desc] support in ---@type #43
Details
  • Prev
---@type <type> [desc]
  • Now
---@type <type>

Alternative would be to write description above ---@type

2. Removed [desc] from ---@class

  • Prev
---@class <name> [desc]
  • Now
---@class <name>

See 3. for alternative

3. Treat comments above ---@class as description

  • Emmylua
---This can be used as description for the class
---You can also have multiple lines
---@class HelloWorld
---@field msg string A message to the world
  • Help
HelloWorld                                                          *HelloWorld*
    This can be used as description for the class
    You can also have multiple lines

    Fields: ~
        {msg}  (string)  A message to the world

4. Remove [desc] from ---@alias

  • Prev
---@alias <name> <type> [desc]
  • Now
---@alias <name> <type>

See 5. for alternative

5. Treat comments above ---@alias as description

  • Emmylua
---This can be used as description for the alias
---You can also have multiple lines
---@alias HelloWorld string
  • Help
HelloWorld                                                          *HelloWorld*
    This can be used as description for the alias
    You can also have multiple lines

    Type: ~
        string

6. Strict parsing of enum (---@alias) variants. Previously variants were loosely parsed and doesn't followed the LLS spec but now this has changed.

  • Value should be defined inside single quotes i.e., '<value>'.

  • Description should start with #<space>

  • Syntax

---@alias <name>
---| '<value>' [# desc]
  • Emmylua
---Vim operator-mode motions.
---Read `:h map-operator`
---@alias VMode
---| '"line"' # Vertical motion
---| '"char"' # Horizontal motion
---| 'v'
---| 'V' # Visual Line Mode
  • Help
VMode                                                                    *VMode*
    Vim operator-mode motions.
    Read `:h map-operator`

    Variants: ~
        ("line")  Vertical motion
        ("char")  Horizontal motion
        (v)
        (V)       Visual Line Mode

@numToStr numToStr marked this pull request as draft September 7, 2022 08:49
@numToStr numToStr marked this pull request as ready for review September 11, 2022 14:11
@numToStr numToStr merged commit c430652 into master Sep 11, 2022
@numToStr numToStr deleted the grammar branch September 11, 2022 14:17
numToStr added a commit that referenced this pull request Sep 27, 2022
This PR brings back `[desc]` support in `---@type` which was removed in
#37
rmagatti added a commit to rmagatti/auto-session that referenced this pull request Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

breaking!: grammar improvements and other changes
1 participant