Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd 'renameFile' command to services #23573
Conversation
|
//cc @mjbvz |
|
We also need to consider |
|
Ok, I think this flow makes sense and the api looks good. We may also need an api to check if any renames are necessary so we can avoid prompting the user in cases with loose files |
| @@ -63,6 +63,7 @@ | |||
| "navigateTo.ts", | |||
| "navigationBar.ts", | |||
| "organizeImports.ts", | |||
| "../services/renameFile.ts", | |||
mhegazy
Apr 20, 2018
jsut renameFile.ts
jsut renameFile.ts
| @@ -1950,6 +1950,10 @@ namespace ts { | |||
| return OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences); | |||
| } | |||
|
|
|||
| function renameFile(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges> { | |||
mhegazy
Apr 20, 2018
the name makes me think there is will rename the file as well.. how about getEditsForFileRename
the name makes me think there is will rename the file as well.. how about getEditsForFileRename
|
@sheetalkamat What's a good way to get access to the |
|
@andy-ms the soruceFile for the tsconfig.json is stored in |
|
FWIW: most IDEs I’ve used, asked me – before the file was actually moved: “Do you also want to update references?” |
|
Is this supposed to work for renaming folders as well? It doesn't seem to in VS Code 1.24 / TypeScript 2.9.1. |
|
Folder rename should be working in |
|
Filed #24904 to track folder renames. |
Here's how I think it would work:
This is a bit tricky on the tsserver side since we need to be able to figure out what unresolved imports could have resolved to. This meant I had to leave
moduleResolutionCachearound so we could look at the failed lookup locations for failed imports.Fully expecting to need a lot of revision on this. CC @mjbvz for protocol review.