formulahendry / formulahendry/vscode-code-runner

[Bug] CodeRunner do not work (vscode version 1.44.1)

Open
#598 1 comment 1 reaction 0 assignees View on GitHub
bug need more investigation
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- VS Code Version: 1.44.1
- OS Version: mac
- Code Runner Version: 0.9.17

**Describe the bug**
CodeRunner is a very nice extension.
But after I updated my vscode to version 1.44.1, I got a bug when run code with code runner.
I debugged and found an error:

file: codeManager.ts
line: 163
code:
```
if (vscode.workspace.workspaceFolders) {
...
}
```

Bug Detail:

vscode.workspace.workspaceFolders is an empty array
when run "return vscode.workspace.workspaceFolders[0].uri.fsPath;" then got an error.

Repair:

Method1:
change
```
if (vscode.workspace.workspaceFolders) {
...
}
```
to
```
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length) {
...
}
```

Method2:
change
```
return vscode.workspace.workspaceFolders[0].uri.fsPath;
```
to
```
return vscode.workspace.workspaceFolders.length ? vscode.workspace.workspaceFolders[0].uri.fsPath : undefined;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.