castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
423 stars 25 forks source link

[Feature Request] Add additional options for Ruby documentation search #149

Closed maddawik closed 3 years ago

maddawik commented 4 years ago

Hello! I'll start by saying that this extension is awesome! Massive thanks @castwide , as it has made my life much easier in the past couple months.

With that said, here's my feature request:

There should be additional options for filtering the Ruby documentation when using the 'search Ruby documentation' functionality.

I find that this functionality is extremely helpful (especially as someone relatively new to Ruby), but because it includes the current workspace, it also causes some unexpected issues.

Example:

When I use the Ruby search functionality in a workspace that does not have any ruby files or gems, the search works pretty much as expected:

Screen Shot 2019-11-05 at 1 31 17 PM

Now if I open my Ruby project as the current workspace, and then search for string, I get this:

Screen Shot 2019-11-05 at 1 34 23 PM

I understand this is because the diff-lcs package is "redefining" the String class, but I want to be able to filter things in my current workspace out so that doesn't happen. When this happens, there is no way for me to get to the Ruby core or stdlib doc reference.

Suggestions:

I hope this makes sense - if I can add any additional info that would help please let me know, and thanks again for this awesome extension!

castwide commented 4 years ago

Thanks! I'm glad you find it useful.

I confirmed this issue with a workspace that defines a trivial String class. Fixing it will require a change to the way the $/solargraph/document message queries code maps. The first step is to make it combine local documentation with documentation from gems and the Ruby core; I think the default behavior should be to provide everything. From there, we should be able to add a filter for selecting documentation from particular sources.

maddawik commented 4 years ago

Agreed that the default should be to provide everything - if that was the case, the filter I described is probably not even necessary since it displays all results, maybe just something in the search results to categorize the sources.

castwide commented 4 years ago

Yeah, I think you're right. Adding a filter to the doc page should be easier to implement and more practical for the user.

maddawik commented 3 years ago

Don't know when this was changed but I love the new documentation view - thanks @castwide !