Skip to content

Commit 98cc70d

Browse files
committed
Ensure timestamps are highlighted after switching tabs
1 parent 5e77d52 commit 98cc70d

File tree

7 files changed

+23
-19
lines changed

7 files changed

+23
-19
lines changed

src/commands/openWorkflowJobLogs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from "vscode";
22
import {GitHubRepoContext} from "../git/repository";
33
import {updateDecorations} from "../logs/formatProvider";
4-
import {getLogInfo} from "../logs/logInfoProvider";
4+
import {getLogInfo} from "../logs/logInfo";
55
import {buildLogURI} from "../logs/scheme";
66
import {WorkflowStep} from "../model";
77
import {WorkflowJob} from "../store/WorkflowJob";

src/logs/ansi.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/logs/fileProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {OctokitResponse} from "@octokit/types";
22
import * as vscode from "vscode";
33
import {getGitHubContextForRepo} from "../git/repository";
4-
import {cacheLogInfo} from "./logInfoProvider";
4+
import {cacheLogInfo} from "./logInfo";
55
import {parseLog} from "./model";
66
import {parseUri} from "./scheme";
77

src/logs/foldingProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as vscode from "vscode";
2-
import {getLogInfo} from "./logInfoProvider";
2+
import {getLogInfo} from "./logInfo";
33

44
export class WorkflowStepLogFoldingProvider implements vscode.FoldingRangeProvider {
55
provideFoldingRanges(document: vscode.TextDocument): vscode.ProviderResult<vscode.FoldingRange[]> {

src/logs/symbolProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as vscode from "vscode";
2-
import {getLogInfo} from "./logInfoProvider";
2+
import {getLogInfo} from "./logInfo";
33

44
export class WorkflowStepLogSymbolProvider implements vscode.DocumentSymbolProvider {
55
provideDocumentSymbols(

src/tracker/workflowDocumentTracker.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as vscode from "vscode";
22

33
import {extname} from "path";
4+
import {LogScheme} from "../logs/constants";
5+
import {updateDecorations} from "../logs/formatProvider";
6+
import {getLogInfo} from "../logs/logInfo";
47
import {getContextStringForWorkflow} from "../workflow/workflow";
58

69
export async function initWorkflowDocumentTracking(context: vscode.ExtensionContext) {
@@ -17,19 +20,25 @@ async function onDidChangeActiveTextEditor(editor?: vscode.TextEditor) {
1720

1821
// Check if the file is saved and could be a workflow
1922
if (
20-
!editor.document.uri?.fsPath ||
21-
editor.document.uri.scheme !== "file" ||
22-
!extname(editor.document.fileName).match(/\.ya?ml/) ||
23-
editor.document.fileName.indexOf(".github/workflows") === -1
23+
editor.document.uri?.fsPath &&
24+
editor.document.uri.scheme === "file" &&
25+
extname(editor.document.fileName).match(/\.ya?ml/) &&
26+
editor.document.fileName.indexOf(".github/workflows") !== -1
2427
) {
25-
return;
28+
await vscode.commands.executeCommand(
29+
"setContext",
30+
"githubActions:activeFile",
31+
await getContextStringForWorkflow(editor.document.uri)
32+
);
2633
}
2734

28-
await vscode.commands.executeCommand(
29-
"setContext",
30-
"githubActions:activeFile",
31-
await getContextStringForWorkflow(editor.document.uri)
32-
);
35+
// Is is a log file?
36+
if (editor.document.uri?.scheme === LogScheme) {
37+
const logInfo = getLogInfo(editor.document.uri);
38+
if (logInfo) {
39+
updateDecorations(editor, logInfo);
40+
}
41+
}
3342
}
3443

3544
// Adapted from from https://github.com/eamodio/vscode-gitlens/blob/f22a9cd4199ac498c217643282a6a412e1fc01ae/src/constants.ts#L74

0 commit comments

Comments
 (0)