File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -315,19 +315,21 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
315315 if ( token . isCancellationRequested ) {
316316 return item ;
317317 }
318- const docChanges = result . edit . documentChanges ;
319- for ( const editType of docChanges ) {
320- if ( "textDocument" in editType ) {
321- for ( const edit of editType . edits ) {
322- if ( "snippet" in edit ) {
323- documentUris . push ( editType . textDocument . uri ) ;
324- snippetEdits . push ( new SnippetTextEdit ( asRange ( ( edit as any ) . range ) , new SnippetString ( ( edit as any ) . snippet . value ) ) ) ;
318+ const docChanges = result . edit !== undefined ? result . edit . documentChanges : undefined ;
319+ if ( docChanges !== undefined ) {
320+ for ( const editType of docChanges ) {
321+ if ( "textDocument" in editType ) {
322+ for ( const edit of editType . edits ) {
323+ if ( "snippet" in edit ) {
324+ documentUris . push ( editType . textDocument . uri ) ;
325+ snippetEdits . push ( new SnippetTextEdit ( asRange ( ( edit as any ) . range ) , new SnippetString ( ( edit as any ) . snippet . value ) ) ) ;
326+ }
325327 }
326328 }
327329 }
328330 }
329331 const codeAction = await client . protocol2CodeConverter . asCodeAction ( result , token ) ;
330- const docEdits = codeAction . edit . entries ( ) ;
332+ const docEdits = codeAction . edit !== undefined ? codeAction . edit . entries ( ) : [ ] ;
331333 const newWorkspaceEdit = new WorkspaceEdit ( ) ;
332334 for ( const doc of docEdits ) {
333335 const uri = doc [ 0 ] ;
You can’t perform that action at this time.
0 commit comments