godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.53k stars 151 forks source link

Explicit function return type breaks syntax highlighting #467

Closed Spartan322 closed 1 year ago

Spartan322 commented 1 year ago

Godot version

4.0.2

VS Code version

Version: 1.77.3 Release: 23102 Commit: 650fc437e02159df39d99355a91b2e3b1f1220c5 Date: 2023-04-12T18:19:15.613Z Electron: 19.1.9 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 6.2.11-zen1-1-zen Sandboxed: No

Godot Tools VS Code extension version

1.3.1 and 41f40ee

System information

Linux x64 6.2.11-zen1-1-zen

Issue description

Functions with explicit return types in their signature seem to break the highlighting of the function block including the next function's signature: defect_highlighting

Steps to reproduce

  1. Open a new file in vscode
  2. Set its language to GDScript
  3. Paste in:
    
    # This highlights perfectly fine
    func _notification(what : int):
    match what:
        1:
            pass

The function signature highlights fine, but every line after it does not have proper highlighting

func _broken_function(example_arg : int) -> int: match example_arg: 1: pass

Everything up to the function signature is broken and then it fixes itself

func _broken_func_signature(example_arg : int): match example_arg: 1: pass


4. Observe broken highlighting
atirut-w commented 1 year ago

Can you replace the code blocks with screenshots? GH doesn't use the exact same syntax highlighting as the one this extension provides.

Spartan322 commented 1 year ago

Addressed, that's how the highlighting appears for GDScript in VSCode for me.

digiorgisoftware commented 1 year ago

I also had this exact same issue. And is not related to this extension, if you are using the other extension jjkim.gdscript it will conflict with this extension godot-vscode-plugin producing that exact same issue you described.

Tuckertcs commented 1 year ago

I also had this exact same issue. And is not related to this extension, if you are using the other extension jjkim.gdscript it will conflict with this extension godot-vscode-plugin producing that exact same issue you described.

Can confirm this is the issue and solution. Well done.

atirut-w commented 1 year ago

@Spartan322 if the solution above fixes your issue, you might want to close this.

Spartan322 commented 1 year ago

Yeah that solves it.