Skip to content

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

Closed

Description

@aeschli

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.

Activity

  1. changed the title [-]llegal argument, contents must be defined[/-] [+]Error on hover: lllegal argument, contents must be defined[/+] on May 16, 2017
  2. fbricon commented on May 16, 2017

    @fbricon
    Collaborator

    You created the project before or after opening vscode?

  3. aeschli commented on May 16, 2017

    @aeschli
    CollaboratorAuthor

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

  4. aeschli commented on May 16, 2017

    @aeschli
    CollaboratorAuthor

    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.

  5. fbricon commented on May 16, 2017

    @fbricon
    Collaborator

    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

  6. fbricon commented on May 16, 2017

    @fbricon
    Collaborator

    @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)
    
  7. aeschli commented on May 16, 2017

    @aeschli
    CollaboratorAuthor

    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.

  8. aeschli commented on May 16, 2017

    @aeschli
    CollaboratorAuthor

    #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'.

  9. fbricon commented on May 16, 2017

    @fbricon
    Collaborator

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

  10. self-assigned this
    on May 18, 2017
  11. added this to the End May 2017 milestone on May 18, 2017
  12. added a commit that references this issue on May 19, 2017
  13. added a commit that references this issue on May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions