Skip to content

Commit

Permalink
Fix documents before running tests (#165)
Browse files Browse the repository at this point in the history
* Fix documents before running tests

* Update elixir-ls

* Update elixir-ls

* Update elixir-ls

* fix formatting
  • Loading branch information
Étienne Lévesque authored May 23, 2021
1 parent 1d06916 commit 5c66dd7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/commands/runTestFromCodeLens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@ type RunArgs = {
module?: string;
};

export default function runFromCodeLens(args: RunArgs): void {
export default async function runFromCodeLens(args: RunArgs): Promise<void> {
const { activeTextEditor, terminals, createTerminal } = window;

if (!activeTextEditor) {
return;
}

if (activeTextEditor.document.isDirty) {
const saved = await activeTextEditor.document.save();

if (!saved) {
return;
}
}

const elixirLsTerminal =
window.terminals.find((terminal) => terminal.name == "ElixirLS") ||
window.createTerminal("ElixirLS");
terminals.find((terminal) => terminal.name == "ElixirLS") ||
createTerminal("ElixirLS");

elixirLsTerminal.show();
elixirLsTerminal.sendText("clear");
Expand Down

0 comments on commit 5c66dd7

Please sign in to comment.