mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
[typescript-language-features] Update importModuleSpecifierPreference values (#110536)
* Update importModuleSpecifierPreference values * -using * Add minimum version message
This commit is contained in:
@@ -660,32 +660,36 @@
|
||||
"javascript.preferences.importModuleSpecifier": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"auto",
|
||||
"shortest",
|
||||
"relative",
|
||||
"non-relative"
|
||||
"non-relative",
|
||||
"project-relative"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"%typescript.preferences.importModuleSpecifier.auto%",
|
||||
"%typescript.preferences.importModuleSpecifier.shortest%",
|
||||
"%typescript.preferences.importModuleSpecifier.relative%",
|
||||
"%typescript.preferences.importModuleSpecifier.nonRelative%"
|
||||
"%typescript.preferences.importModuleSpecifier.nonRelative%",
|
||||
"%typescript.preferences.importModuleSpecifier.projectRelative%"
|
||||
],
|
||||
"default": "auto",
|
||||
"default": "shortest",
|
||||
"description": "%typescript.preferences.importModuleSpecifier%",
|
||||
"scope": "resource"
|
||||
},
|
||||
"typescript.preferences.importModuleSpecifier": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"auto",
|
||||
"shortest",
|
||||
"relative",
|
||||
"non-relative"
|
||||
"non-relative",
|
||||
"project-relative"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"%typescript.preferences.importModuleSpecifier.auto%",
|
||||
"%typescript.preferences.importModuleSpecifier.shortest%",
|
||||
"%typescript.preferences.importModuleSpecifier.relative%",
|
||||
"%typescript.preferences.importModuleSpecifier.nonRelative%"
|
||||
"%typescript.preferences.importModuleSpecifier.nonRelative%",
|
||||
"%typescript.preferences.importModuleSpecifier.projectRelative%"
|
||||
],
|
||||
"default": "auto",
|
||||
"default": "shortest",
|
||||
"description": "%typescript.preferences.importModuleSpecifier%",
|
||||
"scope": "resource"
|
||||
},
|
||||
|
||||
@@ -73,9 +73,10 @@
|
||||
"typescript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for TypeScript files in the editor.",
|
||||
"typescript.preferences.quoteStyle": "Preferred quote style to use for quick fixes: `single` quotes, `double` quotes, or `auto` infer quote type from existing imports.",
|
||||
"typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports.",
|
||||
"typescript.preferences.importModuleSpecifier.auto": "Automatically select import path style. Prefers using a relative import if `baseUrl` is configured and the relative path has fewer segments than the non-relative import.",
|
||||
"typescript.preferences.importModuleSpecifier.relative": "Relative to the file location.",
|
||||
"typescript.preferences.importModuleSpecifier.nonRelative": "Based on the `baseUrl` configured in your `jsconfig.json` / `tsconfig.json`.",
|
||||
"typescript.preferences.importModuleSpecifier.shortest": "Prefers a non-relative import only if one is available that has fewer path segments than a relative import.",
|
||||
"typescript.preferences.importModuleSpecifier.relative": "Prefers a relative path to the imported file location.",
|
||||
"typescript.preferences.importModuleSpecifier.nonRelative": "Prefers a non-relative import based on the `baseUrl` or `paths` configured in your `jsconfig.json` / `tsconfig.json`.",
|
||||
"typescript.preferences.importModuleSpecifier.projectRelative": "Prefers a non-relative import only if the relative import path would leave the package or project directory. Requires using TypeScript 4.2+ in the workspace.",
|
||||
"typescript.preferences.importModuleSpecifierEnding": "Preferred path ending for auto imports.",
|
||||
"typescript.preferences.importModuleSpecifierEnding.auto": "Use project settings to select a default.",
|
||||
"typescript.preferences.importModuleSpecifierEnding.minimal": "Shorten `./component/index.js` to `./component`.",
|
||||
|
||||
@@ -568,7 +568,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider<
|
||||
type: response?.type ?? 'unknown',
|
||||
count: response?.type === 'response' && response.body ? response.body.entries.length : 0,
|
||||
updateGraphDurationMs: response?.type === 'response' ? response.performanceData?.updateGraphDurationMs : undefined,
|
||||
createAutoImportProviderProgramDurationMs: response?.type === 'response' ? (response.performanceData as Proto.PerformanceData & { createAutoImportProviderProgramDurationMs?: number })?.createAutoImportProviderProgramDurationMs : undefined,
|
||||
createAutoImportProviderProgramDurationMs: response?.type === 'response' ? response.performanceData?.createAutoImportProviderProgramDurationMs : undefined,
|
||||
includesPackageJsonImport: includesPackageJsonImport ? 'true' : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -175,6 +175,7 @@ export default class FileConfigurationManager extends Disposable {
|
||||
|
||||
const preferences: Proto.UserPreferences = {
|
||||
quotePreference: this.getQuoteStylePreference(preferencesConfig),
|
||||
// @ts-expect-error until TypeScript 4.2 API
|
||||
importModuleSpecifierPreference: getImportModuleSpecifierPreference(preferencesConfig),
|
||||
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(preferencesConfig),
|
||||
allowTextChangesInNewFiles: document.uri.scheme === fileSchemes.file,
|
||||
@@ -198,6 +199,7 @@ export default class FileConfigurationManager extends Disposable {
|
||||
|
||||
function getImportModuleSpecifierPreference(config: vscode.WorkspaceConfiguration) {
|
||||
switch (config.get<string>('importModuleSpecifier')) {
|
||||
case 'project-relative': return 'project-relative';
|
||||
case 'relative': return 'relative';
|
||||
case 'non-relative': return 'non-relative';
|
||||
default: return undefined;
|
||||
|
||||
Reference in New Issue
Block a user