Skip to content

Commit

Permalink
Merge pull request #532 from IBM/fix/variable-context-value
Browse files Browse the repository at this point in the history
Fix Db2i commands being contributed to variable tree items
  • Loading branch information
edmundreinhardt authored Jul 5, 2024
2 parents 77cbf0e + ac982eb commit 234e646
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@
"view/item/context": [
{
"command": "vscode-ibmi-projectexplorer.projectExplorer.refresh",
"when": "view == projectExplorer && viewItem =~ /^(?!(objectFile(PHY|PF)|memberFile|sourceFile|ifsFile|variable(?!s)|includePath_local|error)).*/",
"when": "view == projectExplorer && viewItem =~ /^(?!(objectFile(PHY|PF)|memberFile|sourceFile|ifsFile|variableItem|includePath_local|error)).*/",
"group": "0_refresh@0"
},
{
Expand Down Expand Up @@ -1362,12 +1362,12 @@
},
{
"command": "vscode-ibmi-projectexplorer.projectExplorer.editVariable",
"when": "view == projectExplorer && viewItem =~ /^variable(?!s).*/",
"when": "view == projectExplorer && viewItem =~ /^variableItem.*/",
"group": "inline@0"
},
{
"command": "vscode-ibmi-projectexplorer.projectExplorer.editVariable",
"when": "view == projectExplorer && viewItem =~ /^variable(?!s).*/",
"when": "view == projectExplorer && viewItem =~ /^variableItem.*/",
"group": "1_edit@0"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/decorationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DecorationProvider implements FileDecorationProvider {
tooltip: l10n.t('{0} Unresolved Variable(s)', uri.path)
};
}
} else if (uri.scheme === 'variable' && uri.path === 'unresolved') {
} else if (uri.scheme === 'variableItem' && uri.path === 'unresolved') {
// Variable tree item in project explorer
return {
badge: '?',
Expand Down
2 changes: 1 addition & 1 deletion src/ibmiProjectExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export enum ContextValue {
deleted = '_deleted',
sourceDirectory = 'sourceDirectory',
variables = 'variables',
variable = 'variable',
variableItem = 'variableItem',
libraryList = 'libraryList',
library = 'library',
system = '_system',
Expand Down
4 changes: 2 additions & 2 deletions src/testing/suites/decorationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const decorationProviderSuite: TestSuite = {
},
{
name: `Test variable decoration`, test: async () => {
const uri1 = Uri.parse(`variable:resolved`, true);
const uri2 = Uri.parse(`variable:unresolved`, true);
const uri1 = Uri.parse(`variableItem:resolved`, true);
const uri2 = Uri.parse(`variableItem:unresolved`, true);
const decoration1 = decorationProvider.provideFileDecoration(uri1, cancellationTokenSource.token);
const decoration2 = decorationProvider.provideFileDecoration(uri2, cancellationTokenSource.token);

Expand Down
4 changes: 2 additions & 2 deletions src/views/projectExplorer/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { ContextValue } from "../../ibmiProjectExplorer";
* Tree item for a variable.
*/
export default class Variable extends TreeItem implements ProjectExplorerTreeItem {
static contextValue = ContextValue.variable;
static contextValue = ContextValue.variableItem;
value?: string;

constructor(public workspaceFolder: WorkspaceFolder, name: string, value?: string) {
super(name, TreeItemCollapsibleState.None);

this.value = value;
this.resourceUri = Uri.parse(`variable:${value ? 'resolved' : 'unresolved'}`, true);
this.resourceUri = Uri.parse(`variableItem:${value ? 'resolved' : 'unresolved'}`, true);
this.contextValue = Variable.contextValue;
this.description = value || l10n.t('No value');
this.iconPath = new ThemeIcon(`pencil`);
Expand Down

0 comments on commit 234e646

Please sign in to comment.