Skip to content

Commit 05ab87a

Browse files
committed
revert stack run button, and remove some debug code
1 parent fc450f0 commit 05ab87a

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ All notable changes to the *Haskell Runner 2* will be documented in this file.
66

77
- nil
88

9-
## [0.4.0] (Ureleased)
9+
## [0.4.0]
1010

11-
- avoid reusing recovered terminal at startup by keeping track of active terminals created by Haskell Runner 2
12-
- `Stack Run` button can now be hot loaded, but disabling still requires reload
11+
- avoid reusing recovered terminal at startup by keeping track of active terminals created the extension
1312
- remove activate on `Cabal` language
1413

1514
## [0.3.0]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Haskell Runner 2
22

3-
Successor of the original `Haskell Runner`.
3+
Rewrite of the original `Haskell Runner`.
44

55
## Features
66

@@ -22,7 +22,7 @@ The following configurations are available:
2222
- `runner2.stackPath`: path for stack executable (default `stack`)
2323
- `runner2.cabalPath`: path for cabal executable (default `cabal`)
2424
- `runner2.replTool`: by `default`, it use `ghci` in single file and use `stack repl` (or `cabal repl`) in stack project. This can be overridden by choosing other options (`ghci` for ghci only, and `stack` (or `cabal`) for stack/cabal repl only)
25-
- `runner2.showRunButton`: show "Stack/Cabal Run" button (default `false`)
25+
- `runner2.showRunButton`: show "Stack/Cabal Run" button, *reload required* (default `false`)
2626

2727
## Release Notes
2828

src/extension.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,18 @@ import * as util from './util';
99
var config: conf.Config = conf.getConfig();
1010
// map of saved terminals of current session
1111
var terminal: Map<string, vscode.Terminal> = new Map();
12-
// stack run button already initialized
13-
var stackRunBtn: boolean = false;
1412

1513
// I'm not sure if we can do `async` here
1614
export async function activate(context: vscode.ExtensionContext) {
1715
// check stack/cabal project
1816
const hasConf = async (f: string) => (await vscode.workspace.findFiles(f)).length > 0;
1917
let project: conf.ProjectTy = (await hasConf("stack.yaml")) ? "stack" : (await hasConf("*.cabal") ? "cabal" : "none");
2018
let inproject = project !== "none";
19+
2120
// update config
21+
// ? I'm not sure if it is useful or not
2222
vscode.workspace.onDidChangeConfiguration(e => {
2323
config = conf.getConfig();
24-
if (config.showRun && !stackRunBtn) {
25-
switch (project) {
26-
case 'stack':
27-
stackRunBtn = true;
28-
return util.resgisterStatButton(context, "Stack Run", "runner2.hsrun");
29-
case 'cabal':
30-
stackRunBtn = true;
31-
return util.resgisterStatButton(context, "Cabal Run", "runner2.hsrun");
32-
default: return;
33-
}
34-
}
3524
});
3625

3726
// GHCi command
@@ -73,7 +62,7 @@ export async function activate(context: vscode.ExtensionContext) {
7362
.map(s => ":{\n" + s + "\n:}\n") // in case of multi-line selection
7463
.map(s => {
7564
const term = util.getTermOption(terminal, "GHCi")
76-
.map(term => () => { console.log(term.exitStatus, term.state); return term; })
65+
.map(term => () => term)
7766
.orelse(() => {
7867
let term = vscode.window.createTerminal("GHCi");
7968
term.sendText(config.ghciTool(project)); // we're not loading the file here
@@ -98,7 +87,6 @@ export async function activate(context: vscode.ExtensionContext) {
9887
util.resgisterStatButton(context, project + " Build", "runner2.hsbuild");
9988
util.resgisterStatButton(context, project + " Test", "runner2.hstest");
10089
if (config.showRun) {
101-
stackRunBtn = true;
10290
util.resgisterStatButton(context, project + " Run", "runner2.hsrun");
10391
}
10492
};

src/util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export function registerSimplTerm(
4444
})();
4545
term.sendText(cmd);
4646
term.show();
47-
4847
}));
4948
}
5049

0 commit comments

Comments
 (0)