Skip to content

Commit 1614c13

Browse files
committed
Merge branch 'master' into change/remove_edit_mode_source_dates
2 parents ca2006b + 6563af0 commit 1614c13

File tree

26 files changed

+576
-230
lines changed

26 files changed

+576
-230
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"icon": "icon.png",
44
"displayName": "Code for IBM i",
55
"description": "Maintain your RPGLE, CL, COBOL, C/CPP on IBM i right from Visual Studio Code.",
6-
"version": "2.14.10-dev.0",
6+
"version": "2.14.12-dev.0",
77
"keywords": [
88
"ibmi",
99
"rpgle",
@@ -209,14 +209,6 @@
209209
"default": "QTEMP",
210210
"description": "Library used as the current library and &CURLIB variable when running actions."
211211
},
212-
"sourceASP": {
213-
"type": [
214-
"string",
215-
"null"
216-
],
217-
"default": null,
218-
"description": "If source files live within a specific ASP, please specify it here. Leave blank/null otherwise. You can ignore this column if you have access to `QSYS2.ASP_INFO` as Code for IBM i will fetch ASP information automatically."
219-
},
220212
"sourceFileCCSID": {
221213
"type": "string",
222214
"default": "*FILE",
@@ -1685,6 +1677,13 @@
16851677
"category": "IBM i",
16861678
"icon": "$(debug)",
16871679
"enablement": "code-for-ibmi:testing"
1680+
},
1681+
{
1682+
"command": "code-for-ibmi.generateBinderSource",
1683+
"title": "Generate binder source",
1684+
"category": "IBM i",
1685+
"icon": "$(plus)",
1686+
"enablement": "code-for-ibmi:connected"
16881687
}
16891688
],
16901689
"keybindings": [
@@ -2298,6 +2297,10 @@
22982297
{
22992298
"command": "code-for-ibmi.searchIFSBrowser",
23002299
"when": "never"
2300+
},
2301+
{
2302+
"command": "code-for-ibmi.generateBinderSource",
2303+
"when": "never"
23012304
}
23022305
],
23032306
"view/title": [
@@ -2918,6 +2921,11 @@
29182921
"command": "code-for-ibmi.debug.setup.local",
29192922
"when": "!code-for-ibmi:debugManaged && view == ibmiDebugBrowser && viewItem =~ /^certificateIssue_localissue$/",
29202923
"group": "inline"
2924+
},
2925+
{
2926+
"command": "code-for-ibmi.generateBinderSource",
2927+
"when": "view == objectBrowser && viewItem =~ /^object.(module|srvpgm).*/",
2928+
"group": "1_objActions@6"
29212929
}
29222930
],
29232931
"explorer/context": [

src/api/IBMi.ts

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Tools } from './Tools';
1414
import * as configVars from './configVars';
1515
import { DebugConfiguration } from "./configuration/DebugConfiguration";
1616
import { ConnectionManager } from './configuration/config/ConnectionManager';
17-
import { CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, WrapResult } from './types';
17+
import { AspInfo, CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, WrapResult } from './types';
1818
import { EventEmitter } from 'stream';
1919
import { ConnectionConfig } from './configuration/config/types';
2020
import { EditorPath } from '../typings';
@@ -97,12 +97,16 @@ export default class IBMi {
9797
currentConnectionName: string = ``;
9898
private tempRemoteFiles: { [name: string]: string } = {};
9999
defaultUserLibraries: string[] = [];
100+
100101
/**
101102
* Used to store ASP numbers and their names
102103
* Their names usually maps up to a directory in
103104
* the root of the IFS, thus why we store it.
104105
*/
105-
aspInfo: { [id: number]: string } = {};
106+
private iAspInfo: AspInfo[] = [];
107+
private currentAsp: string|undefined;
108+
private libraryAsps = new Map<string, number>();
109+
106110
remoteFeatures: { [name: string]: string | undefined };
107111

108112
variantChars: {
@@ -728,20 +732,26 @@ export default class IBMi {
728732

729733
if (this.sqlRunnerAvailable()) {
730734
// Check for ASP information?
731-
if (quickConnect() && cachedServerSettings?.aspInfo) {
732-
this.aspInfo = cachedServerSettings.aspInfo;
735+
if (quickConnect() && cachedServerSettings?.iAspInfo) {
736+
this.iAspInfo = cachedServerSettings.iAspInfo;
733737
} else {
734738
callbacks.progress({
735-
message: `Checking for ASP information.`
739+
message: `Checking for iASP information.`
736740
});
737741

738742
//This is mostly a nice to have. We grab the ASP info so user's do
739743
//not have to provide the ASP in the settings.
740744
try {
741745
const resultSet = await this.runSQL(`SELECT * FROM QSYS2.ASP_INFO`);
742746
resultSet.forEach(row => {
747+
// Does not ever include SYSBAS/SYSTEM, only iASPs
743748
if (row.DEVICE_DESCRIPTION_NAME && row.DEVICE_DESCRIPTION_NAME && row.DEVICE_DESCRIPTION_NAME !== `null`) {
744-
this.aspInfo[Number(row.ASP_NUMBER)] = String(row.DEVICE_DESCRIPTION_NAME);
749+
this.iAspInfo.push({
750+
id: Number(row.ASP_NUMBER),
751+
name: String(row.DEVICE_DESCRIPTION_NAME),
752+
type: String(row.ASP_TYPE),
753+
rdbName: String(row.RDB_NAME)
754+
});
745755
}
746756
});
747757
} catch (e) {
@@ -752,6 +762,12 @@ export default class IBMi {
752762
}
753763
}
754764

765+
callbacks.progress({
766+
message: `Fetching current iASP information.`
767+
});
768+
769+
this.currentAsp = await this.getUserProfileAsp();
770+
755771
// Fetch conversion values?
756772
if (quickConnect() && cachedServerSettings?.jobCcsid !== null && cachedServerSettings?.userDefaultCCSID && cachedServerSettings?.qccsid) {
757773
this.qccsid = cachedServerSettings.qccsid;
@@ -893,7 +909,7 @@ export default class IBMi {
893909

894910
IBMi.GlobalStorage.setServerSettingsCache(this.currentConnectionName, {
895911
lastCheckedOnVersion: currentExtensionVersion,
896-
aspInfo: this.aspInfo,
912+
iAspInfo: this.iAspInfo,
897913
qccsid: this.qccsid,
898914
jobCcsid: this.userJobCcsid,
899915
remoteFeatures: this.remoteFeatures,
@@ -1434,6 +1450,68 @@ export default class IBMi {
14341450
return this.remoteFeatures[`startDebugService.sh`] !== undefined;
14351451
}
14361452

1453+
private async getUserProfileAsp(): Promise<string|undefined> {
1454+
const [currentRdb] = await this.runSQL(`values current_server`);
1455+
1456+
if (currentRdb) {
1457+
const key = Object.keys(currentRdb)[0];
1458+
const rdbName = currentRdb[key];
1459+
const currentAsp = this.iAspInfo.find(asp => asp.rdbName === rdbName);
1460+
1461+
if (currentAsp) {
1462+
return currentAsp.name;
1463+
}
1464+
}
1465+
}
1466+
1467+
getAllIAsps() {
1468+
return this.iAspInfo;
1469+
}
1470+
1471+
getIAspDetail(by: string|number) {
1472+
let asp: AspInfo|undefined;
1473+
if (typeof by === 'string') {
1474+
asp = this.iAspInfo.find(asp => asp.name === by);
1475+
} else {
1476+
asp = this.iAspInfo.find(asp => asp.id === by);
1477+
}
1478+
1479+
if (asp) {
1480+
return asp;
1481+
}
1482+
}
1483+
1484+
getIAspName(by: string|number): string|undefined {
1485+
return this.getIAspDetail(by)?.name;
1486+
}
1487+
1488+
getCurrentIAspName() {
1489+
return this.currentAsp;
1490+
}
1491+
async lookupLibraryIAsp(library: string): Promise<string|undefined> {
1492+
let foundNumber = this.libraryAsps.get(library);
1493+
1494+
if (!foundNumber) {
1495+
const [row] = await this.runSQL(`SELECT IASP_NUMBER FROM TABLE(QSYS2.LIBRARY_INFO('${this.sysNameInAmerican(library)}'))`);
1496+
const iaspNumber = Number(row?.IASP_NUMBER);
1497+
if (iaspNumber >= 0) {
1498+
this.libraryAsps.set(library, iaspNumber);
1499+
foundNumber = iaspNumber;
1500+
}
1501+
}
1502+
1503+
if (foundNumber) {
1504+
return this.getIAspName(foundNumber);
1505+
}
1506+
}
1507+
1508+
getLibraryIAsp(library: string) {
1509+
const found = this.libraryAsps.get(library);
1510+
if (found && found >= 0) {
1511+
return this.getIAspName(found);
1512+
}
1513+
}
1514+
14371515
/**
14381516
* @deprecated Use {@link IBMiContent.uploadFiles} instead.
14391517
*/

0 commit comments

Comments
 (0)