Skip to content

getApplicableRefactors: Don't return undefined response #16773

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

Merged
1 commit merged into from
Jul 13, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jun 27, 2017

In session.ts:

[CommandNames.GetApplicableRefactors]: (request: protocol.GetApplicableRefactorsRequest) => {
    return this.requiredResponse(this.getApplicableRefactors(request.arguments));
},

If we return undefined for something with a required response, this will cause an error later on. (The error message is simply "No content available.".)

There is probably a similar error for getEditsForRefactor.

@ghost ghost requested a review from RyanCavanaugh June 27, 2017 19:52
@ghost
Copy link
Author

ghost commented Jun 28, 2017

Actually, it looks like several other services (completions, references, definition) can return an undefined value but will then fail with "No content available." This is in cases where e.g. no definition is available, but should it really be considered an "error" from a services standpoint? It's making it hard to detect actual errors in large tsserver logs. Is there some reason for services to return undefined instead of an empty array (which produces no error)? CC @mjbvz @mhegazy

@ghost ghost merged commit 79b1008 into master Jul 13, 2017
@ghost ghost deleted the getApplicableRefactors branch July 13, 2017 14:32
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants