Skip to content

Commit

Permalink
refactor: Update CodeLens formatting, make editor refresh
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Dec 27, 2024
1 parent a3951af commit a8a1e55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions packages/zowe-explorer/src/trees/job/JobInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ZoweLogger } from "../../tools/ZoweLogger";
import { SharedActions } from "../shared/SharedActions";
import { SharedContext } from "../shared/SharedContext";
import { SharedInit } from "../shared/SharedInit";
import { FetchMoreCodeLens, SharedUtils } from "../shared/SharedUtils";
import { LoadMoreCodeLens, SharedUtils } from "../shared/SharedUtils";
import { JobFSProvider } from "./JobFSProvider";
import { PollProvider } from "./JobPollProvider";
import { JobTableView } from "./JobTableView";
Expand Down Expand Up @@ -164,10 +164,13 @@ export class JobInit {
);
context.subscriptions.push(
vscode.commands.registerCommand("zowe.jobs.fetchMore", async (document: vscode.TextDocument) => {
await JobFSProvider.instance.fetchSpoolAtUri(document.uri.with({ query: `?startRecord=${document.lineCount - 1}` }));
await JobFSProvider.instance.fetchSpoolAtUri(
document.uri.with({ query: `?startRecord=${document.lineCount - 1}` }),
vscode.window.activeTextEditor
);
})
);
const codeLensProvider = new FetchMoreCodeLens("zowe.jobs.fetchMore");
const codeLensProvider = new LoadMoreCodeLens("zowe.jobs.fetchMore");
const disposableCodeLens = vscode.languages.registerCodeLensProvider({ scheme: ZoweScheme.Jobs }, codeLensProvider);
context.subscriptions.push(disposableCodeLens);

Expand Down
10 changes: 5 additions & 5 deletions packages/zowe-explorer/src/trees/shared/SharedUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ import { ZoweLogger } from "../../tools/ZoweLogger";
import { SharedContext } from "./SharedContext";
import { Definitions } from "../../configuration/Definitions";

export class FetchMoreCodeLens implements vscode.CodeLensProvider {
export class LoadMoreCodeLens implements vscode.CodeLensProvider {
private commandId: string;

constructor(commandId: string) {
public constructor(commandId: string) {
this.commandId = commandId;
}

provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.ProviderResult<vscode.CodeLens[]> {
public provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.ProviderResult<vscode.CodeLens[]> {
const lineCount = document.lineCount;
const lastLine = lineCount - 1;
const lastLineRange = new vscode.Range(lastLine, 0, lastLine, 0);

const codelens = new vscode.CodeLens(lastLineRange, {
title: vscode.l10n.t("Load more content..."),
title: vscode.l10n.t("$(chevron-down) Load more..."),
command: this.commandId,
arguments: [document],
});

return [codelens];
}

resolveCodeLens(codeLens: vscode.CodeLens, token: vscode.CancellationToken): vscode.ProviderResult<vscode.CodeLens> {
public resolveCodeLens(codeLens: vscode.CodeLens, token: vscode.CancellationToken): vscode.ProviderResult<vscode.CodeLens> {
return codeLens;
}
}
Expand Down

0 comments on commit a8a1e55

Please sign in to comment.