Emmet: Change the type of emmet extensions path (#117946)
* Emmet: change extensionsPath input type to string[] * Emmet: add migration function for old config
This commit is contained in:
parent
cc5db25823
commit
975dfff6db
|
@ -84,12 +84,11 @@
|
|||
"description": "%emmetExclude%"
|
||||
},
|
||||
"emmet.extensionsPath": {
|
||||
"type": [
|
||||
"string",
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"default": null,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": [],
|
||||
"description": "%emmetExtensionsPath%"
|
||||
},
|
||||
"emmet.triggerExpansionOnTab": {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -49,6 +49,34 @@ export function updateEmmetExtensionsPath(forceRefresh: boolean = false) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue