Skip to content

Commit

Permalink
handle preview variable (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt authored Feb 20, 2018
1 parent 4f08542 commit a85586e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/features/ExtensionCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ export interface ISetSelectionRequestArguments {
}

export const OpenFileRequestType =
new RequestType<string, EditorOperationResponse, void, void>(
new RequestType<IOpenFileDetails, EditorOperationResponse, void, void>(
"editor/openFile");

export interface IOpenFileDetails {
filePath: string;
preview: boolean;
}

export const NewFileRequestType =
new RequestType<string, EditorOperationResponse, void, void>(
"editor/newFile");
Expand Down Expand Up @@ -347,13 +352,15 @@ export class ExtensionCommandsFeature implements IFeature {
.then((_) => EditorOperationResponse.Completed);
}

private openFile(filePath: string): Thenable<EditorOperationResponse> {
private openFile(openFileDetails: IOpenFileDetails): Thenable<EditorOperationResponse> {

filePath = this.normalizeFilePath(filePath);
const filePath = this.normalizeFilePath(openFileDetails.filePath);

const promise =
vscode.workspace.openTextDocument(filePath)
.then((doc) => vscode.window.showTextDocument(doc))
.then((doc) => vscode.window.showTextDocument(
doc,
{ preview: openFileDetails.preview }))
.then((_) => EditorOperationResponse.Completed);

return promise;
Expand Down

0 comments on commit a85586e

Please sign in to comment.