digitalmars.D - Advise for syntax highlighting
- Jacob Carlborg (33/33) Mar 27 2015 I'm currently updating the TextMate D bundle for D2. I have a couple of
- Chris (11/44) Mar 27 2015 Am using Textadept, the highlighting is as follows:
- Jacob Carlborg (7/11) Mar 27 2015 Why is this highlighted as a keyword? I was more leaning to highlight it...
- Chris (5/16) Mar 27 2015 Well, it _is_ a keyword. You cannot write a function called
- Jacob Carlborg (6/8) Mar 27 2015 It depends on how you see it. It's also a special method that just
- Chris (2/10) Mar 27 2015 Either way, it should be highlighted somehow.
- Dicebot (10/40) Mar 27 2015 keyword (because, well, it is not a parameter)
- Jacob Carlborg (4/6) Mar 27 2015 Doesn't this symbol also have special semantics?
- Tobias Pankrath (4/9) Mar 27 2015 A more pragmatical view would be:
- Dicebot (4/9) Mar 27 2015 Not really. It has special value (true within ctfe, false in
- Jesse Phillips (13/46) Mar 27 2015 Keyword (function should be fine, vim doesn't highlight those)
- Jacob Carlborg (8/20) Mar 28 2015 I completely forgot about these. Should these be the same as __ctfe?
- Meta (4/6) Mar 28 2015 Isn't __ctor just a DMD thing? I don't think we should be
- Jacob Carlborg (4/7) Mar 29 2015 What about #line?
I'm currently updating the TextMate D bundle for D2. I have a couple of
questions for how to highlighting some specific code or how other
editors/IDE's highlight them.
* "this" in constructor
this () {}
In TextMate functions/methods are highlighted, should this be
highlighted as a keyword or as a method?
* "this" in copy constructor
this (this) {}
The "this" parameter, should that be highlighted as a keyword or as a
parameter?
* The "__ctfe" variable
if (__ctfe) {}
How should this highlighted? I see a couple of alternatives:
- not at all
- as a keyword
- as a special recognized built-in symbol, similar to __LINE__
- as a special recognized library symbol. For example, in the C bundle
many of functions in the standard library are specially recognized and
highlighted differently. This might not apply here since it's not a
library symbol
* __traits identifiers
__traits(allMembers, Foo);
In this case "allMembers". Basically the same question and alternatives
as for the "__ctfe" variable.
* Predefined version identifiers
version (OSX) {}
Again, same a question and alternatives as for the "__ctfe" variable.
* Extern identifiers
extern (C)
Again, same a question and alternatives as for the "__ctfe" variable.
--
/Jacob Carlborg
Mar 27 2015
On Friday, 27 March 2015 at 10:34:58 UTC, Jacob Carlborg wrote:
I'm currently updating the TextMate D bundle for D2. I have a
couple of questions for how to highlighting some specific code
or how other editors/IDE's highlight them.
* "this" in constructor
this () {}
In TextMate functions/methods are highlighted, should this be
highlighted as a keyword or as a method?
* "this" in copy constructor
this (this) {}
The "this" parameter, should that be highlighted as a keyword
or as a parameter?
* The "__ctfe" variable
if (__ctfe) {}
How should this highlighted? I see a couple of alternatives:
- not at all
- as a keyword
- as a special recognized built-in symbol, similar to __LINE__
- as a special recognized library symbol. For example, in the C
bundle many of functions in the standard library are specially
recognized and highlighted differently. This might not apply
here since it's not a library symbol
* __traits identifiers
__traits(allMembers, Foo);
In this case "allMembers". Basically the same question and
alternatives as for the "__ctfe" variable.
* Predefined version identifiers
version (OSX) {}
Again, same a question and alternatives as for the "__ctfe"
variable.
* Extern identifiers
extern (C)
Again, same a question and alternatives as for the "__ctfe"
variable.
Am using Textadept, the highlighting is as follows:
highlighted as keyword:
this()
__traits
extern(C) // The "extern"; "C" isn't highlighted at all
highlighted as a special recognized built-in symbol, similar to
__LINE__:
version(OSX) // the OSX; "version" is highlighted as keyword
not highlighted at all:
__ctfe
Mar 27 2015
On 2015-03-27 13:33, Chris wrote:Am using Textadept, the highlighting is as follows: highlighted as keyword: this()Why is this highlighted as a keyword? I was more leaning to highlight it as a method. What about the parameter in a copy constructor?__traitsWhat about the identifiers/keywords used as the first argument to "__traits"? -- /Jacob Carlborg
Mar 27 2015
On Friday, 27 March 2015 at 13:58:03 UTC, Jacob Carlborg wrote:On 2015-03-27 13:33, Chris wrote:Well, it _is_ a keyword. You cannot write a function called "this", nor can you use it as a variable name. So yes, it's a keyword = reserved.Am using Textadept, the highlighting is as follows: highlighted as keyword: this()Why is this highlighted as a keyword? I was more leaning to highlight it as a method.What about the parameter in a copy constructor?Not highlighted.__traitsWhat about the identifiers/keywords used as the first argument to "__traits"?
Mar 27 2015
On 2015-03-27 15:03, Chris wrote:Well, it _is_ a keyword. You cannot write a function called "this", nor can you use it as a variable name. So yes, it's a keyword = reserved.It depends on how you see it. It's also a special method that just happens to use a keyword as its name. It doesn't have the same meaning as "this" instead a regular method. -- /Jacob Carlborg
Mar 27 2015
On Friday, 27 March 2015 at 14:10:22 UTC, Jacob Carlborg wrote:On 2015-03-27 15:03, Chris wrote:Either way, it should be highlighted somehow.Well, it _is_ a keyword. You cannot write a function called "this", nor can you use it as a variable name. So yes, it's a keyword = reserved.It depends on how you see it. It's also a special method that just happens to use a keyword as its name. It doesn't have the same meaning as "this" instead a regular method.
Mar 27 2015
Personal preferences:* "this" in constructor this () {} In TextMate functions/methods are highlighted, should this be highlighted as a keyword or as a method?method* "this" in copy constructor this (this) {} The "this" parameter, should that be highlighted as a keyword or as a parameter?keyword (because, well, it is not a parameter)* The "__ctfe" variable if (__ctfe) {} How should this highlighted? I see a couple of alternatives: - not at all - as a keyword - as a special recognized built-in symbol, similar to __LINE__ - as a special recognized library symbol. For example, in the C bundle many of functions in the standard library are specially recognized and highlighted differently. This might not apply here since it's not a library symbolnot at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol.* __traits identifiers __traits(allMembers, Foo); In this case "allMembers". Basically the same question and alternatives as for the "__ctfe" variable.this is different from __ctfe as it is actual compiler built-in with special semantics. "special recognized built-in symbol" is probably best fit as it is not listed as keyword either.* Predefined version identifiers version (OSX) {} Again, same a question and alternatives as for the "__ctfe" variable."special recognized built-in symbol"* Extern identifiers extern (C) Again, same a question and alternatives as for the "__ctfe" variable."special recognized built-in symbol"
Mar 27 2015
On 2015-03-27 16:04, Dicebot wrote:not at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol.Doesn't this symbol also have special semantics? -- /Jacob Carlborg
Mar 27 2015
On Friday, 27 March 2015 at 15:23:56 UTC, Jacob Carlborg wrote:On 2015-03-27 16:04, Dicebot wrote:A more pragmatical view would be: if(__ctf ... Was it __ctfe or __ctfe__? Easily answered if it has special highlighting.not at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol.Doesn't this symbol also have special semantics?
Mar 27 2015
On Friday, 27 March 2015 at 15:23:56 UTC, Jacob Carlborg wrote:On 2015-03-27 16:04, Dicebot wrote:Not really. It has special value (true within ctfe, false in normal code generation) but otherwise it is just a normal variable.not at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol.Doesn't this symbol also have special semantics?
Mar 27 2015
Vim is setup as: On Friday, 27 March 2015 at 10:34:58 UTC, Jacob Carlborg wrote:I'm currently updating the TextMate D bundle for D2. I have a couple of questions for how to highlighting some specific code or how other editors/IDE's highlight them. * "this" in constructor this () {}Keyword (function should be fine, vim doesn't highlight those)In TextMate functions/methods are highlighted, should this be highlighted as a keyword or as a method? * "this" in copy constructor this (this) {}KeywordThe "this" parameter, should that be highlighted as a keyword or as a parameter? * The "__ctfe" variable if (__ctfe) {} How should this highlighted? I see a couple of alternatives: - not at all - as a keyword - as a special recognized built-in symbol, similar to __LINE__ - as a special recognized library symbol. For example, in the C bundle many of functions in the standard library are specially recognized and highlighted differently. This might not apply here since it's not a library symbolStatement [e.g. debug, return, function, with] (that needs fixed) Probably should be Identifier for consistency [e.g. _arugments, __vptr, _ctor] Which I guess is your third (special recognized built-in), though __LINE__ is a constant in Vim's highlighting [e.g. null, __VERSION__].* __traits identifiers __traits(allMembers, Foo); In this case "allMembers". Basically the same question and alternatives as for the "__ctfe" variable.Identifier* Predefined version identifiers version (OSX) {} Again, same a question and alternatives as for the "__ctfe" variable.Identifier* Extern identifiers extern (C) Again, same a question and alternatives as for the "__ctfe" variable.Identifier
Mar 27 2015
On 2015-03-28 01:01, Jesse Phillips wrote:Statement [e.g. debug, return, function, with] (that needs fixed)Not sure what you mean.Probably should be Identifier for consistency [e.g. _arugments, __vptr, _ctor]I completely forgot about these. Should these be the same as __ctfe?Which I guess is your third (special recognized built-in), though __LINE__ is a constant in Vim's highlighting [e.g. null, __VERSION__].Yeah, both null and __LINE__ are constants in TextMate as well. I probably didn't use the correct name for describing it.Same as __LINE__ or? -- /Jacob Carlborg* __traits identifiers __traits(allMembers, Foo); In this case "allMembers". Basically the same question and alternatives as for the "__ctfe" variable.Identifier
Mar 28 2015
On Saturday, 28 March 2015 at 00:01:48 UTC, Jesse Phillips wrote:Probably should be Identifier for consistency [e.g. _arugments, __vptr, _ctor]Isn't __ctor just a DMD thing? I don't think we should be highlighting symbols which aren't guaranteed to even exist for a particular implementation.
Mar 28 2015









"Chris" <wendlec tcd.ie> 