Skip to content

Commit f59c151

Browse files
Merge pull request #2638 from SanjulaGanepola/feature/open-errors-workspace
Add options to `openErrors` command and fix `getLibraryList` API
2 parents 300d561 + 0fe26d0 commit f59c151

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Instance.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ export default class Instance {
206206
const env = workspaceFolder ? (await getEnvConfig(workspaceFolder)) : {};
207207

208208
const librarySetup: ILELibrarySettings = {
209-
currentLibrary: env[`&CURLIB`] || config.currentLibrary,
210-
libraryList: env[`&LIBL`]?.split(` `) || config.libraryList,
209+
currentLibrary: env[`CURLIB`] || config.currentLibrary,
210+
libraryList: env[`LIBL`]?.split(` `) || config.libraryList,
211211
};
212212

213213
return librarySetup;

src/commands/actions.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function registerActionsCommands(instance: Instance): Disposable[] {
6767
return false;
6868
}),
6969

70-
commands.registerCommand(`code-for-ibmi.openErrors`, async (qualifiedObject?: string) => {
70+
commands.registerCommand(`code-for-ibmi.openErrors`, async (options: { qualifiedObject?: string, workspace?: WorkspaceFolder, keepDiagnostics?: boolean }) => {
7171
interface ObjectDetail {
7272
asp?: string;
7373
lib: string;
@@ -84,17 +84,17 @@ export function registerActionsCommands(instance: Instance): Disposable[] {
8484

8585
let inputPath: string | undefined
8686

87-
if (qualifiedObject) {
87+
if (options.qualifiedObject) {
8888
// Value passed in via parameter
89-
inputPath = qualifiedObject;
89+
inputPath = options.qualifiedObject;
9090

9191
} else {
9292
// Value collected from user input
9393

9494
let initialPath = ``;
9595
const editor = window.activeTextEditor;
9696
const connection = instance.getConnection();
97-
97+
9898
if (editor && connection) {
9999
const config = connection.getConfig();
100100
const uri = editor.document.uri;
@@ -135,7 +135,7 @@ export function registerActionsCommands(instance: Instance): Disposable[] {
135135
const [library, object] = inputPath.split(`/`);
136136
if (library && object) {
137137
const nameDetail = path.parse(object);
138-
refreshDiagnosticsFromServer(instance, { library, object: nameDetail.name, extension: (nameDetail.ext.length > 1 ? nameDetail.ext.substring(1) : undefined) });
138+
refreshDiagnosticsFromServer(instance, { library, object: nameDetail.name, extension: (nameDetail.ext.length > 1 ? nameDetail.ext.substring(1) : undefined), workspace: options.workspace }, options.keepDiagnostics);
139139
}
140140
}
141141
}),

src/ui/diagnostics.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ export function clearDiagnostic(uri: vscode.Uri, changeRange: vscode.Range) {
5757
}
5858
}
5959

60-
export async function refreshDiagnosticsFromServer(instance: Instance, evfeventInfo: EvfEventInfo) {
60+
export async function refreshDiagnosticsFromServer(instance: Instance, evfeventInfo: EvfEventInfo, keepDiagnostics?: boolean) {
6161
const connection = instance.getConnection();
6262

6363
if (connection) {
6464
const content = connection.getContent();
6565
const tableData = await content.getTable(evfeventInfo.library, `EVFEVENT`, evfeventInfo.object);
6666
const lines = tableData.map(row => String(row.EVFEVENT));
6767

68-
if (IBMi.connectionManager.get(`clearErrorsBeforeBuild`)) {
68+
if (IBMi.connectionManager.get(`clearErrorsBeforeBuild`) && !keepDiagnostics) {
6969
// Clear all errors if the user has this setting enabled
7070
clearDiagnostics();
7171
}

0 commit comments

Comments
 (0)