Repository navigation
Handle different default export forms the same way in import code fixes #21014
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
Changes from all commits
ff58f1f
1e93967
f0d9cb3
50e3044
a0495a6
13c26fe
b07797c
18f9d69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /// <reference path="fourslash.ts" /> | ||
|
|
||
| // @Filename: /lib.ts | ||
| ////class Base { } | ||
| ////export default Base; | ||
|
|
||
| // @Filename: /test.ts | ||
| ////[|class Derived extends Base { }|] | ||
|
|
||
| goTo.file("/test.ts"); | ||
| verify.importFixAtPosition([ | ||
| `import Base from "./lib"; | ||
|
|
||
| class Derived extends Base { }`,]); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /// <reference path="fourslash.ts" /> | ||
|
|
||
| // @allowJs: true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't really need to be a JS test, right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I can no longer recall my original motivation, it appears to be a JS version of the TS test in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I don't think we need the same test twice -- the same services code will be tested either way. |
||
| // @checkJs: true | ||
|
|
||
| // @Filename: /lib.js | ||
| ////class Base { } | ||
| ////export { Base as default }; | ||
|
|
||
| // @Filename: /test.js | ||
| ////[|class Derived extends Base { }|] | ||
|
|
||
| goTo.file("/test.js"); | ||
| verify.importFixAtPosition([ | ||
| `// @ts-ignore | ||
| class Derived extends Base { }`, | ||
| `// @ts-nocheck | ||
| class Derived extends Base { }`, | ||
| `import Base from "./lib"; | ||
|
|
||
| class Derived extends Base { }`,]); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /// <reference path='fourslash.ts'/> | ||
|
|
||
| // @Filename: foo.ts | ||
| ////let x = 1; | ||
| //// | ||
| ////export { /**/[|x|] as y }; | ||
|
|
||
| goTo.marker(); | ||
| verify.renameInfoSucceeded(/*displayName*/"x", /*fullDisplayName*/"x"); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /// <reference path='fourslash.ts'/> | ||
|
|
||
| // @Filename: foo.ts | ||
| ////let x = 1; | ||
| //// | ||
| ////export { x as /**/[|y|] }; | ||
|
|
||
| goTo.marker(); | ||
| verify.renameInfoSucceeded(/*displayName*/"y", /*fullDisplayName*/'"/tests/cases/fourslash/foo".y'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change could use a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a good way to test that it shows up in the right place in the UI, but I can try to add a lower-level test of the rename info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, what is the expected change to rename behavior due to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different strings are displayed in VS dialogs. No impact on renaming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be some function that returns a different value than before in some situation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course. And I believe I've found a fourslash helper for testing it. I just meant that the same user actions would result in the same result (i.e. renaming) after the change.