castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 23 forks source link

Inconsistent documentation updates when hovering #112

Closed Rylon closed 5 years ago

Rylon commented 5 years ago

Hi, I'm experiencing an unusual issue which I've failed to pinpoint. It is to do with the Yard documentation which is shown when hovering over a class name or so on. Sometimes changes made to the docs don't show up immediately.

This is an example of what I'm doing to reproduce this:

# This is a comment for MyClass - attempt number one
class MyClass ; end

If I hover over MyClass I will see the comment. If I then change the text "attempt number one" to "attempt number two" and hover over MyClass again, I will still see the original text. Clicking on the MyClass link inside the hover popup will open the docs, split to the right and will then show the correct text if I hover again.

Interestingly, each time I click on the MyClass link, the documentation shows another entry with the class's filename in the 'Defined in:' section.

I've not 100% sure why sometimes it works right away and other times it doesn't seem to work until I click on the link.

Sorry if the explanation isn't clear, I've attached a video zip showing it in action to hopefully clarify things 👍

Thanks!

example.mp4.zip

castwide commented 5 years ago

The inconsistent hovers should be fixed in gem version 0.32.2. If you still experience the problem, please let me know.

A fix for the duplicate files in the documentation page is forthcoming.

Rylon commented 5 years ago

Confirmed 0.32.2 fixes the inconsistent hovers 👍 thanks!

I'll keep an eye out for the documentation page fix too, mind if I keep this open until then?

castwide commented 5 years ago

Sure, no problem. I should have it fixed sometime in the next couple of weeks.

castwide commented 5 years ago

The latest gem fixes the file list on documentation pages.

Rylon commented 5 years ago

Hi @castwide I just verified and it's fixed the duplicate lines for when the comment changes, however I think it's introduced a different issue. The lines now appear as arrays with the filename and line number as elements. If you change a class comment from one line to multi-lines, the class definition changes line number and you get a duplicate entry, for example:

Defined in:
∙ ["/path/to/my_class.rb", 3]
∙ ["/path/to/my_class.rb", 4]

Hope this helps!

castwide commented 5 years ago

Is this file in your workspace or a gem?

If it might be ambiguous, you can try go-to-definition on the same symbol and check the absolute path to the file it opens.

Rylon commented 5 years ago

Hi, it's a file in my workspace, it's definitely the only file/class with that name.

castwide commented 5 years ago

Thanks. I'll give this another look.

Rylon commented 5 years ago

Thanks, let me know if I can help with debugging. I can reproduce it by adding a single line comment above a class, hovering and clicking the link to get the documentation pages. Next add a second comment line above the class, the class has now moved down one line, hover again, click the link again, you’ll now see two entries for the same class with the previous and current line number shown.

castwide commented 5 years ago

Thanks for the additional information. The error only occurred when the method's location changed between page loads. I released gem v0.34.2 this morning. It should fix the problem.

Rylon commented 5 years ago

Hi @castwide I just gave it a try and everything seems to be working as expected now. Thanks very much for your time and effort on this 👍