Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on startup #54

Closed
ilanpillemer opened this issue Jan 1, 2023 · 1 comment
Closed

error on startup #54

ilanpillemer opened this issue Jan 1, 2023 · 1 comment

Comments

@ilanpillemer
Copy link
Contributor

ilanpillemer commented Jan 1, 2023


2023/01/01 14:02:52 failed to create file manager: failed to connect to language server ["gopls" "serve" "-rpc.trace" "--debug=localhost:6060"]: initialize failed: unmarshalling result: json: cannot unmarshal object into Go struct field ServerCapabilities.capabilities.selectionRangeProvider of type boo

seems probably linked to this line of code

internal/lsp/acmelsp/client.go:166:		return fmt.Errorf("initialize failed: %v", err)
	params := &protocol.InitializeParams{
		RootURI: text.ToURI(d),
		Capabilities: protocol.ClientCapabilities{
			// Workspace: ..., (struct literal)
			TextDocument: protocol.TextDocumentClientCapabilities{
				CodeAction: &protocol.CodeActionClientCapabilities{
					CodeActionLiteralSupport: &protocol.CodeActionLiteralSupport{
						// CodeActionKind: ..., (struct literal)
					},
				},
				DocumentSymbol: &protocol.DocumentSymbolClientCapabilities{
					HierarchicalDocumentSymbolSupport: true,
				},
			},
		},
		WorkspaceFolders:      cfg.Workspaces,
		InitializationOptions: cfg.Options,
	}
	params.Capabilities.Workspace.WorkspaceFolders = true
	params.Capabilities.Workspace.ApplyEdit = true
	params.Capabilities.TextDocument.CodeAction.CodeActionLiteralSupport.CodeActionKind.ValueSet =
		[]protocol.CodeActionKind{protocol.SourceOrganizeImports}
	var result protocol.InitializeResult
	if err := rpc.Call(ctx, "initialize", params, &result); err != nil {
		return fmt.Errorf("initialize failed: %v", err)
	}
	if err := rpc.Notify(ctx, "initialized", &protocol.InitializedParams{}); err != nil {
		return fmt.Errorf("initialized failed: %v", err)
	}
	c.Server = server
	c.initializeResult = &result
	return nil

So error is being returned I assume from gopls, I will look there now and see if I can see what changed there.

look like its linked to this commit in gopls

golang/tools@1270fd7

and

golang/go#36679

Upon analysis the error is because the go server is expecting a struct and not a bool.. see golang/tools@1270fd7

I have made a PR to match this expectation (my local testing in acme was successful)

NB: started happening during last week of December.

ilanpillemer added a commit to ilanpillemer/acme-lsp that referenced this issue Jan 1, 2023
@fhs
Copy link
Collaborator

fhs commented Jun 18, 2023

This should be fixed now. See my comment in PR #55:
#55 (comment)

@fhs fhs closed this as completed Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants