-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for parsing more than one filter suffix. #17
Conversation
@ramya-rao-a would you take a look? |
src/emmetHelper.ts
Outdated
@@ -27,6 +27,7 @@ const bemFilterSuffix = 'bem'; | |||
const filterDelimitor = '|'; | |||
const trimFilterSuffix = 't'; | |||
const commentFilterSuffix = 'c'; | |||
const differentFilters = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to maxFilters
src/emmetHelper.ts
Outdated
expandedAbbr.label = abbreviation + filterDelimitor + (filter === 'bem' ? bemFilterSuffix : commentFilterSuffix); | ||
} | ||
expandedAbbr.label = abbreviation; | ||
expandedAbbr.label += filter ? '|' + filter.replace(', ', '|') : ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not use the space along with the comma as separator
src/emmetHelper.ts
Outdated
lengthOccupiedByFilter = 2; | ||
pos -= lengthOccupiedByFilter; | ||
filter = commentFilterSuffix; | ||
for (let i = 0; i < differentFilters; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole logic is being repeated twice. It would be good to have this in a separate function which returns an object with pos
and filter
. lengthOccupiedByFilter
can then be calculated as filter.length
+ 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, works well
I've a left a few comments, take a look
Added support to expand abbreviations with several suffixes (see microsoft/vscode#35984 )
Example input:
(Or, equivalently, ending with
|c|bem
)Example output: