-
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.
Browse files
Browse the repository at this point in the history
Component commits: ebbba5b fix(36416): empty import path causes server crash Co-authored-by: Alexander T. <[email protected]>
- Loading branch information
1 parent
5f623b2
commit 1986a5f
Showing
7 changed files
with
160 additions
and
1 deletion.
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
12 changes: 12 additions & 0 deletions
12
tests/cases/fourslash/unusedImportDeclaration_withEmptyPath.ts
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,12 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @Filename: /a.ts | ||
////// leading trivia | ||
////import * as foo from ""; // trailing trivia | ||
|
||
verify.codeFix({ | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
// trailing trivia`, | ||
}); |
22 changes: 22 additions & 0 deletions
22
tests/cases/fourslash/unusedImportDeclaration_withEmptyPath1.ts
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,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @Filename: /a.ts | ||
////// leading trivia | ||
////import * as foo from ""; | ||
////import { b } from "./b"; | ||
////import { c } from "./c"; | ||
|
||
// @Filename: /b.ts | ||
////export const b = null; | ||
|
||
// @Filename: /c.ts | ||
////export const c = null; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
import { b } from "./b"; | ||
import { c } from "./c";`, | ||
}); |
22 changes: 22 additions & 0 deletions
22
tests/cases/fourslash/unusedImportDeclaration_withEmptyPath2.ts
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,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @Filename: /a.ts | ||
////// leading trivia | ||
////import { b } from "./b"; | ||
////import * as foo from ""; | ||
////import { c } from "./c"; | ||
|
||
// @Filename: /b.ts | ||
////export const b = null; | ||
|
||
// @Filename: /c.ts | ||
////export const c = null; | ||
|
||
verify.codeFix({ | ||
index: 1, | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
import { b } from "./b"; | ||
import { c } from "./c";`, | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/unusedImportDeclaration_withEmptyPath3.ts
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,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @Filename: /a.ts | ||
////// leading trivia | ||
////import { b } from "./b"; | ||
////import { c } from "./c"; | ||
////import * as foo from ""; | ||
|
||
// @Filename: /b.ts | ||
////export const b = null; | ||
|
||
// @Filename: /c.ts | ||
////export const c = null; | ||
|
||
verify.codeFix({ | ||
index: 2, | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
import { b } from "./b"; | ||
import { c } from "./c"; | ||
`, | ||
}); |
35 changes: 35 additions & 0 deletions
35
tests/cases/fourslash/unusedImportDeclaration_withEmptyPath4.ts
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,35 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @Filename: /a.ts | ||
////// leading trivia | ||
////import * as a from ""; | ||
////import * as b from ""; | ||
////import * as c from ""; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
import * as b from ""; | ||
import * as c from "";`, | ||
}); | ||
|
||
verify.codeFix({ | ||
index: 1, | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
import * as a from ""; | ||
import * as c from "";`, | ||
}); | ||
|
||
verify.codeFix({ | ||
index: 2, | ||
description: "Remove import from ''", | ||
newFileContent: | ||
`// leading trivia | ||
import * as a from ""; | ||
import * as b from ""; | ||
` | ||
}); |
44 changes: 44 additions & 0 deletions
44
tests/cases/fourslash/unusedImportDeclaration_withEmptyPath5.ts
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,44 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @Filename: /main.ts | ||
////// leading trivia | ||
////import { a } from "./a"; | ||
////import { b } from "./b"; | ||
////import { c } from "./c"; | ||
|
||
// @Filename: /a.ts | ||
////export const a = null; | ||
|
||
// @Filename: /b.ts | ||
////export const b = null; | ||
|
||
// @Filename: /c.ts | ||
////export const c = null; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove import from './a'", | ||
newFileContent: | ||
`// leading trivia | ||
import { b } from "./b"; | ||
import { c } from "./c";`, | ||
}); | ||
|
||
verify.codeFix({ | ||
index: 1, | ||
description: "Remove import from './b'", | ||
newFileContent: | ||
`// leading trivia | ||
import { a } from "./a"; | ||
import { c } from "./c";`, | ||
}); | ||
|
||
verify.codeFix({ | ||
index: 2, | ||
description: "Remove import from './c'", | ||
newFileContent: | ||
`// leading trivia | ||
import { a } from "./a"; | ||
import { b } from "./b"; | ||
`, | ||
}); |