@@ -32,7 +32,7 @@ export function registerCommands(
32
32
vscode . commands . registerCommand (
33
33
'roslyn.client.completionComplexEdit' ,
34
34
async ( uriStr , textEdit , isSnippetString , newOffset ) =>
35
- completionComplexEdit ( uriStr , textEdit , isSnippetString , newOffset , outputChannel )
35
+ completionComplexEdit ( uriStr , textEdit , isSnippetString , newOffset )
36
36
)
37
37
) ;
38
38
context . subscriptions . push (
@@ -100,23 +100,22 @@ async function completionComplexEdit(
100
100
uriStr : string ,
101
101
textEdit : vscode . TextEdit ,
102
102
isSnippetString : boolean ,
103
- newOffset : number ,
104
- outputChannel : vscode . OutputChannel
103
+ newOffset : number
105
104
) : Promise < void > {
106
105
const componentName = '[roslyn.client.completionComplexEdit]' ;
107
106
108
107
// Find TextDocument, opening if needed.
109
108
const document = await vscode . workspace . openTextDocument ( uriStr ) ;
110
109
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 } '` ) ;
112
111
}
113
112
114
113
// Use editor if we need to deal with selection or snippets.
115
114
let editor : vscode . TextEditor | undefined = undefined ;
116
115
if ( isSnippetString || newOffset >= 0 ) {
117
116
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 } '` ) ;
120
119
}
121
120
}
122
121
@@ -156,19 +155,12 @@ async function completionComplexEdit(
156
155
}
157
156
158
157
if ( ! success ) {
159
- outputAndThrow (
160
- outputChannel ,
158
+ throw new Error (
161
159
`${ componentName } ${ isSnippetString ? 'TextEditor.insertSnippet' : 'workspace.applyEdit' } failed.`
162
160
) ;
163
161
}
164
162
}
165
163
166
- function outputAndThrow ( outputChannel : vscode . OutputChannel , message : string ) : void {
167
- outputChannel . show ( ) ;
168
- outputChannel . appendLine ( message ) ;
169
- throw new Error ( message ) ;
170
- }
171
-
172
164
async function openSolution ( languageServer : RoslynLanguageServer ) : Promise < vscode . Uri | undefined > {
173
165
if ( ! vscode . workspace . workspaceFolders ) {
174
166
return undefined ;
0 commit comments