Yaml double quotes
-
I’m a bit confused as to why Yaml doesn’t seem to properly highlight text. I want my strings (in double quotes) to have a different color, like in other languages. Notepad ++ doesn’t seem to detect the double quotes in Yaml properly. It has styling configuration for both “TEXT” and “STRING”. It seems to consider the colon separating values as “STRING” (when changing the color of STRING it only changes the colons) but it doesn’t care about the colors I set for “TEXT”.
Example YAML:
Test:
value: “some text”
another: noStringIn the above, the colon will have the new color, but the “some text” has the same color as noString. I want them to have different colors :)
Ideas? :). I tried hacking langs.xml and stylers.xml to no avail…
-
Running a quick experiment where I use Style Configurator to change the format of each style category “live” (I toggled underlining on each category, and was able to see some – like the DEFAULT and IDENTIFIER – change as I toggled it). Based on those experiments, it appears that
"some text"
andnoString
are both considered “DEFAULT”. I see the “TEXT” configuration, but not the “STRING” – which version of Notepad++ are you using?The list of categories shown in the “style” column of the Configurator, and how they are parsed/lexed, are defined by the lexer (in this case, the YAML lexer), which Notepad++ inherits from Scintilla (the underlying editing component that Notepad++ uses). I tried looking through NPP’s copy of the Scintilla YAML lexer source code – but I don’t know enough about lexer code to fully follow, and I’m not immediately seeing how it defines the beginning/end of “TEXT”. It seems to have something to do with whether indenting has changed… but I’m not sure exactly how, and I couldn’t get any pseudo-YAML text I entered to be interpreted as “TEXT”. But it doesn’t seem that “TEXT” means “something in double quotes”. Maybe “STRING” does (but I don’t see it in my Style Configurator, nor in the NPP LexYAML source code, so I don’t know…)
If you wanted to ask for a change in the lexer, such that it had a “STRING” or similar “QUOTED” category, you’d have to go to the Scintilla project, and make an issue there – after verifying that such an issue doesn’t exist, and after verifying that the most recent Scintilla doesn’t already have it. (It’s quite possible it does: Notepad++ doesn’t upgrade its Scintilla version very often – 3.56 appears to be the version NPP uses, since mid-2015.)
-
Using Notepad 7.5.9. Ok, so it’s not just me but some sort of lack of functionality. Does NPP have a place where I should report bugs? I’d rather do it here than go to the Scintilla project. Maybe the developers involved in NPP know something more :)
-
Hello, @axonn-echysttas, @peterJones, and All,
From what I read, here :
http://yaml.org/spec/1.2/spec.html#id2760844
Text styling seems to work inside the block notations, beginning with the
|
or the>
symbolsHere is, below, some blocks of random
YAML
code, ( without any coherence ! ) just to see the color effects of some structures !Put that text in a new tab and choose the
YAML
language#--------------------------------------------- string: '012345' date: 2002-12-14 boolean: true %TAG ! tag:clarkevans.com,2002: --- !shape # Use the ! handle for presenting # tag:clarkevans.com,2002:circle - !circle center: &ORIGIN {x: 73, y: 129} radius: 7 - !line start: *ORIGIN finish: { x: 89, y: 102 } - !label start: *ORIGIN color: 0xFFEEBB text: Pretty vector drawing. literal_block: | All line-break are significant folded block: > each line break is folded to a space unless it ends an empty or a more-indented line. #--------------------------------------------- %TAG ! tag:clarkevans.com,2002: --- !shape # Use the ! handle for presenting # tag:clarkevans.com,2002:circle - !circle center: &ORIGIN {x: 73, y: 129} radius: 7 - !line start: *ORIGIN finish: { x: 89, y: 102 } - !label start: *ORIGIN color: 0xFFEEBB text: Pretty vector drawing. #--------------------------------------------- --- !<tag:clarkevans.com,2002:invoice> invoice: 34843 date : 2001-01-23 bill-to: &id001 given : Chris family : Dumars address: lines: | 458 Walkman Dr. Suite #292 city : Royal Oak state : MI postal : 48046 ship-to: *id001 product: - sku : BL394D quantity : 4 description : Basketball price : 450.00 - sku : BL4438H quantity : 1 description : Super Hoop price : 2392.00 tax : 251.42 total: 4443.52 comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338. #--------------------------------------------- --- Time: 2001-11-23 15:01:42 -5 User: ed Warning: This is an error message for the log file --- Time: 2001-11-23 15:02:31 -5 User: ed Warning: A slightly different error message. --- Date: 2001-11-23 15:03:17 -5 User: ed Fatal: Unknown variable "bar" Stack: - file: TopClass.py line: 23 code: | x = MoreObject("345\n") - file: MoreClass.py line: 58 code: |- foo = bar #---------------------------------------------
Best Regards,
guy038
-
@guy038 G’dam’ m’man! That’s a niiiiice find. Thank thee! :D. Much obliged’n’all :). And if you wonder why I wrote “G’dam’ m’man!” that way, just listen to https://open.spotify.com/track/1jGvgQkqQtNVj725vg26Ft (it’s an anti-racist song :) ).