Skip to content

Commit

Permalink
Hide the status bar item when there's no .haxerc
Browse files Browse the repository at this point in the history
+ broader activation events, since workspaceContains doesn't work as I had hoped (microsoft/vscode#28122)
  • Loading branch information
Gama11 committed Jun 4, 2019
1 parent 5e83ef4 commit 98546e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
},
"main": "bin/extension.js",
"activationEvents": [
"workspaceContains:.haxerc"
"onLanguage:haxe",
"workspaceContains:.haxerc",
"workspaceContains:haxe_libraries",
"workspaceContains:./*.hxml",
"onCommand:lix.selectHaxeVersion"
],
"contributes": {
"commands": [
Expand Down
6 changes: 4 additions & 2 deletions src/HaxeVersionSelector.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class HaxeVersionSelector {
}

public function updateStatusBarItem() {
var scope = Scope.seek({cwd: cwd});
var activeEditor = window.activeTextEditor;
if (activeEditor == null || activeEditor.document.languageId != "haxe") {
if (activeEditor == null || activeEditor.document.languageId != "haxe" || scope.isGlobal) {
statusBarItem.hide();
return;
}
var scope = Scope.seek({cwd: cwd});
statusBarItem.text = scope.haxeInstallation.version;
statusBarItem.show();
}
Expand Down Expand Up @@ -63,6 +63,8 @@ class HaxeVersionSelector {
select: installAnotherVersion.bind(items.map(item -> item.label))
});

// TODO: switch to path

showSelectableQuickPick(items, "Select an installed Haxe version to switch to");
});
});
Expand Down

0 comments on commit 98546e1

Please sign in to comment.