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

lua_ls treat end as a keyword #3096

Closed
winkee01 opened this issue Feb 26, 2025 · 1 comment
Closed

lua_ls treat end as a keyword #3096

winkee01 opened this issue Feb 26, 2025 · 1 comment

Comments

@winkee01
Copy link

winkee01 commented Feb 26, 2025

Information

  • Editor: NeoVim
  • OS: MacOS
  • Issue topic: Diagnostics/Syntax Checking

Sample config

formatters = {
  prettier = {
    range_args = function(ctx)
      return { "--stdin-filepath", "$FILENAME", "--range-start", ctx.range.start, "--range-end", ctx.range.end }
    end,
  }
}

Issue description

Above config should have no syntax issue, however, lua_ls recognize end in ctx.range.end as a Lua keyword which terminates the function, and it reported an error on this "<field> expected".

even if I change it to ctx.range.["end"], it still reported "<field> expected". after I removed ctx.range.end, no errors were reported.

@winkee01
Copy link
Author

winkee01 commented Feb 26, 2025

Sorry, end is a keyword in Lua and can not be used as a variable, thus, ctx.range.end is syntactically worng.

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

No branches or pull requests

1 participant