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 hover: lllegal argument, contents must be defined #214

Closed
aeschli opened this issue May 16, 2017 · 8 comments
Closed

Error on hover: lllegal argument, contents must be defined #214

aeschli opened this issue May 16, 2017 · 8 comments
Assignees
Labels
Milestone

Comments

@aeschli
Copy link
Collaborator

aeschli commented May 16, 2017

v0.4.0

  • in VSCode, create a sample project and add the file
package com.aeschli.testapp;

public class TestHelper {
    public static boolean compare(String a, String b) {
        return a.compareToIgnoreCase(b) == 0;
    }
}
  • move the mouse over boolean
  • the dev tools console shows
    at new e (/usr/share/code-insiders/resources/app/out/vs/workbench/node/extensionHostProcess.js:4:227228)
    at asHover (/home/aeschli/.vscode-insiders/extensions/redhat.java-0.4.0/node_modules/vscode-languageclient/lib/protocolConverter.js:63:16)
e.onUnexpectedError @ workbench.main.js:29

The problem seems to be that the hover object sent across the line doesn't contain a 'contents' field.

@aeschli aeschli changed the title llegal argument, contents must be defined Error on hover: lllegal argument, contents must be defined May 16, 2017
@fbricon
Copy link
Collaborator

fbricon commented May 16, 2017

You created the project before or after opening vscode?

@aeschli
Copy link
Collaborator Author

aeschli commented May 16, 2017

I created it while it was open, but in the meantime also started VSCode again on the project.

@aeschli
Copy link
Collaborator Author

aeschli commented May 16, 2017

I think it's a bug on the Java language server side. If a location doesn't have any hover to show, send 'null' as result, not a hover without contents.

@fbricon
Copy link
Collaborator

fbricon commented May 16, 2017

Ok I can reproduce the issue.

I think we send a non null Hover because lsp4j would crap out otherwise, but I need to check

@fbricon
Copy link
Collaborator

fbricon commented May 16, 2017

@aeschli it's actually VS Code that doesn't like null results:

[Error - 10:49:50 AM] Request textDocument/hover failed.
Error: The received response has neither a result nor an error property.
    at handleInvalidMessage (/Users/fbricon/Dev/projects/vscode-java/node_modules/vscode-jsonrpc/lib/main.js:381:40)
    at StreamMessageReader.callback (/Users/fbricon/Dev/projects/vscode-java/node_modules/vscode-jsonrpc/lib/main.js:492:13)
    at StreamMessageReader.onData (/Users/fbricon/Dev/projects/vscode-java/node_modules/vscode-jsonrpc/lib/messageReader.js:199:18)
    at Socket.<anonymous> (/Users/fbricon/Dev/projects/vscode-java/node_modules/vscode-jsonrpc/lib/messageReader.js:166:19)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)

@aeschli
Copy link
Collaborator Author

aeschli commented May 16, 2017

Yes, it can be discussed where the bug is. From how I understand the spec, 'contents' is a required field for hover.
That said, I created microsoft/vscode-languageserver-node#207 to be tolerant in the language client.

@aeschli
Copy link
Collaborator Author

aeschli commented May 16, 2017

#214 (comment)
I guess you didn't pass in a result at all. The code there checks for undefined. I think it should be at least 'null'.

@fbricon
Copy link
Collaborator

fbricon commented May 16, 2017

Yes it was when I sent a null Hover result instead of an Hover result with null content (your initial report)

@fbricon fbricon self-assigned this May 18, 2017
@fbricon fbricon added the bug label May 18, 2017
@fbricon fbricon added this to the End May 2017 milestone May 18, 2017
fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue May 19, 2017
Fixes redhat-developer/vscode-java#214

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to eclipse-jdtls/eclipse.jdt.ls that referenced this issue May 19, 2017
Fixes redhat-developer/vscode-java#214

Signed-off-by: Fred Bricon <fbricon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants