Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
ascandone committed Feb 11, 2025
1 parent 49f66c7 commit 494761a
Showing 1 changed file with 44 additions and 45 deletions.
89 changes: 44 additions & 45 deletions internal/lsp/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (state *State) handleHover(params HoverParams) *Hover {
}
}

func (state *State) handleCodeAction(params CodeActionParams) *CodeAction {
func (state *State) handleCodeAction(params CodeActionParams) []CodeAction {

// position := fromLspPosition(params.Position)

Expand All @@ -141,46 +141,48 @@ func (state *State) handleCodeAction(params CodeActionParams) *CodeAction {

// bs, _ := json.Marshal(params)
// os.Stderr.Write(bs)
return &CodeAction{
Title: "EXAMPLE code action",
Kind: Refactor,
Edit: WorkspaceEdit{

// DocumentChanges: []TextDocumentEdit{
// {
// Edits: []TextEdit{
// {
// NewText: "HELLO!",
// Range: Range{
// Start: Position{0, 0},
// End: Position{0, 1},
// },
// },
// },
// TextDocument: OptionalVersionedTextDocumentIdentifier{
// TextDocumentIdentifier: TextDocumentIdentifier{
// URI: params.TextDocument.URI,
// },
// },
// },

// string(params.TextDocument.URI): {
// {
// NewText: "HELLO!",
// Range: Range{
// Start: Position{0, 0},
// End: Position{0, 1},
// },
// },
// },
// },
Changes: map[string][]TextEdit{
string(params.TextDocument.URI): {
{
NewText: "HELLO!",
Range: Range{
Start: Position{0, 0},
End: Position{0, 10},
return []CodeAction{
{
Title: "ACTION",
Kind: QuickFix,
Edit: WorkspaceEdit{

// DocumentChanges: []TextDocumentEdit{
// {
// Edits: []TextEdit{
// {
// NewText: "HELLO!",
// Range: Range{
// Start: Position{0, 0},
// End: Position{0, 1},
// },
// },
// },
// TextDocument: OptionalVersionedTextDocumentIdentifier{
// TextDocumentIdentifier: TextDocumentIdentifier{
// URI: params.TextDocument.URI,
// },
// },
// },

// string(params.TextDocument.URI): {
// {
// NewText: "HELLO!",
// Range: Range{
// Start: Position{0, 0},
// End: Position{0, 1},
// },
// },
// },
// },
Changes: map[string][]TextEdit{
string(params.TextDocument.URI): {
{
NewText: "NEW_TEXT",
Range: Range{
Start: Position{0, 0},
End: Position{5, 20},
},
},
},
},
Expand Down Expand Up @@ -232,10 +234,7 @@ func Handle(r jsonrpc2.Request, state *State) any {
case "initialize":
return InitializeResult{
Capabilities: ServerCapabilities{
TextDocumentSync: TextDocumentSyncOptions{
OpenClose: true,
Change: Full,
},
TextDocumentSync: Full,
HoverProvider: true,
DefinitionProvider: true,
DocumentSymbolProvider: true,
Expand Down

0 comments on commit 494761a

Please sign in to comment.