Skip to content

Provide better UX when an invalid file is selected for 'move to file' refactoring #54283

Closed
@mjbvz

Description

@mjbvz

Bug Report

🔎 Search Terms

  • refactor
  • refactoring

🕗 Version & Regression Information

5.1.0-dev.20230509

Repo

  1. In VS code with the code:
const a = 1;
  1. Select the entire statement and run the move to file refactoring
  2. Select a invalid destination file (such as a .png)

bug
See the ugly error:

Debug Failure. Error: Debug Failure. at doChange4 (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:136348:36) at /Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:136336:77 at Function.with (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:165627:5) at Object.getRefactorEditsToMoveToFile [as getEditsForAction] (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:136336:60) at Object.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:135426:31) at
...

Instead we should show a better message that says something like:

Cannot move to file, selected file is invalid

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions