Skip to content

Fixes vscode #65464#46

Merged
rzhao271 merged 1 commit intomicrosoft:mainfrom
jeanp413:fix-vscode#65464
Feb 9, 2021
Merged

Fixes vscode #65464#46
rzhao271 merged 1 commit intomicrosoft:mainfrom
jeanp413:fix-vscode#65464

Conversation

@jeanp413
Copy link
Copy Markdown
Contributor

@jeanp413 jeanp413 commented Feb 8, 2021

Comment thread src/emmetHelper.ts
return false;
}
if (abbreviation.includes('#')) {
return hexColorRegex.test(abbreviation) || propertyHexColorRegex.test(abbreviation);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether propertyHexColorRegex should still show up. For example, bgc:#333 is valid (and expands to background-color: #333;).

Copy link
Copy Markdown
Contributor Author

@jeanp413 jeanp413 Feb 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are tests for that case and they still pass

const testCases: [string, string][] = [
['#1', '#111'],
['#ab', '#ababab'],
['#abc', '#abc'],
['c:#1', 'color: #111;'],
['c:#1a', 'color: #1a1a1a;'],
['bgc:1', 'background-color: 1px;'],
['c:#0.1', 'color: rgba(0, 0, 0, 0.1);']
];

Comment thread src/emmetHelper.ts
if (abbreviation.startsWith('#')) {
return hexColorRegex.test(abbreviation);
} else if (commonlyUsedTags.includes(abbreviation.substring(0, abbreviation.indexOf('#')))) {
return false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this case is for, considering we're in a if (isStyleSheet(syntax)) block

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rzhao271 The whole if (abbreviation.includes('#')) block was added as a fix for this microsoft/vscode#56082 where emmet completions would show for id selectors and that's not desired. propertyHexColorRegex regex is too restrictive causing expressions like bd1#s not being expanded so the fix is to not show completions only for id selectors of the form <element>#<id>

@rzhao271
Copy link
Copy Markdown
Contributor

rzhao271 commented Feb 9, 2021

Thanks again! Merging

@rzhao271 rzhao271 merged commit 73a2350 into microsoft:main Feb 9, 2021
@jeanp413 jeanp413 deleted the fix-vscode#65464 branch February 9, 2021 22:43
@rzhao271 rzhao271 added this to the February 2021 milestone Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emmet CSS # character

2 participants