Skip to content

Commit

Permalink
Set js/json/css/ts file default indent and tab width to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenjoiner authored and zufuliu committed Jan 21, 2024
1 parent 226180b commit b4eb87b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/EditLexers/stlCSS.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ static EDITSTYLE Styles_CSS[] = {
EDITLEXER lexCSS = {
SCLEX_CSS, NP2LEX_CSS,
//Settings++Autogenerated -- start of section automatically generated
LexerAttr_Default,
TAB_WIDTH_4, INDENT_WIDTH_4,
LexerAttr_TabAsSpaces |
LexerAttr_NoGlobalTabSettings,
TAB_WIDTH_2, INDENT_WIDTH_2,
(1 << 0) | (1 << 1), // level1, level2
0,
'\\', SCE_CSS_ESCAPECHAR, 0,
Expand Down
5 changes: 3 additions & 2 deletions src/EditLexers/stlJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ static EDITSTYLE Styles_JSON[] = {
EDITLEXER lexJSON = {
SCLEX_JSON, NP2LEX_JSON,
//Settings++Autogenerated -- start of section automatically generated
LexerAttr_Default,
TAB_WIDTH_4, INDENT_WIDTH_4,
LexerAttr_TabAsSpaces |
LexerAttr_NoGlobalTabSettings,
TAB_WIDTH_2, INDENT_WIDTH_2,
(1 << 0) | (1 << 1) | (1 << 2) | (1 << 3), // level1, level2, level13, level4
0,
'\\', SCE_JSON_ESCAPECHAR, 0,
Expand Down
5 changes: 3 additions & 2 deletions src/EditLexers/stlJavaScript.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ static EDITSTYLE Styles_JS[] = {
EDITLEXER lexJavaScript = {
SCLEX_JAVASCRIPT, NP2LEX_JAVASCRIPT,
//Settings++Autogenerated -- start of section automatically generated
LexerAttr_Default,
TAB_WIDTH_4, INDENT_WIDTH_4,
LexerAttr_TabAsSpaces |
LexerAttr_NoGlobalTabSettings,
TAB_WIDTH_2, INDENT_WIDTH_2,
(1 << 0) | (1 << 1) | (1 << 2), // class, anonymous object, method
SCE_JS_FUNCTION_DEFINITION,
'\\', SCE_JS_ESCAPECHAR, 0,
Expand Down
4 changes: 3 additions & 1 deletion src/EditLexers/stlTypeScript.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ static EDITSTYLE Styles_TS[] = {
EDITLEXER lexTypeScript = {
SCLEX_JAVASCRIPT, NP2LEX_TYPESCRIPT,
//Settings++Autogenerated -- start of section automatically generated
LexerAttr_TabAsSpaces |
LexerAttr_NoGlobalTabSettings |
LexerAttr_AngleBracketGeneric,
TAB_WIDTH_4, INDENT_WIDTH_4,
TAB_WIDTH_2, INDENT_WIDTH_2,
(1 << 0) | (1 << 1) | (1 << 2), // class, anonymous object, method
SCE_JS_FUNCTION_DEFINITION,
'\\', SCE_JS_ESCAPECHAR, 0,
Expand Down
4 changes: 4 additions & 0 deletions tools/LexerConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ class KeywordAttr(IntFlag):
'string_style_range': ['SCE_CSHARP_CHARACTER', 'SCE_CSHARP_PREPROCESSOR_MESSAGE'],
},
'NP2LEX_CSS': {
'tab_settings': TabSettings_Space2,
'line_comment_string': ('', '//'),
'block_comment_string': ('/*', '*/'),
'comment_style_marker': 'SCE_CSS_CDO_CDC',
Expand Down Expand Up @@ -566,6 +567,7 @@ class KeywordAttr(IntFlag):
'string_style_range': ['SCE_JAVA_CHARACTER', 'SCE_JAVA_PLACEHOLDER'],
},
'NP2LEX_JAVASCRIPT': {
'tab_settings': TabSettings_Space2,
'cpp_style_comment': True,
'comment_style_marker': 'SCE_JS_TASKMARKER',
'shebang_exe_name': 'node',
Expand All @@ -578,6 +580,7 @@ class KeywordAttr(IntFlag):
'string_style_range': ['SCE_JSX_TEXT', 'SCE_JS_ESCAPECHAR'],
},
'NP2LEX_JSON': {
'tab_settings': TabSettings_Space2,
'cpp_style_comment': True,
'comment_style_list': ['SCE_JSON_LINECOMMENT', 'SCE_JSON_BLOCKCOMMENT'],
'default_fold_level': ['level1', 'level2', 'level13', 'level4'],
Expand Down Expand Up @@ -1001,6 +1004,7 @@ class KeywordAttr(IntFlag):
'string_style_range': ['SCE_TOML_STRING_SQ', 'SCE_TOML_ESCAPECHAR'],
},
'NP2LEX_TYPESCRIPT': {
'tab_settings': TabSettings_Space2,
'cpp_style_comment': True,
'comment_style_marker': 'SCE_JS_TASKMARKER',
'default_fold_level': ['class', 'anonymous object', 'method'],
Expand Down

0 comments on commit b4eb87b

Please sign in to comment.