MCPcopy Create free account
hub / github.com/microsoft/typescript-go / convertToLSPCodeAction

Function convertToLSPCodeAction

internal/ls/codeactions.go:384–399  ·  view source on GitHub ↗

convertToLSPCodeAction converts an internal CodeAction to an LSP CodeAction

(action *CodeAction, diag *lsproto.Diagnostic, uri lsproto.DocumentUri)

Source from the content-addressed store, hash-verified

382
383// convertToLSPCodeAction converts an internal CodeAction to an LSP CodeAction
384func 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}

Callers 1

ProvideCodeActionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected