languageserver icon indicating copy to clipboard operation
languageserver copied to clipboard

Feature Request: Option to hide S3 methods from completions

Open dgkf opened this issue 3 years ago • 5 comments
trafficstars

I often find that S3 methods can clutter the completions list, and think it would be helpful to be able to hide S3 methods in most cases.

For example, given a completion token, pri, completions look like:

With all of the print.* methods listed, it's hard to find any non-print functions.

Instead, it would be nice if these methods were hidden until a root of the token is an S3 generic. With the token pri, it could produce:

Methods are then included in the completions list once the . is added to denote a dispatch type. Once the . in print. is written, methods are included:

I implemented this behavior in a branch on my fork (though it's not exposed as an option right now), and would be happy to contribute it if you think it fits the project.

dgkf avatar Aug 20 '22 04:08 dgkf

I like the idea of hiding S3 methods. I'd suggest that if user types a function like print. and it should trigger a completion that contains those S3 methods.

renkun-ken avatar Sep 22 '22 08:09 renkun-ken

I like the idea of hiding S3 methods. I'd suggest that if user types a function like print. and it should trigger a completion that contains those S3 methods.

Yep - this is how it should work with in my branch. See the last screenshot to see the completions after print..

dgkf avatar Sep 22 '22 23:09 dgkf

Thanks, I tried it in vscode and it works nicely so far, but typing print. will not have completions shown but backspace and then re-type . will trigger the completion with S3 methods. I guess it is because no non-S3 functions are in the previous completion list triggered by p, and backspace-and-reenter . triggers again the completion with S3 methods.

renkun-ken avatar Sep 23 '22 03:09 renkun-ken

Would you like to send a PR?

renkun-ken avatar Sep 23 '22 03:09 renkun-ken

Sure - I'd like to clean it up a bit, and will be unable to do heads down programming for a week or so but I'll put together a PR once I have a bit of time again.

dgkf avatar Sep 23 '22 03:09 dgkf