Get emmet completions from css extension (#41652)

* Get emmet completions from html,css extensions

* Resolve extensionsPath, use emmet results even if empty

* Support css abbr with :

* Refactoring

* Add some basic emmet tests

* Refactoring

* More tests
This commit is contained in:
Ramya Rao
2018-02-12 21:40:10 -08:00
committed by GitHub
parent 4d12201733
commit 00f2d8ed71
26 changed files with 415 additions and 116 deletions

View File

@@ -8,7 +8,6 @@ import parse from '@emmetio/html-matcher';
import parseStylesheet from '@emmetio/css-parser';
import { Node, HtmlNode, CssToken, Property, Rule } from 'EmmetNode';
import { DocumentStreamReader } from './bufferStream';
import * as path from 'path';
let _emmetHelper: any;
let _currentExtensionsPath: string | undefined = undefined;
@@ -26,17 +25,9 @@ export function resolveUpdateExtensionsPath() {
return;
}
let extensionsPath = vscode.workspace.getConfiguration('emmet')['extensionsPath'];
if (extensionsPath && !path.isAbsolute(extensionsPath)) {
extensionsPath = path.join(vscode.workspace.rootPath || '', extensionsPath);
}
if (_currentExtensionsPath !== extensionsPath) {
_currentExtensionsPath = extensionsPath;
if (_currentExtensionsPath && !path.isAbsolute(_currentExtensionsPath)) {
vscode.window.showErrorMessage('The path provided in emmet.extensionsPath setting should be absolute path');
_emmetHelper.updateExtensionsPath();
return;
}
_emmetHelper.updateExtensionsPath(_currentExtensionsPath).then(null, (err: string) => vscode.window.showErrorMessage(err));
_emmetHelper.updateExtensionsPath(extensionsPath, vscode.workspace.rootPath).then(null, (err: string) => vscode.window.showErrorMessage(err));
}
}
@@ -63,7 +54,6 @@ const emmetModes = ['html', 'pug', 'slim', 'haml', 'xml', 'xsl', 'jsx', 'css', '
// For other languages, users will have to use `emmet.includeLanguages` or
// language specific extensions can provide emmet completion support
export const MAPPED_MODES: Object = {
'handlebars': 'html',
'php': 'html'
};