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

Default to using a diff when tracking source dates #2521

Merged
merged 6 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 2 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,6 @@
"default": false,
"description": "When enabled, Code for IBM i will retain/update source dates of members when editing source members. Requires SQL to be enabled for this feature to work. If this config is changed, you must reconnect to the system."
},
"sourceDateMode": {
"type": "string",
"default": "diff",
"enum": [
"diff",
"edit"
],
"description": "Determine which method should be used to track changes to source dates for source member."
},
"sourceDateGutter": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -490,11 +481,6 @@
"default": false,
"description": "If enabled, when the user tries to delete a directory, they will be asked to confirm the deletion by typing in the directory's name."
},
"code-for-ibmi.showDateSearchButton": {
"type": "boolean",
"default": true,
"description": "If enabled, will show the 'Date search' button in the status bar when source dates with diff mode is enabled."
},
"code-for-ibmi.terminals.5250.openInEditorArea": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -1068,13 +1054,13 @@
},
{
"command": "code-for-ibmi.toggleSourceDateGutter",
"enablement": "code-for-ibmi:connected && code-for-ibmi:sourceDateMode === diff",
"enablement": "code-for-ibmi:connected",
"title": "Toggle Source Date Gutter",
"category": "IBM i"
},
{
"command": "code-for-ibmi.member.newDateSearch",
"enablement": "code-for-ibmi:connected && code-for-ibmi:sourceDateMode === diff",
"enablement": "code-for-ibmi:connected",
"title": "Apply Source Date Filter",
"category": "IBM i"
},
Expand Down
1 change: 0 additions & 1 deletion src/api/configuration/config/ConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function initialize(parameters: Partial<ConnectionConfig>): ConnectionConfig {
autoConvertIFSccsid: (parameters.autoConvertIFSccsid === true),
hideCompileErrors: parameters.hideCompileErrors || [],
enableSourceDates: parameters.enableSourceDates === true,
sourceDateMode: parameters.sourceDateMode || "diff",
sourceDateGutter: parameters.sourceDateGutter === true,
encodingFor5250: parameters.encodingFor5250 || `default`,
terminalFor5250: parameters.terminalFor5250 || `default`,
Expand Down
2 changes: 0 additions & 2 deletions src/api/configuration/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FilterType } from "../../Filter";
import { DeploymentMethod, ConnectionData } from "../../types";

export type SourceDateMode = "edit" | "diff";
export type DefaultOpenMode = "browse" | "edit";
export type ReconnectMode = "always" | "never" | "ask";

Expand All @@ -17,7 +16,6 @@ export interface ConnectionConfig extends ConnectionProfile {
autoConvertIFSccsid: boolean;
hideCompileErrors: string[];
enableSourceDates: boolean;
sourceDateMode: SourceDateMode;
sourceDateGutter: boolean;
encodingFor5250: string;
terminalFor5250: string;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export function registerOpenCommands(instance: Instance): Disposable[] {
const editor = window.activeTextEditor;
if (editor) {
currentFile = editor.document.uri;
commands.executeCommand(`diff`, currentFile, path);
commands.executeCommand(`vscode.diff`, currentFile, path);
quickPick.hide();
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/filesystems/qsys/QSysFs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export class QSysFS implements vscode.FileSystemProvider {
this.sourceDateHandler = new SourceDateHandler(context);
this.extendedContent = new ExtendedIBMiContent(this.sourceDateHandler);

context.subscriptions.push(
onCodeForIBMiConfigurationChange(["connectionSettings", "showDateSearchButton"], () => this.updateMemberSupport()),
);

instance.subscribe(
context,
'connected',
Expand All @@ -82,7 +78,6 @@ export class QSysFS implements vscode.FileSystemProvider {
if (connection && config?.enableSourceDates) {
if (connection.sqlRunnerAvailable()) {
this.extendedMemberSupport = true;
this.sourceDateHandler.changeSourceDateMode(config.sourceDateMode);
} else {
vscode.window.showErrorMessage(`Source date support is enabled, but the remote system does not support SQL. Source date support will be disabled.`);
}
Expand Down
28 changes: 7 additions & 21 deletions src/filesystems/qsys/extendedContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export class ExtendedIBMiContent {

this.sourceDateHandler.baseDates.set(alias, sourceDates);

if (this.sourceDateHandler.sourceDateMode === `diff`) {
this.sourceDateHandler.baseSource.set(alias, body);
}
this.sourceDateHandler.baseSource.set(alias, body);

return body;
}
Expand Down Expand Up @@ -112,21 +110,11 @@ export class ExtendedIBMiContent {
const aliasPath = `${tempLib}.${alias}`;

let sourceDates;
if (this.sourceDateHandler.sourceDateMode === `edit`) {
if (!this.sourceDateHandler.baseDates.get(alias)) {
await this.downloadMemberContentWithDates(uri);
sourceDates = this.sourceDateHandler.calcNewSourceDates(alias, body);
}
else{
sourceDates = this.sourceDateHandler.baseDates.get(alias) || [];
}
}
else {
if (!this.sourceDateHandler.baseSource.has(alias)) {
await this.downloadMemberContentWithDates(uri);
}
sourceDates = this.sourceDateHandler.calcNewSourceDates(alias, body);

if (!this.sourceDateHandler.baseSource.has(alias)) {
await this.downloadMemberContentWithDates(uri);
}
sourceDates = this.sourceDateHandler.calcNewSourceDates(alias, body);

const client = connection.client!;

Expand Down Expand Up @@ -192,10 +180,8 @@ export class ExtendedIBMiContent {
throw new Error(`Failed to save member: ` + insertResult.stderr);
}

if (this.sourceDateHandler.sourceDateMode === `diff`) {
this.sourceDateHandler.baseSource.set(alias, body);
this.sourceDateHandler.baseDates.set(alias, sourceDates);
}
this.sourceDateHandler.baseSource.set(alias, body);
this.sourceDateHandler.baseDates.set(alias, sourceDates);
}
}
}
Expand Down
Loading
Loading