From 1a22372358fee421d97975b3307de810f032420a Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Fri, 21 Aug 2020 23:19:45 +0800 Subject: [PATCH] support useAliasesForRenames configuration Closes #196 --- package.json | 12 ++++++++++++ src/server/features/fileConfigurationManager.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b1d8fc0..c2cdd1d 100644 --- a/package.json +++ b/package.json @@ -298,6 +298,12 @@ "double" ] }, + "typescript.preferences.useAliasesForRenames": { + "type": "boolean", + "default": true, + "description": "Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace.", + "scope": "resource" + }, "typescript.suggestionActions.enabled": { "type": "boolean", "default": true, @@ -466,6 +472,12 @@ "double" ] }, + "javascript.preferences.useAliasesForRenames": { + "type": "boolean", + "default": true, + "description": "Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace.", + "scope": "resource" + }, "javascript.validate.enable": { "type": "boolean", "default": true, diff --git a/src/server/features/fileConfigurationManager.ts b/src/server/features/fileConfigurationManager.ts index dbd585f..6cd6d87 100644 --- a/src/server/features/fileConfigurationManager.ts +++ b/src/server/features/fileConfigurationManager.ts @@ -154,7 +154,7 @@ export default class FileConfigurationManager { importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config), allowTextChangesInNewFiles: uri.startsWith('file:'), allowRenameOfImportPath: true, - providePrefixAndSuffixTextForRename: true, + providePrefixAndSuffixTextForRename: config.get('renameShorthandProperties', true) === false ? false : config.get('useAliasesForRenames', true), } return preferences }