-
Notifications
You must be signed in to change notification settings - Fork 4
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
Visual annoyance: Hover is switching between "pages" #78
Comments
You may need to disable hover from other extensions - A shorter one without To disable hover from phan, set This is also a known problem when It's also possible that vs code is flickering because Phan's taking too long to generate hover text, causing vs code to start new requests, kill the language server, etc. Right now, Phan does a full analysis so it can properly generate hover text for |
See #70 - I haven't been able to figure out how to resolve this in the language client library I'm using, but external contributions are welcome. What's the value of phan.analyzedProjectDirectory you're using? |
analyzedProjectDirectory is an array to multiple directories. I did some testing with editor.hover.delay and when I reached about 3 seconds (3000 ms) the "flickering" stopped. So you might be on to something there with your thought about "taking too long". But I think a hover delay of 3 seconds is way too long. :-) It's like it keeps redrawing the Hover over and over again, even if everything that should be shown is there. Maybe there is a way for the server to signal a "Phan is checking..." message to the client so it gets a quick response and when Phan has a message to show it can update the Hover? That type of "flicker"/update is more understandable. |
Related to phan/phan#3252
The fact that there are multiple directories is the cause of it, I assume the 3 seconds working is just a timing coincidence and may change in the future. Speeding up Phan's hover response may very well just make the flickering faster. The actual problem is that Phan is sending hover requests to both servers. I think the other server would respond with null in that case, but I'm not 100% sure. https://code.visualstudio.com/api/references/vscode-api#RelativePattern I wasn't initially able to figure out how to limit hover suggestions to the workspace corresponding to a given Phan folder, but it looks like I can use a RelativePattern (to the phan project directory) in a DocumentSelector to do that. https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts mentions it's using that for registerHoverProvider, and other things - https://code.visualstudio.com/api/references/document-selector protected registerLanguageProvider(options: HoverRegistrationOptions): [Disposable, HoverProvider] {
const provider: HoverProvider = {
provideHover: (document, position, token) => {
const client = this._client;
const provideHover: ProvideHoverSignature = (document, position, token) => {
return client.sendRequest(HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(
client.protocol2CodeConverter.asHover,
(error) => {
client.logFailedRequest(HoverRequest.type, error);
return Promise.resolve(null);
}
);
};
const middleware = client.clientOptions.middleware!;
return middleware.provideHover
? middleware.provideHover(document, position, token, provideHover)
: provideHover(document, position, token);
}
};
return [Languages.registerHoverProvider(options.documentSelector!, provider), provider]; |
See documentSelectors in https://github.com/TysonAndre/vscode-php-phan/blob/master/src/extension.ts , if anyone wants to try to fix this. It might take me a few days to have time to implement and test this |
Not sure how I should describe this. Please change subject to something better.
I do like my hover but this is pretty annoying. I hope you can find a way to make it stop. :)
here is a GIF showing what is happening.
The text was updated successfully, but these errors were encountered: