From 15434fe1602d229f05f99f66cfa882811b5a4cbc Mon Sep 17 00:00:00 2001 From: Roy-Orbison Date: Wed, 15 Jun 2022 11:21:49 +0930 Subject: [PATCH] SCSS: remove punctuation from classes & identifiers Prevent appended pseudos as well. This should make the tags file output more consistent with other language parsers, where the identifiers are more important than the delimiters that denote their types. This aids completion in existing tools and across languages (like HTML) where the delimiters are not used. Closes #3409 --- Units/parser-scss.r/placeholder.d/expected.tags | 12 ++++++------ Units/parser-scss.r/selectors.d/expected.tags | 8 ++++---- Units/parser-scss.r/variable.d/expected.tags | 4 ++-- optlib/scss.c | 6 +++--- optlib/scss.ctags | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Units/parser-scss.r/placeholder.d/expected.tags b/Units/parser-scss.r/placeholder.d/expected.tags index 9d50138292..d51f622a03 100644 --- a/Units/parser-scss.r/placeholder.d/expected.tags +++ b/Units/parser-scss.r/placeholder.d/expected.tags @@ -1,6 +1,6 @@ -.alert:hover input.scss /^.alert:hover, %strong-alert {$/;" c -%strong-alert input.scss /^.alert:hover, %strong-alert {$/;" P -%strong-alert:hover input.scss /^%strong-alert:hover {$/;" P -%toolbelt input.scss /^%toolbelt {$/;" P -.action-buttons input.scss /^.action-buttons {$/;" c -.reset-buttons input.scss /^.reset-buttons {$/;" c +alert input.scss /^.alert:hover, %strong-alert {$/;" c +strong-alert input.scss /^.alert:hover, %strong-alert {$/;" P +strong-alert input.scss /^%strong-alert:hover {$/;" P +toolbelt input.scss /^%toolbelt {$/;" P +action-buttons input.scss /^.action-buttons {$/;" c +reset-buttons input.scss /^.reset-buttons {$/;" c diff --git a/Units/parser-scss.r/selectors.d/expected.tags b/Units/parser-scss.r/selectors.d/expected.tags index aa7ff380d4..3a387f9bd0 100644 --- a/Units/parser-scss.r/selectors.d/expected.tags +++ b/Units/parser-scss.r/selectors.d/expected.tags @@ -1,5 +1,5 @@ -.alert input.scss /^.alert, .warning {$/;" c -.warning input.scss /^.alert, .warning {$/;" c -.modal-open input.scss /^.modal-open {$/;" c -.modal input.scss /^ .modal {$/;" c +alert input.scss /^.alert, .warning {$/;" c +warning input.scss /^.alert, .warning {$/;" c +modal-open input.scss /^.modal-open {$/;" c +modal input.scss /^ .modal {$/;" c foo input.scss /^ #foo {$/;" i diff --git a/Units/parser-scss.r/variable.d/expected.tags b/Units/parser-scss.r/variable.d/expected.tags index 0ff308dccf..f2c1c96cdb 100644 --- a/Units/parser-scss.r/variable.d/expected.tags +++ b/Units/parser-scss.r/variable.d/expected.tags @@ -1,7 +1,7 @@ base-color input.scss /^$base-color: #c6538c;$/;" v border-dark input.scss /^$border-dark: rgba($base-color, 0.88);$/;" v -.alert input.scss /^.alert {$/;" c +alert input.scss /^.alert {$/;" c i input.scss /^@for $i from 1 through 3 {$/;" v sizes input.scss /^$sizes: 40px, 50px, 80px;$/;" v size input.scss /^@each $size in $sizes {$/;" v -.icon- input.scss /^ .icon-#{$size} {$/;" c +icon- input.scss /^ .icon-#{$size} {$/;" c diff --git a/optlib/scss.c b/optlib/scss.c index 5dddee3d5f..8c64dd1a59 100644 --- a/optlib/scss.c +++ b/optlib/scss.c @@ -71,13 +71,13 @@ static void initializeSCSSParser (const langType language) "^\\$([A-Za-z0-9_-]+)[ \t]*:[^\n]*\n?", "\\1", "v", "", NULL); addLanguageTagMultiTableRegex (language, "toplevel", - "^([.][A-Za-z0-9_:-]+)", + "^[.]([A-Za-z0-9_-]+)", "\\1", "c", "", NULL); addLanguageTagMultiTableRegex (language, "toplevel", - "^(%[A-Za-z0-9_:-]+)", + "^%([A-Za-z0-9_-]+)", "\\1", "P", "", NULL); addLanguageTagMultiTableRegex (language, "toplevel", - "^#([A-Za-z0-9_:-]+)", + "^#([A-Za-z0-9_-]+)", "\\1", "i", "", NULL); addLanguageTagMultiTableRegex (language, "toplevel", "^.", diff --git a/optlib/scss.ctags b/optlib/scss.ctags index 677fe20439..3ba416eb79 100644 --- a/optlib/scss.ctags +++ b/optlib/scss.ctags @@ -59,9 +59,9 @@ --_mtable-regex-SCSS=toplevel/:[^\n{]+[;{]\n?// --_mtable-regex-SCSS=toplevel/\$([A-Za-z0-9_-]+)[ \t]*:[ \t]*\(/\1/v/{tenter=map} --_mtable-regex-SCSS=toplevel/\$([A-Za-z0-9_-]+)[ \t]*:[^\n]*\n?/\1/v/ ---_mtable-regex-SCSS=toplevel/([.][A-Za-z0-9_:-]+)/\1/c/ ---_mtable-regex-SCSS=toplevel/(%[A-Za-z0-9_:-]+)/\1/P/ ---_mtable-regex-SCSS=toplevel/#([A-Za-z0-9_:-]+)/\1/i/ +--_mtable-regex-SCSS=toplevel/[.]([A-Za-z0-9_-]+)/\1/c/ +--_mtable-regex-SCSS=toplevel/%([A-Za-z0-9_-]+)/\1/P/ +--_mtable-regex-SCSS=toplevel/#([A-Za-z0-9_-]+)/\1/i/ --_mtable-regex-SCSS=toplevel/.// --_mtable-regex-SCSS=comment/\*\///{tleave} --_mtable-regex-SCSS=comment/.//