godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.92k stars 21.15k forks source link

Syntax Highlighting for custom type hints fails after linebreaks in parameter list #88552

Open 0x0ACB opened 8 months ago

0x0ACB commented 8 months ago

Tested versions

4.2.1

System information

Windows 10, Godot 4.2.1, Gles3 compatibility

Issue description

When adding typehints to function declarations the highlighting stops working if linebreaks are added:

grafik grafik

Steps to reproduce

Write a function with type hints for some custom types. Add linebreaks in the parameter list

Minimal reproduction project (MRP)

-

Mickeon commented 8 months ago

This has been not been fixed in master (currently 4.3). image

Custom type hints, it's worth noting. It seems like https://github.com/godotengine/godot/pull/86176 does not handle this edge-case (CC @dalexeev).

dalexeev commented 8 months ago

This is difficult to fix without a major refactoring of the highlighter. For each new line, the context is lost (with the exception of code regions).

0x0ACB commented 8 months ago

Wouldn't it make sense to keep the context for the current statement atleast? I.e. if inside brackets you dont discard on linebreak.