Skip to content

Commit

Permalink
add support for member files
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Yan committed May 17, 2024
1 parent 32f9185 commit 726d134
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
32 changes: 26 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,12 @@
"title": "Compare with Selected",
"category": "IBM i"
},
{
"command": "code-for-ibmi.compareCurrentFileWithMember",
"enablement": "code-for-ibmi:connected",
"title": "Compare with member...",
"category": "IBM i"
},
{
"command": "code-for-ibmi.compareCurrentFileWithStream",
"enablement": "code-for-ibmi:connected",
Expand Down Expand Up @@ -1923,6 +1929,10 @@
"command": "code-for-ibmi.compareCurrentFileWithStream",
"when": "code-for-ibmi:connected"
},
{
"command": "code-for-ibmi.compareCurrentFileWithMember",
"when": "code-for-ibmi:connected"
},
{
"command": "code-for-ibmi.goToFileReadOnly",
"when": "code-for-ibmi:connected"
Expand Down Expand Up @@ -2544,20 +2554,25 @@
"group": "2_compare@2"
},
{
"command": "code-for-ibmi.compareCurrentFileWithStream",
"command": "code-for-ibmi.compareCurrentFileWithMember",
"when": "view =~ /^(object|ifs)Browser$/ && (viewItem =~ /^member.*$/ || viewItem == streamfile)",
"group": "2_compare@3"
},
{
"command": "code-for-ibmi.compareCurrentFileWithLocal",
"command": "code-for-ibmi.compareCurrentFileWithStream",
"when": "view =~ /^(object|ifs)Browser$/ && (viewItem =~ /^member.*$/ || viewItem == streamfile)",
"group": "2_compare@4"
},
{
"command": "code-for-ibmi.compareWithActiveFile",
"command": "code-for-ibmi.compareCurrentFileWithLocal",
"when": "view =~ /^(object|ifs)Browser$/ && (viewItem =~ /^member.*$/ || viewItem == streamfile)",
"group": "2_compare@5"
},
{
"command": "code-for-ibmi.compareWithActiveFile",
"when": "view =~ /^(object|ifs)Browser$/ && (viewItem =~ /^member.*$/ || viewItem == streamfile)",
"group": "2_compare@6"
},
{
"command": "code-for-ibmi.createMember",
"when": "view == objectBrowser && viewItem == SPF",
Expand Down Expand Up @@ -2841,19 +2856,24 @@
],
"explorer/context" : [
{
"command": "code-for-ibmi.compareCurrentFileWithStream",
"command": "code-for-ibmi.compareCurrentFileWithMember",
"when": "code-for-ibmi:connected",
"group": "3_compare@40"
},
{
"command": "code-for-ibmi.compareCurrentFileWithStream",
"when": "code-for-ibmi:connected",
"group": "3_compare@41"
},
{
"command": "code-for-ibmi.compareCurrentFileWithLocal",
"when": "!explorerResourceIsFolder",
"group": "3_compare@41"
"group": "3_compare@42"
},
{
"command": "code-for-ibmi.compareWithActiveFile",
"when": "!explorerResourceIsFolder",
"group": "3_compare@42"
"group": "3_compare@43"
}
]
},
Expand Down
9 changes: 6 additions & 3 deletions src/instantiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ export async function loadAllofExtension(context: vscode.ExtensionContext) {
}
}),

vscode.commands.registerCommand(`code-for-ibmi.compareCurrentFileWithMember`, async (node) => {
compareCurrentFile(node, `member`);
}),
vscode.commands.registerCommand(`code-for-ibmi.compareCurrentFileWithStream`, async (node) => {
compareCurrentFile(node, `streamfile`);
}),
Expand Down Expand Up @@ -866,11 +869,11 @@ async function createQuickPickItemsList(
return returnedList;
}

async function compareCurrentFile(node: any, scheme: `streamfile` | `file`) {
let currentFile;
async function compareCurrentFile(node: any, scheme: `streamfile` | `file` | `member`) {
let currentFile: vscode.Uri | undefined;
// If we are comparing with an already targeted node
if (node) {
if (node.scheme === `streamfile` || node.constructor.name === `IFSFileItem` || node.constructor.name === `ObjectBrowserItem`) {
if (node.resourceUri) {
currentFile = node.resourceUri;
} else if (node.scheme === `file`) {
currentFile = node
Expand Down

0 comments on commit 726d134

Please sign in to comment.