You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This actually works for me in VS code for some reason when using @next, but not when using the compiler api directly. Maybe my VS code setup is wrong though.
Why?
This bug will block me from doing a ts-morph release unless I come up with a new solution for renaming only the exported name. Previously it worked to change the export to export { name } to export { name as name} then use rename on the language service to go to export { name as newAlias }.
Code
// a.tsexportclassname{}// b.tsimport{name}from"./a";export{nameasname/* rename this identifier */};// c.tsimport{name}from"./b";
Here's some reproduction steps (using @tsmorph/bootstrap for the setup because it's easier):
npm install --save-dev typescript@next @ts-morph/bootstrap
rm -rf node_modules/@ts-morph/common/node_modules/typescript #make it use typescript@next
Now the code:
// setup...const{ Project, ts }=require("@ts-morph/bootstrap");console.log(ts.version);// 3.9.0-dev.20200212constproject=newProject({useInMemoryFileSystem: true});constfileA=project.createSourceFile("a.ts","export class name{}");constfileB=project.createSourceFile("b.ts",`import { name } from "./a"; export { name as name };`);constfileC=project.createSourceFile("c.ts",`import { name } from "./b";`);constlanguageService=project.getLanguageService();// renameconstrenameLocations=languageService.findRenameLocations("/b.ts",45,false,false,false);console.log(renameLocations)
@andrewbranch thanks for looking into this! Some more information... just figured out it only happens in the IDE when "rename shorthand properties" is unchecked:
Oh thank you so much for that; I just started debugging VS Code’s TS Server vs. your project side-by-side. You probably just saved me the better part of an hour 😅
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.8.0-dev.20200208
Search Terms: rename export specifier alias
This actually works for me in VS code for some reason when using
@next
, but not when using the compiler api directly. Maybe my VS code setup is wrong though.Why?
This bug will block me from doing a ts-morph release unless I come up with a new solution for renaming only the exported name. Previously it worked to change the export to
export { name }
toexport { name as name}
then use rename on the language service to go toexport { name as newAlias }
.Code
Expected behavior:
Actual behavior:
Result of calling
languageService.findRenameLocations("/b.ts", 45, false, false, false)
:The text was updated successfully, but these errors were encountered: