Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

getApplicableRefactors: Don't return undefined response#16773

Merged
1 commit merged into
mastermicrosoft/TypeScript:masterfrom
getApplicableRefactorsmicrosoft/TypeScript:getApplicableRefactorsCopy head branch name to clipboard
Jul 13, 2017
Merged

getApplicableRefactors: Don't return undefined response#16773
1 commit merged into
mastermicrosoft/TypeScript:masterfrom
getApplicableRefactorsmicrosoft/TypeScript:getApplicableRefactorsCopy head branch name to clipboard

Conversation

@ghost

@ghost ghost commented Jun 27, 2017

Copy link
Copy Markdown

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

ghost commented Jun 28, 2017

Copy link
Copy Markdown
Author

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.