Stylesheet partial parse (#46376)

* First draft at partial parsing of css for emmet

* Partial parsing of stylesheets for Emmet

* Addressing feedback

* Refactoring and fixing little bug

* Liitle fix

* Equals are now equals

* We don't want emmet in selectors

* Skip comments when preparsing

* Addressing feedback, refactoring and cleaning up code.

* Update endPosition only if not eof

* Use function to find closing comment

* Don't check more than 5000 characters back
This commit is contained in:
Gus Hurovich
2018-03-26 18:14:28 -07:00
committed by Ramya Rao
parent c05e57d91e
commit 91416ffab8
2 changed files with 101 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import { Node } from 'EmmetNode';
import { isValidLocationForEmmetAbbreviation } from './abbreviationActions';
import { getEmmetHelper, getNode, getMappingForIncludedLanguages, parseDocument, getEmmetConfiguration, getEmmetMode, isStyleSheet } from './util';
import { getEmmetHelper, getNode, getMappingForIncludedLanguages, parsePartialStylesheet, getEmmetConfiguration, getEmmetMode, isStyleSheet, parseDocument } from './util';
export class DefaultCompletionItemProvider implements vscode.CompletionItemProvider {
@@ -40,7 +40,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
validateLocation = syntax === 'html' || isStyleSheet(document.languageId);
// If document can be css parsed, get currentNode
if (isStyleSheet(document.languageId)) {
const rootNode = parseDocument(document, false);
const rootNode = document.lineCount > 1000 ? parsePartialStylesheet(document, position) : parseDocument(document, false);
if (!rootNode) {
return;
}