-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06c4593
commit aceeebb
Showing
4 changed files
with
69 additions
and
12 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 |
---|---|---|
@@ -1 +1 @@ | ||
import { } from '@/foo/foo'; | ||
import { } from '@/'; |
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,39 @@ | ||
import * as assert from "assert"; | ||
import * as vscode from "vscode"; | ||
import { beforeEach, afterEach } from "mocha"; | ||
import { getFileUri } from "../utils/open-document"; | ||
import { setConfig, setDefaults } from "../utils/set-config"; | ||
|
||
suite("tsconfig paths", () => { | ||
beforeEach(async () => { | ||
await setDefaults(); | ||
}); | ||
|
||
afterEach(async () => { | ||
await setDefaults(); | ||
}); | ||
|
||
suite("with baseUrl ./", () => { | ||
const project = "demo-workspace/project-with-paths"; | ||
const fileInFolder = `${project}/src/index.js`; | ||
|
||
test("Get correct file when not using baseUrl", async () => { | ||
await setConfig("ignoreTsConfigBaseUrl", false); | ||
const result = await triggerCompletion(fileInFolder, 0, 19); | ||
assert.ok(hasItem(result, "foo")); | ||
assert.ok(hasItem(result, "bar")); | ||
}); | ||
}); | ||
}); | ||
|
||
async function triggerCompletion(uri: string, line: number, column: number) { | ||
return (await vscode.commands.executeCommand( | ||
"vscode.executeCompletionItemProvider", | ||
getFileUri(uri), | ||
new vscode.Position(line, column) | ||
)) as vscode.CompletionList; | ||
} | ||
|
||
function hasItem(list: vscode.CompletionList, label: string) { | ||
return list.items.some((item) => item.label === label); | ||
} |