From dc282e940ccde89ee16498a974f8177b0157eda0 Mon Sep 17 00:00:00 2001 From: ManuelHentschel <53863351+ManuelHentschel@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:28:05 +0200 Subject: [PATCH] Add option to include filename in status bar --- package.json | 6 ++++++ src/components/builder.ts | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9ea4c291c..b72236173 100644 --- a/package.json +++ b/package.json @@ -1074,6 +1074,12 @@ "default": "", "markdownDescription": "The jobname argument of the compiling tool, which is used by the extension to find project files (e.g., PDF and SyncTeX files). This config should be set identical to the value provided to the `-jobname=` argument, and should not have placeholders. Leave the config empty to ignore jobname and keep the default behavior." }, + "latex-workshop.latex.build.rootfileInStatus": { + "scope": "resource", + "type": "boolean", + "default": false, + "markdownDescription": "Whether to include the name of the root file being built in the status bar." + }, "latex-workshop.latex.texDirs": { "scope": "window", "type": "array", diff --git a/src/components/builder.ts b/src/components/builder.ts index 77f42f025..0739a961d 100644 --- a/src/components/builder.ts +++ b/src/components/builder.ts @@ -764,13 +764,24 @@ class BuildToolQueue { } getStepString(step: Step): string { + let stepString: string if (step.timestamp !== this.steps[0]?.timestamp && step.index === 0) { - return step.recipeName + stepString = step.recipeName } else if (step.timestamp === this.steps[0]?.timestamp) { - return `${step.recipeName}: ${step.index + 1}/${this.steps[this.steps.length - 1].index + 1} (${step.name})` + stepString = `${step.recipeName}: ${step.index + 1}/${this.steps[this.steps.length - 1].index + 1} (${step.name})` } else { - return `${step.recipeName}: ${step.index + 1}/${step.index + 1} (${step.name})` + stepString = `${step.recipeName}: ${step.index + 1}/${step.index + 1} (${step.name})` + } + if(step.rootFile) { + const rootFileUri = vscode.Uri.file(step.rootFile) + const configuration = vscode.workspace.getConfiguration('latex-workshop', rootFileUri) + const showFilename = configuration.get('latex.build.rootfileInStatus', false) + if(showFilename) { + const relPath = vscode.workspace.asRelativePath(step.rootFile) + stepString = `${relPath}: ${stepString}` + } } + return stepString } getStep(): Step | undefined {