-
Notifications
You must be signed in to change notification settings - Fork 768
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
Fix IndexError in Typescript completer when querying a subcommand without argument #263
Conversation
Hmm no reviewable.io? |
I messed up by editing my comment. This is fixed now. |
LGTM Reviewed 1 of 1 files at r1. Comments from the review on Reviewable.io |
Typescript completer did not handle the case where no argument was specified when querying a command. Raises the appropriate exception like other completers.
029438a
to
d590f90
Compare
The professional in me feels that we should add a test, but LGTM if you don't feel it is worth it :) Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Reviewed 1 of 1 files at r1. Comments from the review on Reviewable.io |
This is certainly doable. Let me take a shot at it. Comments from the review on Reviewable.io |
Is doable and it would certainly make sense... but then what about all the other completers? Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
I am currently adding tests for all completers. I am wondering if there is a way to get all the supported filetypes by ycmd. Comments from the review on Reviewable.io |
Wouldn't be better to abstract this into the Completer class? Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Yes, MOAR TESTS. @micbou I see you've said you're writing further tests. Have I mentioned how I think that's an absolutely brilliant idea? MOAR TESTS FOR TESTORUS, TEH ALMIGHTY TEST GOD. HE WELCOMES YOUR NON-FLAKY OFFERINGS. @vheon Pulling this out into Completer might be a good idea. I can't imagine how a raw Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
This is the new direction I am taking but some changes in the completer API are needed. My current approach is to add a new abstract method I'll close this PR and send a new one implementing this if you think this is the right approach. Comments from the review on Reviewable.io |
This is roughly the direction that I had in mind, so for me go ahead to the new PR. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Closing this in favor of PR #264. Comments from the review on Reviewable.io |
Move subcommands logic to Completer class Currently, each semantic completer reimplements the `OnUserCommand` and `DefinedSubcommands` in about the same way. To avoid duplication of code, this PR moves the logic of these methods to the `Completer` class. Completers only need to implement a new function `GetSubcommandsMap` that return a map between the subcommands name and the methods to call. The map structure is explained in the method documentation. Minor improvements: - `DefinedSubcommands` now returns an alphabetically sorted list (tests updated to reflect this); - Fix issue in PR #263. Important: if this PR is merged, the `OmniCompleter` class will need to be updated in YCM by inheriting from `GeneralCompleter` instead of `Completer` or implementing the `GetSubcommandsMap` method. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/264) <!-- Reviewable:end -->
When typing the command
:YcmCompleter
without argument in Vim, YCM will return the following errorIndexError: list index out of range
. This is because the Typescript completer, unlike other completers, does not check ifarguments
inOnUserCommand
is defined.