SynEdit: XML-Highlighter, add option to color comment open/close symbol as part of comment. Issue #41752

This commit is contained in:
Martin 2025-07-22 10:42:27 +02:00
parent 1fe9890ad6
commit a73b16d1df
21 changed files with 88 additions and 3 deletions

View File

@ -105,6 +105,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr ""

View File

@ -107,6 +107,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Podmínka"

View File

@ -109,6 +109,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Bedingung"

View File

@ -107,6 +107,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Condición"

View File

@ -100,6 +100,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Ehdot"

View File

@ -107,6 +107,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Condition"

View File

@ -105,6 +105,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "תנאי"

View File

@ -107,6 +107,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Feltétel"

View File

@ -108,6 +108,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr ""

View File

@ -108,6 +108,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Condizione"

View File

@ -108,6 +108,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Sąlyga"

View File

@ -105,6 +105,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr ""

View File

@ -108,6 +108,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Warunek"

View File

@ -97,6 +97,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr ""

View File

@ -107,6 +107,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Condição"

View File

@ -107,6 +107,10 @@ msgstr "Комментарий с фигурными скобками"
msgid "Slash Comment"
msgstr "Комментарий с косыми чертами"
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Условие"

View File

@ -111,6 +111,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Şart"

View File

@ -110,6 +110,10 @@ msgstr ""
msgid "Slash Comment"
msgstr ""
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "Умова"

View File

@ -108,6 +108,10 @@ msgstr "花括号注释"
msgid "Slash Comment"
msgstr "斜杠注释"
#: syneditstrconst.syns_attrcommentsym
msgid "Comment Symbol"
msgstr ""
#: syneditstrconst.syns_attrcondition
msgid "Condition"
msgstr "状态"

View File

@ -66,6 +66,7 @@ resourcestring
SYNS_AttrCharacter = 'Character';
SYNS_AttrClass = 'Class';
SYNS_AttrComment = 'Comment';
SYNS_AttrCommentSym = 'Comment Symbol';
SYNS_AttrCommentAnsi = 'ANSI Comment';
SYNS_AttrCommentCurly = 'Curly Comment';
SYNS_AttrCommentSlash = 'Slash Comment';
@ -202,6 +203,7 @@ const
SYNS_XML_AttrCharacter = 'Character';
SYNS_XML_AttrClass = 'Class';
SYNS_XML_AttrComment = 'Comment';
SYNS_XML_AttrCommentSym = 'Comment Symbol';
SYNS_XML_AttrCommentAnsi = 'Ansi Comment';
SYNS_XML_AttrCommentCurly = 'Curly Comment';
SYNS_XML_AttrCommentSlash = 'Slash Comment';

View File

@ -61,7 +61,7 @@ uses
type
TtkTokenKind = (tkAposAttrValue, tkAposEntityRef, tkAttribute, tkCDATA,
tkComment, tkElement, tkEntityRef, tkEqual, tkNull, tkProcessingInstruction,
tkComment, tkCommentSym, tkElement, tkEntityRef, tkEqual, tkNull, tkProcessingInstruction,
tkQuoteAttrValue, tkQuoteEntityRef, tkSpace, tkSymbol, tkText,
//
tknsAposAttrValue, tknsAposEntityRef, tknsAttribute, tknsEqual,
@ -104,6 +104,7 @@ type
TSynXMLSyn = class(TSynCustomXmlHighlighter)
private
fCommentSymbolAttri: TSynHighlighterAttributes;
fRange: TRangeState;
fLine: PChar;
Run: Longint;
@ -203,6 +204,8 @@ type
read fProcessingInstructionAttri write fProcessingInstructionAttri;
property CommentAttri: TSynHighlighterAttributes read fCommentAttri
write fCommentAttri;
property CommentSymbolAttri: TSynHighlighterAttributes read fCommentSymbolAttri
write fCommentSymbolAttri;
property DocTypeAttri: TSynHighlighterAttributes read fDocTypeAttri
write fDocTypeAttri;
property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
@ -229,6 +232,7 @@ begin
fProcessingInstructionAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrProcessingInstr, SYNS_XML_AttrProcessingInstr);
fCDATAAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrCDATASection, SYNS_XML_AttrCDATASection);
fCommentAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrComment, SYNS_XML_AttrComment);
fCommentSymbolAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrCommentSym, SYNS_XML_AttrCommentSym);
fDocTypeAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrDOCTYPESection, SYNS_XML_AttrDOCTYPESection);
fAttributeAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrAttributeName, SYNS_XML_AttrAttributeName);
fnsAttributeAttri:= TSynHighlighterAttributes.Create(@SYNS_AttrNamespaceAttrName, SYNS_XML_AttrNamespaceAttrName);
@ -269,6 +273,7 @@ begin
fCommentAttri.Background:= clSilver;
fCommentAttri.Foreground:= clGray;
fCommentAttri.Style:= [fsbold, fsItalic];
fCommentSymbolAttri.Clear;
fSymbolAttri.Foreground:= clblue;
fSymbolAttri.Style:= [];
@ -277,6 +282,7 @@ begin
AddAttribute(fProcessingInstructionAttri);
AddAttribute(fDocTypeAttri);
AddAttribute(fCommentAttri);
AddAttribute(fCommentSymbolAttri);
AddAttribute(fElementAttri);
AddAttribute(fAttributeAttri);
AddAttribute(fnsAttributeAttri);
@ -381,7 +387,7 @@ begin
if (fLine[Run] = '!') then
begin
if NextTokenIs('--') then begin
fTokenID := tkSymbol;
fTokenID := tkCommentSym;
fRange := rsComment;
StartXmlCodeFoldBlock(cfbtXmlComment);
Inc(Run, 3);
@ -427,7 +433,7 @@ begin
if (fLine[Run] = '-') and (fLine[Run + 1] = '-') and
(fLine[Run + 2] = '>')
then begin
fTokenID := tkSymbol;
fTokenID := tkCommentSym;
fRange:= rsText;
Inc(Run, 3);
if TopXmlCodeFoldBlockType = cfbtXmlComment then
@ -896,6 +902,7 @@ begin
tknsAposEntityRef: Result:= fEntityRefAttri;
tkProcessingInstruction: Result:= fProcessingInstructionAttri;
tkComment: Result:= fCommentAttri;
tkCommentSym: Result:= fCommentSymbolAttri;
tkDocType: Result:= fDocTypeAttri;
tkSymbol: Result:= fSymbolAttri;
tkSpace: Result:= fSpaceAttri;