Skip to content

Commit a85586e

Browse files
handle preview variable (#1197)
1 parent 4f08542 commit a85586e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/features/ExtensionCommands.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,14 @@ export interface ISetSelectionRequestArguments {
115115
}
116116

117117
export const OpenFileRequestType =
118-
new RequestType<string, EditorOperationResponse, void, void>(
118+
new RequestType<IOpenFileDetails, EditorOperationResponse, void, void>(
119119
"editor/openFile");
120120

121+
export interface IOpenFileDetails {
122+
filePath: string;
123+
preview: boolean;
124+
}
125+
121126
export const NewFileRequestType =
122127
new RequestType<string, EditorOperationResponse, void, void>(
123128
"editor/newFile");
@@ -347,13 +352,15 @@ export class ExtensionCommandsFeature implements IFeature {
347352
.then((_) => EditorOperationResponse.Completed);
348353
}
349354

350-
private openFile(filePath: string): Thenable<EditorOperationResponse> {
355+
private openFile(openFileDetails: IOpenFileDetails): Thenable<EditorOperationResponse> {
351356

352-
filePath = this.normalizeFilePath(filePath);
357+
const filePath = this.normalizeFilePath(openFileDetails.filePath);
353358

354359
const promise =
355360
vscode.workspace.openTextDocument(filePath)
356-
.then((doc) => vscode.window.showTextDocument(doc))
361+
.then((doc) => vscode.window.showTextDocument(
362+
doc,
363+
{ preview: openFileDetails.preview }))
357364
.then((_) => EditorOperationResponse.Completed);
358365

359366
return promise;

0 commit comments

Comments
 (0)