bitwisecook / vscode-tcl

Tcl for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=bitwisecook.tcl
MIT License
39 stars 20 forks source link

Syntax highlighting doesn't work properly #2

Open chriswcy opened 3 years ago

chriswcy commented 3 years ago

There are few items not highlighted I found(but highlighted in sleutho version):

The built-in commands were highlighted in different colors in sleutho version. They are now in same color: e.g., "proc", 'for", "uplevel", "set", "list", "while"

I am using vscode 1.52.1 (color theme: Monokai Dimmed).

maciejmatczak commented 3 years ago

@chriswcy, I am an user as you are. I can see some differentiation in highlights in operators. Maybe we can work on examples?

Not operators example from here https://wiki.tcl-lang.org/page/Named+arguments ("As the boilerplate is getting a bit lengthy [...]". Github renders it:

proc named {args defaults} {
    upvar 1 "" ""
    array set "" $defaults
    foreach {key value} $args {
        if {![info exists ($key)]} {
            error "bad option '$key', should be one of: [lsort [array names {}]]"
        }
        set ($key) $value
    }
}

proc replace {s args} {
    named $args {-from 0 -to end -with ""}
    string replace $s $(-from) $(-to) $(-with)
}

#--- Testing:
replace suchenwirth -from 4 -to 6 -with xx
# suchxxirth
replace suchenwirth -from 4 -to 6 -witha xx
# bad option '-witha', should be one of: -from -to -with

TCL wiki: image

Dark (Visual Studio): image

Dark + (default dark): image

Monokai dimmed: image

That foreach is weird.

I personally use Horizon, but from functionality point of view, it seems similar to Dark+ in it's richness. Though foreach looks allright: image

I like best how Github handles strings with variables inside. I have no idea what happens around dashed words around:

named $args {-from 0 -to end -with ""}
bitwisecook commented 2 years ago

@chriswcy the current syntax highlighting meets my needs even if it's a little buggy in spots.

I'm more than happy to receive pull requests improving it.