Archived
1
0

chore(vscode): update to 1.55.2

This commit is contained in:
Akash Satheesan
2021-04-09 11:32:27 +05:30
1102 changed files with 39988 additions and 23544 deletions

View File

@ -377,6 +377,11 @@ export function expandEmmetAbbreviation(args: any): Thenable<boolean | undefined
if (!helper.isAbbreviationValid(syntax, abbreviation)) {
return;
}
if (isStyleSheet(syntax) && abbreviation.endsWith(':')) {
// Fix for https://github.com/Microsoft/vscode/issues/1623
return;
}
const offset = editor.document.offsetAt(position);
let currentNode = getFlatNode(getRootNode(), offset, true);
let validateLocation = true;
@ -440,10 +445,18 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
return true;
}
// Get the abbreviation right now
// Fixes https://github.com/microsoft/vscode/issues/74505
// Stylesheet abbreviations starting with @ should bring up suggestions
// even at outer-most level
const abbreviation = document.getText(new vscode.Range(abbreviationRange.start.line, abbreviationRange.start.character, abbreviationRange.end.line, abbreviationRange.end.character));
if (abbreviation.startsWith('@')) {
return true;
}
// Fix for https://github.com/microsoft/vscode/issues/34162
// Other than sass, stylus, we can make use of the terminator tokens to validate position
if (syntax !== 'sass' && syntax !== 'stylus' && currentNode.type === 'property') {
// Fix for upstream issue https://github.com/emmetio/css-parser/issues/3
if (currentNode.parent
&& currentNode.parent.type !== 'rule'
@ -451,7 +464,6 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
return false;
}
const abbreviation = document.getText(new vscode.Range(abbreviationRange.start.line, abbreviationRange.start.character, abbreviationRange.end.line, abbreviationRange.end.character));
const propertyNode = <Property>currentNode;
if (propertyNode.terminatorToken
&& propertyNode.separator

View File

@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import { Node, Stylesheet } from 'EmmetFlatNode';
import { isValidLocationForEmmetAbbreviation, getSyntaxFromArgs } from './abbreviationActions';
import { getEmmetHelper, getMappingForIncludedLanguages, parsePartialStylesheet, getEmmetConfiguration, getEmmetMode, isStyleSheet, getFlatNode, allowedMimeTypesInScriptTag, toLSTextDocument, getHtmlFlatNode } from './util';
import { getEmmetHelper, getMappingForIncludedLanguages, parsePartialStylesheet, getEmmetConfiguration, getEmmetMode, isStyleSheet, getFlatNode, allowedMimeTypesInScriptTag, toLSTextDocument, getHtmlFlatNode, getEmbeddedCssNodeIfAny } from './util';
import { Range as LSRange } from 'vscode-languageserver-textdocument';
import { getRootNode } from './parseDocument';
@ -67,7 +67,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
const lsDoc = toLSTextDocument(document);
position = document.validatePosition(position);
if (document.languageId === 'html') {
if (syntax === 'html') {
if (context.triggerKind === vscode.CompletionTriggerKind.TriggerForIncompleteCompletions) {
switch (this.lastCompletionType) {
case 'html':
@ -137,6 +137,20 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
currentNode = getFlatNode(rootNode, offset, true);
}
// Fix for https://github.com/microsoft/vscode/issues/107578
// Validate location if syntax is of styleSheet type to ensure that location is valid for emmet abbreviation.
// For an html document containing a <style> node, compute the embeddedCssNode and fetch the flattened node as currentNode.
if (!isStyleSheet(document.languageId) && isStyleSheet(syntax) && context.triggerKind !== vscode.CompletionTriggerKind.TriggerForIncompleteCompletions) {
validateLocation = true;
rootNode = getRootNode(document, true);
if (!rootNode) {
return;
}
let flatNode = getFlatNode(rootNode, offset, true);
let embeddedCssNode = getEmbeddedCssNodeIfAny(document, flatNode, position);
currentNode = getFlatNode(embeddedCssNode, offset, true);
}
if (validateLocation && !isValidLocationForEmmetAbbreviation(document, rootNode, currentNode, syntax, offset, toRange(extractAbbreviationResults.abbreviationRange))) {
return;
}

View File

@ -17,11 +17,12 @@ import { fetchEditPoint } from './editPoint';
import { fetchSelectItem } from './selectItem';
import { evaluateMathExpression } from './evaluateMathExpression';
import { incrementDecrement } from './incrementDecrement';
import { LANGUAGE_MODES, getMappingForIncludedLanguages, updateEmmetExtensionsPath, getPathBaseName, getSyntaxes, getEmmetMode } from './util';
import { LANGUAGE_MODES, getMappingForIncludedLanguages, updateEmmetExtensionsPath, migrateEmmetExtensionsPath, getPathBaseName, getSyntaxes, getEmmetMode } from './util';
import { reflectCssValue } from './reflectCssValue';
import { addFileToParseCache, removeFileFromParseCache } from './parseDocument';
export function activateEmmetExtension(context: vscode.ExtensionContext) {
migrateEmmetExtensionsPath();
registerCompletionProviders(context);
updateEmmetExtensionsPath();

View File

@ -8,7 +8,7 @@ const testRunner = require('../../../../test/integration/electron/testrunner');
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
@ -38,34 +38,3 @@ if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
testRunner.configure(options);
export = testRunner;
// import * as path from 'path';
// import * as Mocha from 'mocha';
// import * as glob from 'glob';
// export function run(testsRoot: string, cb: (error: any, failures?: number) => void): void {
// // Create the mocha test
// const mocha = new Mocha({
// ui: 'tdd'
// });
// mocha.useColors(true);
// glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
// if (err) {
// return cb(err);
// }
// // Add files to the test suite
// files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
// try {
// // Run the mocha test
// mocha.run(failures => {
// cb(null, failures);
// });
// } catch (err) {
// console.error(err);
// cb(err);
// }
// });
// }

View File

@ -60,7 +60,7 @@ p {
/* .foo { op.3
dn {
*/
@
bgc
} bg
`;
return withRandomFileEditor(sassContents, '.scss', (_, doc) => {
@ -69,7 +69,7 @@ dn {
new vscode.Range(2, 3, 2, 7), // Line commented selector
new vscode.Range(3, 3, 3, 7), // Block commented selector
new vscode.Range(4, 0, 4, 2), // dn inside block comment
new vscode.Range(6, 1, 6, 2), // @ inside a rule whose opening brace is commented
new vscode.Range(6, 1, 6, 2), // bgc inside a rule whose opening brace is commented
new vscode.Range(7, 2, 7, 4) // bg after ending of badly constructed block
];
rangesNotEmmet.forEach(range => {

View File

@ -13,7 +13,7 @@ import { TextDocument as LSTextDocument } from 'vscode-languageserver-textdocume
import { getRootNode } from './parseDocument';
let _emmetHelper: typeof EmmetHelper;
let _currentExtensionsPath: string | undefined = undefined;
let _currentExtensionsPath: string[] | undefined;
let _homeDir: vscode.Uri | undefined;
@ -36,7 +36,10 @@ export function getEmmetHelper() {
*/
export function updateEmmetExtensionsPath(forceRefresh: boolean = false) {
const helper = getEmmetHelper();
let extensionsPath = vscode.workspace.getConfiguration('emmet')['extensionsPath'];
let extensionsPath = vscode.workspace.getConfiguration('emmet').get<string[]>('extensionsPath');
if (!extensionsPath) {
extensionsPath = [];
}
if (forceRefresh || _currentExtensionsPath !== extensionsPath) {
_currentExtensionsPath = extensionsPath;
if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
@ -44,11 +47,43 @@ export function updateEmmetExtensionsPath(forceRefresh: boolean = false) {
} else {
const rootPath = vscode.workspace.workspaceFolders[0].uri;
const fileSystem = vscode.workspace.fs;
helper.updateExtensionsPath(extensionsPath, fileSystem, rootPath, _homeDir).catch(err => vscode.window.showErrorMessage(err.message));
helper.updateExtensionsPath(extensionsPath, fileSystem, rootPath, _homeDir).catch(err => {
if (Array.isArray(extensionsPath) && extensionsPath.length) {
vscode.window.showErrorMessage(err.message);
}
});
}
}
}
/**
* Migrate old configuration(string) for extensionsPath to new type(string[])
* https://github.com/microsoft/vscode/issues/117517
*/
export function migrateEmmetExtensionsPath() {
// Get the detail info of emmet.extensionsPath setting
let config = vscode.workspace.getConfiguration().inspect('emmet.extensionsPath');
// Update Global setting if the value type is string or the value is null
if (typeof config?.globalValue === 'string') {
vscode.workspace.getConfiguration().update('emmet.extensionsPath', [config.globalValue], true);
} else if (config?.globalValue === null) {
vscode.workspace.getConfiguration().update('emmet.extensionsPath', [], true);
}
// Update Workspace setting if the value type is string or the value is null
if (typeof config?.workspaceValue === 'string') {
vscode.workspace.getConfiguration().update('emmet.extensionsPath', [config.workspaceValue], false);
} else if (config?.workspaceValue === null) {
vscode.workspace.getConfiguration().update('emmet.extensionsPath', [], false);
}
// Update WorkspaceFolder setting if the value type is string or the value is null
if (typeof config?.workspaceFolderValue === 'string') {
vscode.workspace.getConfiguration().update('emmet.extensionsPath', [config.workspaceFolderValue]);
} else if (config?.workspaceFolderValue === null) {
vscode.workspace.getConfiguration().update('emmet.extensionsPath', []);
}
}
/**
* Mapping between languages that support Emmet and completion trigger characters
*/