Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new configuration option to control clearing of diagnostics #1870

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@
],
"description": "Determine which view should be shown when running Actions"
},
"code-for-ibmi.clearErrorsBeforeBuild": {
"type": "boolean",
"default": true,
"description": "When true, existing errors will be replaced with errors from the latest build. When false, errors will be appended to the existing list."
},
"code-for-ibmi.grepIgnoreDirs": {
"type": "array",
"items": {
Expand Down
10 changes: 8 additions & 2 deletions src/api/errors/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export async function refreshDiagnosticsFromServer(instance: Instance, evfeventI
const tableData = await content.getTable(evfeventInfo.library, `EVFEVENT`, evfeventInfo.object);
const lines = tableData.map(row => String(row.EVFEVENT));

clearDiagnostics();
if (GlobalConfiguration.get(`clearErrorsBeforeBuild`)) {
// Clear all errors if the user has this setting enabled
clearDiagnostics();
}

handleEvfeventLines(lines, instance, evfeventInfo);
} else {
Expand All @@ -83,7 +86,10 @@ export async function refreshDiagnosticsFromLocal(instance: Instance, evfeventIn
if (evfeventFiles) {
const filesContent = await Promise.all(evfeventFiles.map(uri => vscode.workspace.fs.readFile(uri)));

clearDiagnostics();
if (GlobalConfiguration.get(`clearErrorsBeforeBuild`)) {
// Clear all errors if the user has this setting enabled
clearDiagnostics();
}

for (const contentBuffer of filesContent) {
const content = contentBuffer.toString();
Expand Down
2 changes: 1 addition & 1 deletion src/api/errors/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class EvfEventFileReader implements ISequentialFileReader {
constructor(lines: string[]) {
this.lines = lines;
}

f
worksofliam marked this conversation as resolved.
Show resolved Hide resolved
readNextLine(): string | undefined {
const line = this.lines[this.index];
if (line) {
Expand Down