Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[TCL] Comments directly after opening curly brace are not correctly rendered

Open mholzmayr opened this issue 5 years ago • 1 comments

  • Sublime Version: 3.2.2
  • OS Version: Windows 10 (latest udpates)
proc test { arg1 } {# this comment-colour is odd
	set a 1
}

image

mholzmayr avatar Nov 13 '19 10:11 mholzmayr

I fill bug firstly to forum.sublimetext.com, but duplicate there.

Steps:

  1. Color theme - "jEdit" (jEdit Color Theme).
  2. File "test.tcl".
  3. Syntax: "Tcl".
  4. Code example:
32: proc ::_buttontoggleHandler { cbox args } {
33:   # Foreground of this comment is green.
34:   if {$args eq "invoke"} {  # Foreground of this comment is black.
35:     $cbox invert;           # Foreground of this comment is black too
36:   };
37:   $cbox {*}$args;
38: };
  1. Check, that Sublime highlight the comments does not as expected.

Behaviour of the Sublime-Text:

Correct behaviour must be:

  1. Lines after the first symbol "#", which is not backslashed (backslashed symbols "#" - is not an indicator of start of comment), to the end of the line - must be highlighted as a comment (foreground=green, like in line 33). Syntax checker of the Tcl interpreter can detect, which words with "#" symbol is a part of argument, or is a comment, but in simple case (as in most editors, which I used, and which has the Tcl syntax highlight function), the line from the first un-backslashed symbol "#" - highlighted as comment. Line 34 shows, that syntax highlight function is bugged.
  2. Lines after the un-backslashed symbol ";" - is a new Tcl command. And all Tcl commands, which first printable symbol is a un-backslashed "#" - is a comment. So, comment at the end of line 35 must be highlighted as a comment (style foreground=greed, like in line 33). Line 35 show, that syntax highlight function is bugged.

Behaviour of the Eclipse:

  • line 33 - is highlighted as a normal comment;
  • line 34 - comment at the end of the line is not highlighted (Eclipse can't detect comments at the end of the command);
  • line 35 - comment at the end of the line is highlighted (the symbol ";", which placed before the symbol "#", allows Eclipse to handle next words as a new command, which interpreted as comment, because this command has first printable symbol "#").

Behaviour of the Geany:

Geany editor correctly highlight comments at all lines as a comments: 33, 34 and 35.

Bogdan107 avatar Jun 29 '22 17:06 Bogdan107