convertToLSPCodeAction converts an internal CodeAction to an LSP CodeAction
(action *CodeAction, diag *lsproto.Diagnostic, uri lsproto.DocumentUri)
| 382 | |
| 383 | // convertToLSPCodeAction converts an internal CodeAction to an LSP CodeAction |
| 384 | func convertToLSPCodeAction(action *CodeAction, diag *lsproto.Diagnostic, uri lsproto.DocumentUri) lsproto.CommandOrCodeAction { |
| 385 | kind := lsproto.CodeActionKindQuickFix |
| 386 | changes := map[lsproto.DocumentUri][]*lsproto.TextEdit{ |
| 387 | uri: action.Changes, |
| 388 | } |
| 389 | diagnostics := []*lsproto.Diagnostic{diag} |
| 390 | |
| 391 | return lsproto.CommandOrCodeAction{ |
| 392 | CodeAction: &lsproto.CodeAction{ |
| 393 | Title: action.Description, |
| 394 | Kind: &kind, |
| 395 | Edit: &lsproto.WorkspaceEdit{Changes: &changes}, |
| 396 | Diagnostics: &diagnostics, |
| 397 | }, |
| 398 | } |
| 399 | } |