chore(vscode): update to 1.55.2
This commit is contained in:
@ -84,12 +84,11 @@
|
||||
"description": "%emmetExclude%"
|
||||
},
|
||||
"emmet.extensionsPath": {
|
||||
"type": [
|
||||
"string",
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": [],
|
||||
"description": "%emmetExtensionsPath%"
|
||||
},
|
||||
"emmet.triggerExpansionOnTab": {
|
||||
|
@ -28,7 +28,7 @@
|
||||
"emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.",
|
||||
"emmetShowExpandedAbbreviation": "Shows expanded Emmet abbreviations as suggestions.\nThe option `\"inMarkupAndStylesheetFilesOnly\"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `\"always\"` applies to all parts of the file regardless of markup/css.",
|
||||
"emmetShowAbbreviationSuggestions": "Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `\"never\"`.",
|
||||
"emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n E.g.: `{\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}`",
|
||||
"emmetIncludeLanguages": "Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and Emmet supported language.\n For example: `{\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}`",
|
||||
"emmetVariables": "Variables to be used in Emmet snippets",
|
||||
"emmetTriggerExpansionOnTab": "When enabled, Emmet abbreviations are expanded when pressing TAB.",
|
||||
"emmetPreferences": "Preferences used to modify behavior of some actions and resolvers of Emmet.",
|
||||
@ -54,7 +54,7 @@
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"emmetPreferencesOutputReverseAttributes": "If `true`, reverses attribute merging directions when resolving snippets.",
|
||||
"emmetPreferencesCssColorShort": "If `true`, color values like #f will be expanded to #fff instead of #ffffff."
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
@ -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 => {
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -2,17 +2,17 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@emmetio/abbreviation@^2.2.0", "@emmetio/abbreviation@^2.2.1":
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.2.1.tgz#d9458fe1f09fe042f019c48aa681165ba613a48d"
|
||||
integrity sha512-uUNwNgbH0JPlrdXhy8VQbNPLLG7abMvOaLVMblx22i68Rl9r+2N235ALgIYFUty1yXC9DkVw6xMbz/D4QVARcQ==
|
||||
"@emmetio/abbreviation@^2.2.0", "@emmetio/abbreviation@^2.2.2":
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.2.2.tgz#746762fd9e7a8c2ea604f580c62e3cfe250e6989"
|
||||
integrity sha512-TtE/dBnkTCct8+LntkqVrwqQao6EnPAs1YN3cUgxOxTaBlesBCY37ROUAVZrRlG64GNnVShdl/b70RfAI3w5lw==
|
||||
dependencies:
|
||||
"@emmetio/scanner" "^1.0.0"
|
||||
|
||||
"@emmetio/css-abbreviation@^2.1.2":
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@emmetio/css-abbreviation/-/css-abbreviation-2.1.2.tgz#4a5d96f2576dd827a2c1a060374ffa8a5408cc1c"
|
||||
integrity sha512-CvYTzJltVpLqJaCZ1Qn97LVAKsl2Uwl2fzir1EX/WuMY3xWxgc3BWRCheL6k65km6GyDrLVl6RhrrNb/pxOiAQ==
|
||||
"@emmetio/css-abbreviation@^2.1.4":
|
||||
version "2.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@emmetio/css-abbreviation/-/css-abbreviation-2.1.4.tgz#90362e8a1122ce3b76f6c3157907d30182f53f54"
|
||||
integrity sha512-qk9L60Y+uRtM5CPbB0y+QNl/1XKE09mSO+AhhSauIfr2YOx/ta3NJw2d8RtCFxgzHeRqFRr8jgyzThbu+MZ4Uw==
|
||||
dependencies:
|
||||
"@emmetio/scanner" "^1.0.0"
|
||||
|
||||
@ -54,17 +54,17 @@
|
||||
integrity sha1-Rs/+oRmgoAMxKiHC2bVijLX81EI=
|
||||
|
||||
"@types/node@^12.19.9":
|
||||
version "12.20.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.1.tgz#63d36c10e162666f0107f247cdca76542c3c7472"
|
||||
integrity sha512-tCkE96/ZTO+cWbln2xfyvd6ngHLanvVlJ3e5BeirJ3BYI5GbAyubIrmV4JjjugDly5D9fHjOL5MNsqsCnqwW6g==
|
||||
version "12.20.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.6.tgz#7b73cce37352936e628c5ba40326193443cfba25"
|
||||
integrity sha512-sRVq8d+ApGslmkE9e3i+D3gFGk7aZHAT+G4cIpIEdLJYPsWiSPwcAnJEjddLQQDqV3Ra2jOclX/Sv6YrvGYiWA==
|
||||
|
||||
emmet@^2.3.0:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/emmet/-/emmet-2.3.1.tgz#77614d949d1d01e5c248d08043a13a7f4d539e47"
|
||||
integrity sha512-u8h++9u3y9QWhn0imUXfQO+s80To5MGD97zd/00wGC39CfNGBPe//ZKepJz9I1LQ2FDRXHrn+e3JaN/53Y5z6A==
|
||||
version "2.3.4"
|
||||
resolved "https://registry.yarnpkg.com/emmet/-/emmet-2.3.4.tgz#5ba0d7a5569a68c7697dfa890c772e4f3179d123"
|
||||
integrity sha512-3IqSwmO+N2ZGeuhDyhV/TIOJFUbkChi53bcasSNRE7Yd+4eorbbYz4e53TpMECt38NtYkZNupQCZRlwdAYA42A==
|
||||
dependencies:
|
||||
"@emmetio/abbreviation" "^2.2.1"
|
||||
"@emmetio/css-abbreviation" "^2.1.2"
|
||||
"@emmetio/abbreviation" "^2.2.2"
|
||||
"@emmetio/css-abbreviation" "^2.1.4"
|
||||
|
||||
image-size@^0.5.2:
|
||||
version "0.5.5"
|
||||
@ -77,9 +77,9 @@ jsonc-parser@^2.3.0:
|
||||
integrity sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==
|
||||
|
||||
vscode-emmet-helper@^2.3.0:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-2.3.2.tgz#7f73cd579eef187a4456dc71768fb2237f47fbd4"
|
||||
integrity sha512-uulOziI/5Ml+AyfHwgkZDXlGZsu9yNcfwZgOfRSPokc6lqYEoGK+/u902LH8Xaf68dhPLctJlhhGYwDJuqoGxg==
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-2.4.2.tgz#98dc3275a22668f0e0ef9f2ee1fa76653d71e78f"
|
||||
integrity sha512-j6N6xBn0NOigk2RYWESFlsnMQNJm5B10UUgOeHxRpm66Kck9Bq1nxwy6qT9eqKvzxz4hpC29Xv4aPGlOzsKw3w==
|
||||
dependencies:
|
||||
emmet "^2.3.0"
|
||||
jsonc-parser "^2.3.0"
|
||||
|
Reference in New Issue
Block a user