Skip to content

Commit 5c66dd7

Browse files
author
Étienne Lévesque
authored
Fix documents before running tests (#165)
* Fix documents before running tests * Update elixir-ls * Update elixir-ls * Update elixir-ls * fix formatting
1 parent 1d06916 commit 5c66dd7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/commands/runTestFromCodeLens.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,24 @@ type RunArgs = {
88
module?: string;
99
};
1010

11-
export default function runFromCodeLens(args: RunArgs): void {
11+
export default async function runFromCodeLens(args: RunArgs): Promise<void> {
12+
const { activeTextEditor, terminals, createTerminal } = window;
13+
14+
if (!activeTextEditor) {
15+
return;
16+
}
17+
18+
if (activeTextEditor.document.isDirty) {
19+
const saved = await activeTextEditor.document.save();
20+
21+
if (!saved) {
22+
return;
23+
}
24+
}
25+
1226
const elixirLsTerminal =
13-
window.terminals.find((terminal) => terminal.name == "ElixirLS") ||
14-
window.createTerminal("ElixirLS");
27+
terminals.find((terminal) => terminal.name == "ElixirLS") ||
28+
createTerminal("ElixirLS");
1529

1630
elixirLsTerminal.show();
1731
elixirLsTerminal.sendText("clear");

0 commit comments

Comments
 (0)