Skip to content

Commit

Permalink
Merge 1781c95 into eb01a9b
Browse files Browse the repository at this point in the history
  • Loading branch information
stephtr committed Dec 17, 2019
2 parents eb01a9b + 1781c95 commit 07159dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Bug-fixes within the same version aren't needed
* Fix for when `branch.end.column` is `null`. [@garyking](https://github.com/garyking)
* Fix several jest coverage issues and improve usability. - @connectdotz
* Add "Running tests" message to the StatusBar - [@jmarceli](https://github.com/jmarceli)
* Fix StatusBarItem when starting Jest without active text editor but only one workspace folder - @stephtr
-->

Expand Down
14 changes: 10 additions & 4 deletions src/StatusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,16 @@ export class StatusBar {
}

private get activeFolder() {
if (!this._activeFolder && vscode.window.activeTextEditor) {
const folder = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri)
if (folder) {
this._activeFolder = folder.name
if (!this._activeFolder) {
if (vscode.workspace.workspaceFolders.length === 1) {
// there's only one workspaceFolder, so let's take it
this._activeFolder = vscode.workspace.workspaceFolders[0].name
} else if (vscode.window.activeTextEditor) {
// otherwise select correct workspaceFolder based on the currently open textEditor
const folder = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri)
if (folder) {
this._activeFolder = folder.name
}
}
}
return this._activeFolder
Expand Down

0 comments on commit 07159dd

Please sign in to comment.