-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services/utilities/getMeaningFromLocation()
: fix w/ export specifiers
Fixes 44167, but also two other things: * On an import/export, climb upto the declaration, and use `SemanticMeaning.Type` if it's a `type` only import/export. * Add a `test.rangesInFile()` to fourslash, so it is easy to do multiple files in one test without an awkward filter (which was done in one more test).
- Loading branch information
1 parent
eee34d5
commit fad9122
Showing
4 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/// <reference path='fourslash.ts'/> | ||
|
||
// @Filename: /1.ts | ||
//// type [|A|] = 1; | ||
//// export { [|A|] as [|B|] }; | ||
|
||
{ | ||
const [AType, AExport, asB] = test.rangesInFile("/1.ts"); | ||
verify.documentHighlightsOf(AType, [AType, AExport, asB]); | ||
verify.documentHighlightsOf(AExport, [AType, AExport, asB]); | ||
verify.documentHighlightsOf(asB, [asB]); | ||
} | ||
|
||
// @Filename: /2.ts | ||
//// type [|A|] = 1; | ||
//// let [|A|]: [|A|] = 1; | ||
//// export { [|A|] as [|B|] }; | ||
|
||
{ // a little strange, but the the type/value namespaces work too | ||
const [AType, ALet, ADecl, AExport, asB] = test.rangesInFile("/2.ts"); | ||
verify.documentHighlightsOf(AType, [AType, ADecl, AExport, asB]); | ||
verify.documentHighlightsOf(ADecl, [AType, ADecl, AExport, asB]); | ||
verify.documentHighlightsOf(ALet, [ALet, AExport, asB]); | ||
verify.documentHighlightsOf(AExport, [AType, ALet, ADecl, AExport, asB]); | ||
verify.documentHighlightsOf(asB, [asB]); | ||
} | ||
|
||
// @Filename: /3.ts | ||
//// type [|A|] = 1; | ||
//// let [|A|]: [|A|] = 1; | ||
//// export type { [|A|] as [|B|] }; | ||
|
||
{ // properly handle type only | ||
const [AType, ALet, ADecl, AExport, asB] = test.rangesInFile("/3.ts"); | ||
verify.documentHighlightsOf(AType, [AType, ADecl, AExport, asB]); | ||
verify.documentHighlightsOf(ADecl, [AType, ADecl, AExport, asB]); | ||
verify.documentHighlightsOf(AExport, [AType, ADecl, AExport, asB]); | ||
verify.documentHighlightsOf(ALet, [ALet]); | ||
verify.documentHighlightsOf(asB, [asB]); | ||
} | ||
|
||
// would be nice if this could work the same for imports too, but getSymbolAtLocation() | ||
// of the imported symbol (when aliased) returns undefined | ||
|
||
// // @Filename: /4.ts | ||
// //// import type { [|Tee|] as [|T|] } from "whatEveh"; | ||
// //// let [|T|]: [|T|]; | ||
// | ||
// { | ||
// const [TeeImport, asT, TLet, TDecl] = test.rangesInFile("/4.ts"); | ||
// verify.documentHighlightsOf(TeeImport, [TeeImport, asT, TDecl]); | ||
// // verify.documentHighlightsOf(asT, [TeeImport, asT, TDecl]); | ||
// // verify.documentHighlightsOf(TDecl, [TeeImport, asT, TDecl]); | ||
// // verify.documentHighlightsOf(TLet, [TLet]); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters