Skip to content

Commit

Permalink
Don't show context menu on root folder
Browse files Browse the repository at this point in the history
This is done by assigning a new context value to the tree item that doesn't match any command's when clause

Fixes #50
  • Loading branch information
dlech committed Nov 7, 2017
1 parent e01d34a commit 2f98e2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## Unreleased
### Fixed
- Current working directory is not the same as when running programs with Brickman
- Context menu shown on root folder in remote file browser
### Changed
- Upload command remembers selected directory for each workspace

Expand Down
8 changes: 7 additions & 1 deletion src/extension.ts
Expand Up @@ -571,6 +571,7 @@ class DeviceTreeItem extends vscode.TreeItem {
enum FileState {
None = 'ev3devBrowser.file',
Folder = 'ev3devBrowser.file.folder',
RootFolder = 'ev3devBrowser.file.folder.root',
Executable = 'ev3devBrowser.file.executable'
}

Expand All @@ -590,7 +591,12 @@ class File extends vscode.TreeItem {
this.isDirectory = stats.isDirectory();
if (this.isDirectory) {
this.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
this.contextValue = FileState.Folder;
if (this.parent) {
this.contextValue = FileState.Folder;
}
else {
this.contextValue = FileState.RootFolder;
}
}
else if (this.isExecutable) {
this.contextValue = FileState.Executable;
Expand Down

0 comments on commit 2f98e2f

Please sign in to comment.