Skip to content

Commit 0226ba6

Browse files
committed
Adds title support to open text editor
1 parent ac3b00c commit 0226ba6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/system/-webview/vscode/editors.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { TextDocument, TextDocumentShowOptions, TextEditor } from 'vscode';
2-
import { Uri, ViewColumn, window, workspace } from 'vscode';
2+
import { Uri, ViewColumn, window } from 'vscode';
33
import { imageMimetypes, Schemes } from '../../../constants';
44
import { isGitUri } from '../../../git/gitUri';
55
import { Logger } from '../../logger';
@@ -184,6 +184,7 @@ export async function openSettingsEditor(queryOrOptions: OpenSettingsEditorOptio
184184
export async function openTextEditor(
185185
uri: Uri,
186186
options?: TextDocumentShowOptions & { background?: boolean; throwOnError?: boolean },
187+
title?: string,
187188
): Promise<TextEditor | undefined> {
188189
let background;
189190
let throwOnError;
@@ -196,14 +197,13 @@ export async function openTextEditor(
196197
uri = uri.documentUri();
197198
}
198199

199-
if (background || (uri.scheme === Schemes.GitLens && imageMimetypes[extname(uri.fsPath)])) {
200-
await executeCoreCommand('vscode.open', uri, { background: background, ...options });
200+
if (background || title || (uri.scheme === Schemes.GitLens && imageMimetypes[extname(uri.fsPath)])) {
201+
await executeCoreCommand('vscode.open', uri, { background: background, ...options }, title);
201202

202203
return undefined;
203204
}
204205

205-
const document = await workspace.openTextDocument(uri);
206-
return await window.showTextDocument(document, {
206+
return await window.showTextDocument(uri, {
207207
preserveFocus: false,
208208
preview: true,
209209
viewColumn: ViewColumn.Active,

0 commit comments

Comments
 (0)