Bug 18879 – !is doesn't highlight correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
visuald
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-19T18:45:14Z
Last change time
2018-06-10T09:03:05Z
Assigned to
Rainer Schuetze
Creator
Manu

Comments

Comment #0 by turkeyman — 2018-05-19T18:45:14Z
`in` and `is()` are highlighted as keywords, but `!in` and `!is()` are not highlighted correctly.
Comment #1 by r.sagitario — 2018-05-19T20:41:48Z
`in` and `is` can be both operators or keywords depending on context, so different colors are expected. A preceding `!` is a separate token, i.e. there can be arbitrary spaces and comments in between. This makes it pretty difficult for the lexer to highlight these correctly, but there is actually support for that by asking the parser. It seems this is broken, though.
Comment #2 by turkeyman — 2018-05-19T22:15:16Z
I think they should both be highlighted when used both as operators and as keywords... so I don't think that distinction of case matters?
Comment #3 by r.sagitario — 2018-05-20T06:56:09Z
The distinction matters if keywords and operators are supposed to show different colors.
Comment #4 by turkeyman — 2018-05-20T06:58:01Z
Oh? I didn't know they did... they're all blue by default on my setup :)
Comment #5 by r.sagitario — 2018-05-20T15:36:58Z
Actually never implemented in the "new" parser that is now used for about 5 years. I've added it now and preview should be available in a couple of minutes here: https://ci.appveyor.com/project/rainers/visuald
Comment #6 by turkeyman — 2018-05-20T18:13:37Z
Added distinct colour, or fixes for !is/!in? :)
Comment #7 by r.sagitario — 2018-05-21T08:03:49Z
> Added distinct colour, or fixes for !is/!in? :) "in" and "is" use color "Visual D Operator" if used as operators, and color "Visual D Keyword" elsewhere.
Comment #8 by turkeyman — 2018-05-21T08:42:26Z
Are they the same colour by default? :P
Comment #9 by r.sagitario — 2018-05-21T08:56:59Z
Keywords are blue by default, operators have the default color depending on the theme, so usually black or white.
Comment #10 by turkeyman — 2018-05-22T04:46:04Z
Hmm, I would personally want something different... When I read operator, I read ! * & + /. While 'in' is an operator, I would want it to colour like a keyword. When I see !in, I would want the ! to be operator coloured (ie, black on while) and 'in' to be keyword coloured (ie, blue on white). If you're not into that, is it possible to make that an option?
Comment #11 by r.sagitario — 2018-05-22T05:46:41Z
You are supposed to be able to configure that on the colorizer options page with the "Colored types" by adding [Keyword] is in but that's currently not working when the token has been classified as an operator. I've changed that for the next build.
Comment #12 by r.sagitario — 2018-06-10T09:03:05Z