<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to add additional styles to an existing Languages in Style configurator?]]></title><description><![CDATA[<p dir="auto">i’am using the in-build syntax highlighting feature for the lua language. i have written some lua “util” libs with custom functions. In this case i have tried to add a new style “utils” to the existing lua in-build language to get an own colormanagement for these util functions but all trials fails. I tried to modify the “langs.xml / langs.model.xml” and “stylers.xml / stylers.model.xml” and of course i can see a new “utils” entry in the “styles configurator/lua” language but this entry has absolutely no effects…</p>
<p dir="auto">What i do wrong? How can i add an additional style to the existing in-build lua language?</p>
<p dir="auto">PS: sry for the double posting, i tried to edit my first question but i can’t find a way to do this.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/156/how-to-add-additional-styles-to-an-existing-languages-in-style-configurator</link><generator>RSS for Node</generator><lastBuildDate>Tue, 16 Jun 2026 03:09:30 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/156.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Jul 2015 09:52:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to add additional styles to an existing Languages in Style configurator? on Tue, 12 Jul 2016 19:14:12 GMT]]></title><description><![CDATA[<p dir="auto">I had lots of trouble with getting custom colors to work too.  Today I finally found out the cause is due to using global defaults.  Global defaults, I think, are supposed to be applied across all schemes, but I suspect when there are specific settings that are not defined in the global set, specific color schemes “bleed through”.  So say you have a custom language setting for your favorite language Z#++ and a keyword defined for “iffin”, as in:<br />
iffin (thissaHappened) {<br />
…<br />
}</p>
<p dir="auto">Since “iffin” is not already defined in Globals the color you set for “iffin” shows through.  Just a speculation, but it seems to follow what I’m seeing.</p>
<p dir="auto">Here is what I did to get specific language defs to work:<br />
. Select theme: Default.xml<br />
. Set Language: Global Styles<br />
. Set Style: Global override<br />
. Turn off ALL global settings.  You can leave the font selection enabled since that doesn’t affect colors.<br />
. Click Save &amp; Close<br />
. Now go into Settings &gt; Style Configurator and select your language-specific settings.  When you make changes they will be visible in the editor.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16810</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16810</guid><dc:creator><![CDATA[Mike Welch]]></dc:creator><pubDate>Tue, 12 Jul 2016 19:14:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to add additional styles to an existing Languages in Style configurator? on Sat, 18 Jul 2015 09:05:35 GMT]]></title><description><![CDATA[<p dir="auto">Have spent great time looking at this – even inside that hard and dirty Np++ source-code – to no definitive conclusion, but…</p>
<p dir="auto">I see that in some languages it works a bit better (eg. Javascript), PHP otherwise nothing…</p>
<p dir="auto">I think <code>styleID="16"</code> is a magic number, a style with that id may have effect or not (two with same Id, the later prevails).</p>
<p dir="auto">I could not see any <code>keywordClass</code> effect, even though there are functions that supposedly should handle them. <code>getKwClassFromName</code> reads it, then, it should populate an array: <code>_styleArray[index]._keywordClass = getKwClassFromName(str);</code></p>
<p dir="auto">There are many functions to handle each language type, it is very hard to track the order they execute and what they do.</p>
<p dir="auto">This function for example, seems to allow only “instre1” and “type1” for keywordClass (for the languages it handles):</p>
<pre><code class="language-cpp">void ScintillaEditView::setCppLexer(LangType langType)
...

	if (pKwArray[LANG_INDEX_INSTR])
	{
		basic_string&lt;wchar_t&gt; kwlW = pKwArray[LANG_INDEX_INSTR];
		keywordListInstruction = wstring2string(kwlW, CP_ACP);
	}
	cppInstrs = getCompleteKeywordList(keywordListInstruction, langType, LANG_INDEX_INSTR);

	if (pKwArray[LANG_INDEX_TYPE])
	{
		basic_string&lt;wchar_t&gt; kwlW = pKwArray[LANG_INDEX_TYPE];
		keywordListType = wstring2string(kwlW, CP_ACP);
	}
	cppTypes = getCompleteKeywordList(keywordListType, langType, LANG_INDEX_TYPE);
</code></pre>
<p dir="auto">This one may allow “instre1”,“instre1”,“type1”,“type2” for <strong>LUA</strong>:</p>
<pre><code class="language-cpp">	void setLuaLexer() {
		setLexer(SCLEX_LUA, L_LUA, LIST_0 | LIST_1 | LIST_2 | LIST_3);
	};
</code></pre>
<p dir="auto">Because we some somewhere else:</p>
<pre><code class="language-cpp">	if (whichList &amp; LIST_0)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_INSTR], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_INSTR);
	}	

	if (whichList &amp; LIST_1)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_INSTR2], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_INSTR2);
	}

	if (whichList &amp; LIST_2)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_TYPE], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_TYPE);
	}

	if (whichList &amp; LIST_3)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_TYPE2], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_TYPE2);
	}

	if (whichList &amp; LIST_4)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_TYPE3], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_TYPE3);
	}

	if (whichList &amp; LIST_5)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_TYPE4], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_TYPE4);
	}

	if (whichList &amp; LIST_6)
	{
		const char * keyWords_char = wmc-&gt;wchar2char(pKwArray[LANG_INDEX_TYPE5], CP_ACP);
		setKeywords(langType, keyWords_char, LANG_INDEX_TYPE5);
	}
</code></pre>
<p dir="auto"><strong>Appendix</strong></p>
<p dir="auto">I see that Syntilla lexers¹ use predefined numbers for coloring things (these are the "styleID"s), but I don’t know how they handle unknown keyword list or how they receive it from Np++ (above functions). Eg:</p>
<pre><code class="language-cpp">#define SCE_HPHP_COMPLEX_VARIABLE 104
#define SCE_HPHP_DEFAULT 118
#define SCE_HPHP_HSTRING 119
#define SCE_HPHP_SIMPLESTRING 120
#define SCE_HPHP_WORD 121
#define SCE_HPHP_NUMBER 122
#define SCE_HPHP_VARIABLE 123
#define SCE_HPHP_COMMENT 124
#define SCE_HPHP_COMMENTLINE 125
#define SCE_HPHP_HSTRING_VARIABLE 126
#define SCE_HPHP_OPERATOR 127
...
#define SCE_LUA_DEFAULT 0
#define SCE_LUA_COMMENT 1
#define SCE_LUA_COMMENTLINE 2
#define SCE_LUA_COMMENTDOC 3
#define SCE_LUA_NUMBER 4
#define SCE_LUA_WORD 5
#define SCE_LUA_STRING 6
#define SCE_LUA_CHARACTER 7
#define SCE_LUA_LITERALSTRING 8
#define SCE_LUA_PREPROCESSOR 9
#define SCE_LUA_OPERATOR 10
#define SCE_LUA_IDENTIFIER 11
#define SCE_LUA_STRINGEOL 12
#define SCE_LUA_WORD2 13
#define SCE_LUA_WORD3 14
#define SCE_LUA_WORD4 15
#define SCE_LUA_WORD5 16
#define SCE_LUA_WORD6 17
#define SCE_LUA_WORD7 18
#define SCE_LUA_WORD8 19
#define SCE_LUA_LABEL 20
</code></pre>
<p dir="auto">¹ there’s one for every group of languages – PHP is handled by HTML lexer, Javascript uses CPP, and so on.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/500</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/500</guid><dc:creator><![CDATA[Ricardo]]></dc:creator><pubDate>Sat, 18 Jul 2015 09:05:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to add additional styles to an existing Languages in Style configurator? on Thu, 16 Jul 2015 10:23:00 GMT]]></title><description><![CDATA[<p dir="auto">no, sorry.</p>
<p dir="auto">you said: “If you want to add new keywords that should be highlighted, you edit langs.xml file.”<br />
i know that, but if i add my additional keywords to an existing style/category then the keywords using the same color.<br />
Therefore i tried to add a new style/category to use a new/different colormanagement:</p>
<p dir="auto">These are the default styles/categories for the lua language in “stylers.xml”:</p>
<p dir="auto">DEFAULT<br />
COMMENT<br />
COMMENT LINE<br />
COMMENT DOC<br />
LITERALSTRING<br />
PREPROCESSOR<br />
INSTRUCTION WORD -&gt; using: keywordClass=“instre1”<br />
NUMBER<br />
STRING<br />
CHARACTER<br />
OPERATOR<br />
FUNC1 -&gt; using: keywordClass=“instre2”<br />
FUNC2 -&gt; using: keywordClass=“type1”<br />
FUNC3 -&gt; using: keywordClass=“type2”</p>
<p dir="auto">i tried to add a new one:<br />
EXTRA1 -&gt; my new style, i tried to use: keywordClass=“type3” because some other languages use this too.</p>
<p dir="auto">my additional line:<br />
&lt;WordsStyle name=“EXTRA1” styleID=“20” fgColor=“BFBF00” bgColor=“232C31” fontName=“Lucida Console” fontStyle=“0” fontSize=“” keywordClass=“type3”&gt;</p>
<p dir="auto">and in the “langs.xml” i tried to add this new line:<br />
&lt;Keywords name=“type3”&gt;i add my new keywords here&lt;/Keywords&gt;</p>
<p dir="auto">when i restart my n++ then all looks good and my new “EXTRA1” style/category definition is in the list but whatever i try to add it has no effects.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/442</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/442</guid><dc:creator><![CDATA[pulsar-de]]></dc:creator><pubDate>Thu, 16 Jul 2015 10:23:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to add additional styles to an existing Languages in Style configurator? on Thu, 16 Jul 2015 08:57:18 GMT]]></title><description><![CDATA[<p dir="auto">If you want to add new keywords that should be highlighted, you edit <code>langs.xml</code> file.<br />
<code>stylers.xml</code> file contains the colors for the default theme. Custom themes you edit the correct one in /themes dir.<br />
I hope it is what you need.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/440</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/440</guid><dc:creator><![CDATA[Ricardo]]></dc:creator><pubDate>Thu, 16 Jul 2015 08:57:18 GMT</pubDate></item></channel></rss>