Honor emmet.excludeLanguages setting

This commit is contained in:
Ramya Achutha Rao
2017-06-22 07:06:45 -07:00
parent c4bd992b03
commit 9483e9fa6a
2 changed files with 13 additions and 5 deletions

View File

@@ -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);
});

View File

@@ -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) {