Skip to content

Commit

Permalink
[JavaScript] Highlight .get(), .set(), .delete(), etc. as funct…
Browse files Browse the repository at this point in the history
…ion call instead of keyword.
  • Loading branch information
zufuliu committed May 12, 2024
1 parent cc6a5b6 commit 604b553
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion scintilla/lexers/LexJavaScript.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,13 @@ void ColouriseJsDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyl
} else if (StrEqualsAny(s, "return", "yield")) {
kwType = KeywordType::Return;
}
if (kwType > KeywordType::None && kwType < KeywordType::Return) {
if (chBefore == '.' || (kwType > KeywordType::None && kwType < KeywordType::Return)) {
const int chNext = sc.GetLineNextChar();
if (!(IsJsIdentifierStart(chNext) || chNext == '\\')) {
kwType = KeywordType::None;
if (chBefore == '.' && chNext == '(') {
sc.ChangeState(SCE_JS_FUNCTION);
}
}
}
} else if (keywordLists[KeywordIndex_FutureReservedWord].InList(s)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ std::string CodePretty(LPCEDITLEXER pLex, const char *styledText, size_t textLen
} else if ((stylePrev == SCE_CSS_AT_RULE && pLex->iLexer == SCLEX_CSS)
|| (stylePrev == SCE_JS_WORD && pLex->iLexer == SCLEX_JAVASCRIPT
&& (style <= SCE_JS_OPERATOR_PF || ch == '{' || ch == '[' || ch == '!' || ch == '~' || (ch == '(' && chPrev != 't')))) {
// not set(), get(); TODO: handle function(), delete()
// not set(), get();
spaceOption |= SpaceOption_SpaceBefore;
}
}
Expand Down

0 comments on commit 604b553

Please sign in to comment.