saem / vscode-nim

Other
177 stars 23 forks source link

fix highlighting enum values in if/when exprs as procs #87

Open morganholly opened 2 years ago

saem commented 2 years ago

Thanks for the PR @morganholly, I'm not sure I necessarily understand the change. Could you explain it so I can compare it with my own understanding?

morganholly commented 2 years ago

so i noticed it within this code. all of the itInt, valString, callbackBool, etc were highlighted as proc calls, but they’re enums

flag = FlagVariantRef(kind: fkShortAndLong,
                                shortName: shortName,
                                longName: longName,
                                datatype: when T is int64: itInt elif T is float64: itFloat elif T is string: itString elif T is bool: itBool elif T is FuzzyBool: itFuzzyBool,
                                ...
morganholly commented 2 years ago

however i think it may block highlighting actual proc calls in an object construction

morganholly commented 2 years ago

i will see if i need to slightly tweak the regex probably to look for an if, when, elif, else, of, etc

morganholly commented 2 years ago

so i didn't work on the regex yet but it doesn't highlight myProc input so i'll have to work on the regex later

morganholly commented 2 years ago

so i did some work on the regex, i have something working correctly in regex101 but vscode doesn't seem to like it so i have to do a bit more to get a good regex for this

morganholly commented 2 years ago

ok i found a workaround for the issue and added the fixed regex in

morganholly commented 2 years ago

it will require fixing merge conflicts at some point so i may do that ahead of time