Skip to content
Open
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
10 changes: 8 additions & 2 deletions src/activity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { basename, parse, sep } from 'node:path';
import type { Selection, TextDocument } from 'vscode';
import { debug, env, window, workspace } from 'vscode';
import type { Selection, TextDocument, Diagnostic } from 'vscode';
import { debug, env, window, workspace, languages, DiagnosticSeverity } from 'vscode';
import {
CONFIG_KEYS,
CURSOR_IMAGE_KEY,
Expand Down Expand Up @@ -52,6 +52,12 @@ async function fileDetails(_raw: string, document: TextDocument, selection: Sele
raw = raw.replace(REPLACE_KEYS.CurrentColumn, (selection.active.character + 1).toLocaleString());
}

if (raw.includes(REPLACE_KEYS.CurrentErrors)) {
const diagnostics = languages.getDiagnostics(document.uri);
const errors = diagnostics.filter((diagnostic: Diagnostic) => diagnostic.severity === DiagnosticSeverity.Error);
raw = raw.replace(REPLACE_KEYS.CurrentErrors, errors.length.toLocaleString());
}

if (raw.includes(REPLACE_KEYS.FileSize)) {
let currentDivision = 0;
let size: number;
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const enum REPLACE_KEYS {
Workspace = '{workspace}',
WorkspaceAndFolder = '{workspace_and_folder}',
WorkspaceFolder = '{workspace_folder}',
CurrentErrors = '{current_errors}',
}

export const enum CONFIG_KEYS {
Expand Down