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

Hover popups always seem to go up, even for first line of file (going offscreen) #10051

Closed
DanTup opened this issue Aug 2, 2016 · 4 comments
Closed
Assignees

Comments

@DanTup
Copy link
Contributor

DanTup commented Aug 2, 2016

  • VSCode Version: 1.3.1
  • OS Version: Windows 10

For some reason, the hover information provided by my extension always goes up and gets chopped off; even though the built-in TypeScript one does not!

TypeScript (left) has the hover popup appear below the mouse, whereas mine (right) shows it above.

hovers

My code looks like this (I've checked but can't see anything on the related classes that might let me control this):

export class DartHoverProvider implements HoverProvider {
    private analyzer: Analyzer;
    constructor(analyzer: Analyzer) {
        this.analyzer = analyzer;
    }

    provideHover(document: TextDocument, position: Position, token: CancellationToken): Thenable<Hover> {
        return new Promise<Hover>((resolve, reject) => {
            this.analyzer.analysisGetHover({
                file: document.fileName,
                offset: document.offsetAt(position)
            }).then(resp => {
                if (resp.hovers.length == 0)
                    resolve(null);
                else
                    // TODO: Add Range
                    resolve(new Hover(resp.hovers.map(this.getHoverData)));
            });
        });
    }

    private getHoverData(hover: as.HoverInformation): string {
        return (
            (hover.dartdoc != null ? hover.dartdoc + "\r\n" : "")
            + hover.elementDescription
        ).trim();
    }
}
@alexdima
Copy link
Member

@DanTup The UI code that renders the hovers doesn't care about where the hover comes from, but cares about the height of the hover. Is it possible to share here the values you provide to a hover? (I'm thinking it is a very large text blob?)

@DanTup
Copy link
Contributor Author

DanTup commented Aug 11, 2016

@alexandrudima You're right, it was large. We've since trimmed it down to 20 lines and I think it's been fine since. I think there's an open feature request to add scrolling somewhere (which I think would be a better long-term solution).

If you need a specific example to repro, let me know and I'll find one.

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug editor-core-view labels Aug 18, 2016
@alexdima alexdima added this to the Backlog milestone Aug 18, 2016
@alexdima alexdima added editor-core Editor basic functionality and removed editor-core-view labels Aug 30, 2016
@alexdima alexdima added editor-hover Editor mouse hover and removed editor-core Editor basic functionality labels Sep 27, 2017
@alexdima
Copy link
Member

@joaomoreno I think we've added scrolling in the hover since this issue was created, right ?

@alexdima alexdima assigned joaomoreno and unassigned alexdima Sep 27, 2017
@joaomoreno
Copy link
Member

@alexandrudima Talk about digging. 👴

@joaomoreno joaomoreno removed bug Issue identified by VS Code Team member as probable bug editor editor-hover Editor mouse hover labels Sep 27, 2017
@joaomoreno joaomoreno removed this from the Backlog milestone Sep 27, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants