Skip to content

Commit 3df0a3f

Browse files
author
Alec Barber
committed
fix: don't send multiple initialized notifications
From upstream [isaacphi#49](isaacphi#49)
1 parent e214223 commit 3df0a3f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

internal/lsp/client.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ func (c *Client) InitializeLSPClient(ctx context.Context, workspaceDir string) (
196196
return nil, fmt.Errorf("initialize failed: %w", err)
197197
}
198198

199-
if err := c.Notify(ctx, "initialized", struct{}{}); err != nil {
200-
return nil, fmt.Errorf("initialized notification failed: %w", err)
199+
if err := c.Initialized(ctx, protocol.InitializedParams{}); err != nil {
200+
return nil, fmt.Errorf("initialized failed: %w", err)
201201
}
202202

203203
// Register handlers
@@ -208,12 +208,6 @@ func (c *Client) InitializeLSPClient(ctx context.Context, workspaceDir string) (
208208
c.RegisterNotificationHandler("textDocument/publishDiagnostics",
209209
func(params json.RawMessage) { HandleDiagnostics(c, params) })
210210

211-
// Notify the LSP server
212-
err := c.Initialized(ctx, protocol.InitializedParams{})
213-
if err != nil {
214-
return nil, fmt.Errorf("initialization failed: %w", err)
215-
}
216-
217211
// LSP sepecific Initialization
218212
path := strings.ToLower(c.Cmd.Path)
219213
switch {

0 commit comments

Comments
 (0)