Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #93589: Rename 'renameShorthandProperties' setting to 'useAliasesForRenames' #94480

Merged
merged 3 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions extensions/typescript-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -674,16 +674,16 @@
"description": "%typescript.preferences.importModuleSpecifierEnding%",
"scope": "resource"
},
"javascript.preferences.renameShorthandProperties": {
"javascript.preferences.useAliasesForRenames": {
"type": "boolean",
"default": true,
"description": "%typescript.preferences.renameShorthandProperties%",
"description": "%typescript.preferences.useAliasesForRenames%",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of renaming this property, create a copy of it and than mark renameShorthandProperties with a deprecated message that points to the new property

"scope": "resource"
},
"typescript.preferences.renameShorthandProperties": {
"typescript.preferences.useAliasesForRenames": {
"type": "boolean",
"default": true,
"description": "%typescript.preferences.renameShorthandProperties%",
"description": "%typescript.preferences.useAliasesForRenames%",
"scope": "resource"
},
"typescript.updateImportsOnFileMove.enabled": {
Expand Down
2 changes: 1 addition & 1 deletion extensions/typescript-language-features/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval": "Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.",
"configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling ": "Use a dynamic queue where less-frequently modified files will be checked less often.",
"configuration.tsserver.watchOptions.synchronousWatchDirectory": "Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in node_modules from running npm install), but you might want to disable it with this flag for some less-common setups.",
"typescript.preferences.renameShorthandProperties": "Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace.",
"typescript.preferences.useAliasesForRenames": "Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace.",
"codeActions.refactor.extract.constant.title": "Extract constant",
"codeActions.refactor.extract.constant.description": "Extract expression to constant.",
"codeActions.refactor.extract.function.title": "Extract function",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default class FileConfigurationManager extends Disposable {
importModuleSpecifierPreference: getImportModuleSpecifierPreference(config),
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config),
allowTextChangesInNewFiles: document.uri.scheme === fileSchemes.file,
providePrefixAndSuffixTextForRename: config.get<boolean>('renameShorthandProperties', true),
providePrefixAndSuffixTextForRename: config.get<boolean>('useAliasesForRenames', true),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should read both the old and new setting value for migration

Copy link
Contributor Author

@swiz115 swiz115 Apr 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you guidance! This was an attempt at my first PR. I'll update this soon and keep this in mind with my future contributions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we remove the deprecated setting, we should make sure we respect previous setting value. Something like:

config.get<boolean>('renameShorthandProperties', true) === false ? false : config.get<boolean>('useAliasesForRenames', true)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize. Not sure how I missed this in the previous attempt at fixing my first commit.

allowRenameOfImportPath: true,
};

Expand Down