Skip to content

A space between method name and arguments causes incorrect tokenization and syntax highlighting #1002

@OwlVision

Description

@OwlVision

Godot version

v4.6.1.stable.official [1419694e]

VS Code version

1.114.0

Godot Tools VS Code extension version

2.6.1

System information

Windows 10

Issue description

When a "space" is typed between a method name and its arguments, the tokenizer recognizes the name as a "variable" rather than a "function", which causes incorrect syntax highlighting.

Here's a tokens inspection:

  1. Without a "space", the method name is correctly marked as a "function"
Image
  1. With a "space", the method name is marked as a "variable"
Image

Despite correct highlighting even for plain function calls (i.e., outside of an object), the tokenizer shows a somewhat strange difference in the information:

  1. Without a "space", the call is properly identified as a "function call"
Image
  1. With a space, the call is identified as a "function" without "meta.function-call". Parentheses are processed separately
Image

It seems like there is an omission in the tokenization rules, which miss the semantics. Also, the Godot script editor itself highlights functions and methods correctly even when a space is present

Steps to reproduce

  1. Take any object that has methods
  2. Write an expression that calls a method
  3. Place a space between the arguments and the method name

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions