mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Adding setting for disabling partial parsing in stylesheets (#46979)
* Adding setting for disabling partial parsing in stylesheets * Added description
This commit is contained in:
parent
ea90500f5f
commit
1b4886dda9
|
@ -211,6 +211,11 @@
|
|||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%emmetShowSuggestionsAsSnippets%"
|
||||
},
|
||||
"emmet.optimizeStylesheetParsing": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "%emmetOptimizeStylesheetParsing%"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -53,5 +53,6 @@
|
|||
"emmetPreferencesCssMozProperties": "Comma separated CSS properties that get the 'moz' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'moz' prefix.",
|
||||
"emmetPreferencesCssOProperties": "Comma separated CSS properties that get the 'o' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'o' prefix.",
|
||||
"emmetPreferencesCssMsProperties": "Comma separated CSS properties that get the 'ms' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'ms' prefix.",
|
||||
"emmetPreferencesCssFuzzySearchMinScore": "The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches."
|
||||
"emmetPreferencesCssFuzzySearchMinScore": "The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.",
|
||||
"emmetOptimizeStylesheetParsing": "When set to false, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to true, only the content around the current position in css/scss/less files is parsed."
|
||||
}
|
||||
|
|
|
@ -228,7 +228,8 @@ export function expandEmmetAbbreviation(args: any): Thenable<boolean | undefined
|
|||
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
let rootNode: Node | undefined;
|
||||
if (editor.selections.length === 1 && isStyleSheet(editor.document.languageId) && editor.document.lineCount > 1000) {
|
||||
let usePartialParsing = vscode.workspace.getConfiguration('emmet')['optimizeStylesheetParsing'] === true;
|
||||
if (editor.selections.length === 1 && isStyleSheet(editor.document.languageId) && usePartialParsing && editor.document.lineCount > 1000) {
|
||||
rootNode = parsePartialStylesheet(editor.document, editor.selection.isReversed ? editor.selection.anchor : editor.selection.active);
|
||||
} else {
|
||||
rootNode = parseDocument(editor.document, false);
|
||||
|
|
|
@ -40,7 +40,8 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
|
|||
validateLocation = syntax === 'html' || isStyleSheet(document.languageId);
|
||||
// If document can be css parsed, get currentNode
|
||||
if (isStyleSheet(document.languageId)) {
|
||||
rootNode = document.lineCount > 1000 ? parsePartialStylesheet(document, position) : <Stylesheet>parseDocument(document, false);
|
||||
let usePartialParsing = vscode.workspace.getConfiguration('emmet')['optimizeStylesheetParsing'] === true;
|
||||
rootNode = usePartialParsing && document.lineCount > 1000 ? parsePartialStylesheet(document, position) : <Stylesheet>parseDocument(document, false);
|
||||
if (!rootNode) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue