Fix detection of CSS Preprocessor Comments at Start of File in Emmet Extension (#146121)

* Fix for PartialStyleSheet getting stuck in loop

Adds a clause for detecting `//` as a comment marker when working backwards through a file, preventing the parser from getting stuck when the comment starts at 1:1

* Modify change to detect start of file instead of skipping additional `/` characters now that we know the issue only occurs at offset 0.

Co-authored-by: Tyler McEnaney <tharbakim@hotmail.com>
This commit is contained in:
tharbakim
2022-04-04 12:02:15 -07:00
committed by GitHub
parent 8d14b36935
commit fb5e446a3d

View File

@@ -226,7 +226,7 @@ export function parsePartialStylesheet(document: vscode.TextDocument, position:
}
function consumeBlockCommentBackwards() {
if (stream.peek() === slash) {
if (!stream.sof() && stream.peek() === slash) {
if (stream.backUp(1) === star) {
stream.pos = findOpeningCommentBeforePosition(stream.pos) ?? startOffset;
} else {