mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Honor emmet.excludeLanguages setting
This commit is contained in:
@@ -17,12 +17,16 @@ import { fetchEditPoint } from './editPoint';
|
||||
import { fetchSelectItem } from './selectItem';
|
||||
import { evaluateMathExpression } from './evaluateMathExpression';
|
||||
import { incrementDecrement } from './incrementDecrement';
|
||||
import { LANGUAGE_MODES, getMappedModes } from './util';
|
||||
import { LANGUAGE_MODES, getMappedModes, getExcludedModes } from './util';
|
||||
import { updateExtensionsPath } from 'vscode-emmet-helper';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
let completionProvider = new DefaultCompletionItemProvider();
|
||||
let exlcludedLanguages = getExcludedModes();
|
||||
Object.keys(LANGUAGE_MODES).forEach(language => {
|
||||
if (exlcludedLanguages.indexOf(language) > -1) {
|
||||
return;
|
||||
}
|
||||
const provider = vscode.languages.registerCompletionItemProvider(language, completionProvider, ...LANGUAGE_MODES[language]);
|
||||
context.subscriptions.push(provider);
|
||||
});
|
||||
|
||||
@@ -58,11 +58,15 @@ export function getMappedModes(): any {
|
||||
return finalMappedModes;
|
||||
}
|
||||
|
||||
export function getExcludedModes(): string[] {
|
||||
let excludedConfig = vscode.workspace.getConfiguration('emmet')['excludeLanguages'];
|
||||
return Array.isArray(excludedConfig) ? excludedConfig : [];
|
||||
}
|
||||
/**
|
||||
* Returns node corresponding to given position in the given root node
|
||||
* @param root
|
||||
* @param position
|
||||
* @param includeNodeBoundary
|
||||
* @param root
|
||||
* @param position
|
||||
* @param includeNodeBoundary
|
||||
*/
|
||||
export function getNode(root: Node, position: vscode.Position, includeNodeBoundary: boolean = false) {
|
||||
let currentNode: Node = root.firstChild;
|
||||
@@ -87,7 +91,7 @@ export function getNode(root: Node, position: vscode.Position, includeNodeBounda
|
||||
|
||||
/**
|
||||
* Returns inner range of an html node.
|
||||
* @param currentNode
|
||||
* @param currentNode
|
||||
*/
|
||||
export function getInnerRange(currentNode: Node): vscode.Range {
|
||||
if (!currentNode.close) {
|
||||
|
||||
Reference in New Issue
Block a user