Improve Json syntax highlighting
This commit is contained in:
parent
b76bf9e4df
commit
be6f797e65
@ -138,7 +138,7 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL+1] = {
|
||||
{TEXT("r"), TEXT("R"), TEXT("R programming language"), L_R, SCLEX_R},
|
||||
{TEXT("jsp"), TEXT("JSP"), TEXT("JavaServer Pages script file"), L_JSP, SCLEX_HTML},
|
||||
{TEXT("coffeescript"), TEXT("CoffeeScript"), TEXT("CoffeeScript file"), L_COFFEESCRIPT, SCLEX_COFFEESCRIPT},
|
||||
{TEXT("json"), TEXT("json"), TEXT("JSON file"), L_JSON, SCLEX_CPP },
|
||||
{TEXT("json"), TEXT("json"), TEXT("JSON file"), L_JSON, SCLEX_JSON },
|
||||
{TEXT("javascript.js"), TEXT("JavaScript"), TEXT("JavaScript file"), L_JAVASCRIPT, SCLEX_CPP },
|
||||
{TEXT("fortran77"), TEXT("Fortran fixed form"), TEXT("Fortran fixed form source file"), L_FORTRAN_77, SCLEX_F77},
|
||||
{TEXT("baanc"), TEXT("BaanC"), TEXT("BaanC File"), L_BAANC, SCLEX_BAAN },
|
||||
@ -692,20 +692,28 @@ void ScintillaEditView::setEmbeddedJSLexer()
|
||||
|
||||
void ScintillaEditView::setJsonLexer()
|
||||
{
|
||||
execute(SCI_SETLEXER, SCLEX_CPP);
|
||||
execute(SCI_SETLEXER, SCLEX_JSON);
|
||||
|
||||
const TCHAR *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
||||
|
||||
makeStyle(L_JSON, pKwArray);
|
||||
|
||||
basic_string<char> keywordList("");
|
||||
string keywordList;
|
||||
string keywordList2;
|
||||
if (pKwArray[LANG_INDEX_INSTR])
|
||||
{
|
||||
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR];
|
||||
wstring kwlW = pKwArray[LANG_INDEX_INSTR];
|
||||
keywordList = wstring2string(kwlW, CP_ACP);
|
||||
}
|
||||
|
||||
if (pKwArray[LANG_INDEX_INSTR2])
|
||||
{
|
||||
wstring kwlW = pKwArray[LANG_INDEX_INSTR2];
|
||||
keywordList2 = wstring2string(kwlW, CP_ACP);
|
||||
}
|
||||
|
||||
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR)));
|
||||
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList2, L_JSON, LANG_INDEX_INSTR2)));
|
||||
|
||||
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
|
||||
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0"));
|
||||
|
@ -203,6 +203,8 @@
|
||||
</Language>
|
||||
<Language name="json" ext="json" commentLine="" commentStart="" commentEnd="">
|
||||
<Keywords name="instre1">false null true</Keywords>
|
||||
<Keywords name="instre2">@id @context @type @value @language @container \
|
||||
@list @set @reverse @index @base @vocab @graph</Keywords>
|
||||
</Language>
|
||||
<Language name="jsp" ext="jsp" commentLine="//" commentStart="/*" commentEnd="*/"/>
|
||||
<Language name="kix" ext="kix" commentLine=";" commentStart="" commentEnd="">
|
||||
|
@ -625,12 +625,20 @@
|
||||
<WordsStyle name="COMMENT DOC KEYWORD ERROR" styleID="18" fgColor="008080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
</LexerType>
|
||||
<LexerType name="json" desc="JSON" ext="">
|
||||
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="NUMBER" styleID="4" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="STRING DOUBLE QUOTE" styleID="6" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="STRING SINGLE QUOTE" styleID="7" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="BOOLEAN NULL" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="instre1" />
|
||||
<WordsStyle name="OPERATOR" styleID="10" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="NUMBER" styleID="1" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="STRING" styleID="2" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="STRINGEOL" styleID="3" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="PROPERTYNAME" styleID="4" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="ESCAPESEQUENCE" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="LINECOMMENT" styleID="6" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="BLOCKCOMMENT" styleID="7" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="OPERATOR" styleID="8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="URI" styleID="9" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="COMPACTIRI" styleID="10" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="KEYWORD" styleID="11" fgColor="18AF8A" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="instre1"/>
|
||||
<WordsStyle name="LDKEYWORD" styleID="12" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" keywordClass="instre2" />
|
||||
<WordsStyle name="ERROR" styleID="13" fgColor="FFFF80" bgColor="FF0000" fontName="" fontStyle="0" fontSize="" />
|
||||
</LexerType>
|
||||
<LexerType name="kix" desc="KiXtart" ext="">
|
||||
<WordsStyle name="DEFAULT" styleID="31" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
|
Loading…
Reference in New Issue
Block a user