Skip to content

Incorrect semantic tokens for table keys #1767

@clason

Description

@clason

How are you using the lua-language-server?

NeoVim

Which OS are you using?

MacOS

What is the issue affecting?

Semantic tokens

Description of issue

Consider the following Lua snippet:

local foo = {
  bar = function() end,
}

Here, bar is marked with the semantic token

  • type: method
  • modifier: declaration

I believe both of these are incorrect: a table key is not a variable nor a declaration -- it's assigning an anonymous variable to a property; so it should be

  • type: property (same as, e.g., baz = 'quux')
  • no modifier (also for other table keys)

(Having the bar in foo.bar() be a method is fine, of course.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions