@@ -32,7 +32,7 @@ export function registerCommands(
3232 vscode . commands . registerCommand (
3333 'roslyn.client.completionComplexEdit' ,
3434 async ( uriStr , textEdit , isSnippetString , newOffset ) =>
35- completionComplexEdit ( uriStr , textEdit , isSnippetString , newOffset , outputChannel )
35+ completionComplexEdit ( uriStr , textEdit , isSnippetString , newOffset )
3636 )
3737 ) ;
3838 context . subscriptions . push (
@@ -100,23 +100,22 @@ async function completionComplexEdit(
100100 uriStr : string ,
101101 textEdit : vscode . TextEdit ,
102102 isSnippetString : boolean ,
103- newOffset : number ,
104- outputChannel : vscode . OutputChannel
103+ newOffset : number
105104) : Promise < void > {
106105 const componentName = '[roslyn.client.completionComplexEdit]' ;
107106
108107 // Find TextDocument, opening if needed.
109108 const document = await vscode . workspace . openTextDocument ( uriStr ) ;
110109 if ( document === undefined ) {
111- outputAndThrow ( outputChannel , `${ componentName } Can't open document with path: '${ uriStr } '` ) ;
110+ throw new Error ( `${ componentName } Can't open document with path: '${ uriStr } '` ) ;
112111 }
113112
114113 // Use editor if we need to deal with selection or snippets.
115114 let editor : vscode . TextEditor | undefined = undefined ;
116115 if ( isSnippetString || newOffset >= 0 ) {
117116 editor = await vscode . window . showTextDocument ( document ) ;
118- if ( editor == undefined ) {
119- outputAndThrow ( outputChannel , `${ componentName } Editor unavailable for document with path: '${ uriStr } '` ) ;
117+ if ( editor === undefined ) {
118+ throw new Error ( `${ componentName } Editor unavailable for document with path: '${ uriStr } '` ) ;
120119 }
121120 }
122121
@@ -156,19 +155,12 @@ async function completionComplexEdit(
156155 }
157156
158157 if ( ! success ) {
159- outputAndThrow (
160- outputChannel ,
158+ throw new Error (
161159 `${ componentName } ${ isSnippetString ? 'TextEditor.insertSnippet' : 'workspace.applyEdit' } failed.`
162160 ) ;
163161 }
164162}
165163
166- function outputAndThrow ( outputChannel : vscode . OutputChannel , message : string ) : void {
167- outputChannel . show ( ) ;
168- outputChannel . appendLine ( message ) ;
169- throw new Error ( message ) ;
170- }
171-
172164async function openSolution ( languageServer : RoslynLanguageServer ) : Promise < vscode . Uri | undefined > {
173165 if ( ! vscode . workspace . workspaceFolders ) {
174166 return undefined ;
0 commit comments