From 089f7d69354b9f80e694b3f3dfd48a52e4e40de4 Mon Sep 17 00:00:00 2001 From: mpheath Date: Mon, 9 Oct 2023 12:25:08 +1000 Subject: [PATCH] Make JSON5 to use JSON keywords Fix #14205, close #14223 --- PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 568adcb61..5ac755b1e 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -703,8 +703,7 @@ void ScintillaEditView::setEmbeddedJSLexer() void ScintillaEditView::setJsonLexer(bool isJson5) { - LangType j = isJson5 ? L_JSON5 : L_JSON; - setLexerFromLangID(j); + setLexerFromLangID(isJson5 ? L_JSON5 : L_JSON); const TCHAR *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; @@ -724,15 +723,15 @@ void ScintillaEditView::setJsonLexer(bool isJson5) keywordList2 = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 0, reinterpret_cast(getCompleteKeywordList(keywordList, j, LANG_INDEX_INSTR))); - execute(SCI_SETKEYWORDS, 1, reinterpret_cast(getCompleteKeywordList(keywordList2, j, LANG_INDEX_INSTR2))); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(getCompleteKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(getCompleteKeywordList(keywordList2, L_JSON, LANG_INDEX_INSTR2))); execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); execute(SCI_SETPROPERTY, reinterpret_cast("fold.compact"), reinterpret_cast("0")); execute(SCI_SETPROPERTY, reinterpret_cast("lexer.json.escape.sequence"), reinterpret_cast("1")); - if (j == L_JSON5) + if (isJson5) execute(SCI_SETPROPERTY, reinterpret_cast("lexer.json.allow.comments"), reinterpret_cast("1")); }