1+ import * as monaco from 'monaco-editor'
12import { MessageType , OutputChannel , Window , MessageActionItem , Emitter , Event , CancellationToken , CancellationTokenSource } from 'monaco-languageclient'
23import swal from 'sweetalert'
34import type * as vscode from 'vscode'
@@ -95,7 +96,7 @@ export default class WatchableConsoleWindow implements Window {
9596 return this . onDidChangeChannelsEmitter . event
9697 }
9798
98- withProgress : typeof vscode . window . withProgress = async < R > ( options : vscode . ProgressOptions , task : ( progress : vscode . Progress < { message ?: string , increment ?: number } > , token : CancellationToken ) => PromiseLike < R > ) : Promise < R > => {
99+ withProgress : Window [ ' withProgress' ] = async < R > ( options : vscode . ProgressOptions , task : ( progress : vscode . Progress < { message ?: string , increment ?: number } > , token : CancellationToken ) => PromiseLike < R > ) : Promise < R > => {
99100 console . info ( '[LSP]' , 'Starting task with progress:' , options . location , options . title )
100101 try {
101102 return await task ( {
@@ -107,4 +108,23 @@ export default class WatchableConsoleWindow implements Window {
107108 console . info ( '[LSP]' , 'Task completed:' , options . title )
108109 }
109110 }
111+
112+ showTextDocument : Window [ 'showTextDocument' ] = async ( document , options ) => {
113+ const codeEditorService = monaco . extra . StandaloneServices . get ( monaco . extra . ICodeEditorService )
114+ codeEditorService . getActiveCodeEditor ( )
115+ await codeEditorService . openCodeEditor ( {
116+ resource : document ,
117+ options : {
118+ selection : options ?. selection != null
119+ ? {
120+ startLineNumber : options . selection . start . line ,
121+ startColumn : options . selection . start . character ,
122+ endLineNumber : options . selection . end . line ,
123+ endColumn : options . selection . end . character
124+ }
125+ : undefined ,
126+ selectionSource : monaco . extra . TextEditorSelectionSource . PROGRAMMATIC
127+ }
128+ } , null )
129+ }
110130}
0 commit comments