Skip to content

Commit e64d3d0

Browse files
committed
FEAT: force to use cmd on Windows.
1 parent 7dbbaf3 commit e64d3d0

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ An extension with rich support for the [Red Programming language](https://www.re
1010

1111
## Settings
1212

13-
To enable features like IntelliSense, you need to configure the path to the Red binaries in the `Settings`.
13+
### Set the Red binaries
14+
15+
To enable features like IntelliSense, you need to configure the path to the [Red binaries](https://www.red-lang.org/p/download.html) in the `Settings`.
16+
17+
There are two ways to do it. Details are as follows.
1418

1519
---
1620
**NOTE**
@@ -19,15 +23,15 @@ Restart the VS Code to take effect after changing the `Settings`.
1923

2024
---
2125

22-
### Set the search path of the red binaries
26+
### 1. Set the search path of the red binaries
2327

2428
Download the [Red binaries](https://www.red-lang.org/p/download.html) to a local folder, then set the `red.redDir` to it. The plugin will use the latest one according to the filename.
2529

2630
```
2731
"red.redDir": "D:/Tools/Red/"
2832
```
2933

30-
### Set the full path of the red binaries
34+
### 2. Set the full path of the red binaries
3135

3236
If you want to use a specified version of Red binaries, use the following settings:
3337

src/commandsProvider.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,31 @@ function normalFile(value: string): string {
3333
return value.replace(/\\/g, '/');
3434
}
3535

36+
function createTerm(name: string) {
37+
if (process.platform === 'win32') {
38+
return vscode.window.createTerminal(name, 'cmd');
39+
} else {
40+
return vscode.window.createTerminal(name);
41+
}
42+
}
43+
3644
function execCommand(command: string, args: string) {
45+
const termName = 'Red';
3746
let text: string = "";
3847

3948
for (let t of vscode.window.terminals) {
40-
if (t.name === 'Red') {
49+
if (t.name === termName) {
4150
terminal = t;
4251
break;
4352
}
4453
}
4554

46-
terminal = terminal ? terminal : vscode.window.createTerminal('Red');
55+
terminal = terminal ? terminal : createTerm(termName);
4756
if (terminal && terminal.exitStatus) { // killed by the user
4857
terminal.dispose();
49-
terminal = vscode.window.createTerminal('Red');
50-
}
51-
if (process.platform === 'win32') {
52-
const activeTerm = vscode.window.activeTerminal;
53-
if (activeTerm !== undefined && activeTerm.name !== 'bash') {
54-
text = "cmd --% /c \"";
55-
}
58+
terminal = createTerm(termName);
5659
}
60+
5761
text = text + "\"" + command + "\"";
5862
text = text + " " + args;
5963
terminal.sendText(text);

0 commit comments

Comments
 (0)