Session: don't return undefined if a response is required#17165
Merged
6 commits merged intomasterfrom Aug 9, 2017
Merged
Conversation
rbuckton
suggested changes
Aug 8, 2017
src/server/session.ts
Outdated
| const definitions = project.getLanguageService().getDefinitionAtPosition(file, position); | ||
| if (!definitions) { | ||
| return undefined; | ||
| return []; |
Contributor
There was a problem hiding this comment.
Are these results mutable? Can we use a shared emptyArray construct?
src/server/session.ts
Outdated
| } | ||
|
|
||
| private getFileAndProject(args: protocol.FileRequestArgs, errorOnMissingProject = true) { | ||
| private getFileAndProject(args: protocol.FileRequestArgs, errorOnMissingProject = true): { file: NormalizedPath, project: Project } { |
Contributor
There was a problem hiding this comment.
Do we need the return type defined here, since it is correctly inferred?
Contributor
|
Looks like the build is failing. Can you take a look? |
Author
|
Fix is #17685, will merge once that's in |
Author
|
@rbuckton Build is passing now, good to go? |
rbuckton
approved these changes
Aug 9, 2017
uniqueiniquity
pushed a commit
to uniqueiniquity/TypeScript
that referenced
this pull request
Aug 9, 2017
…17165) * Session: don't return undefined if a response is required * Use ReadonlyArray and emptyArray * Remove inferred return type
amcasey
reviewed
Aug 10, 2017
| return { | ||
| info: renameInfo, | ||
| locs: [] | ||
| locs: emptyArray |
amcasey
reviewed
Aug 10, 2017
| if (simplifiedResult) { | ||
| const nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); | ||
| if (!nameInfo) { | ||
| return undefined; |
amcasey
reviewed
Aug 10, 2017
|
|
||
| const completions = project.getLanguageService().getCompletionsAtPosition(file, position); | ||
| if (!completions) { | ||
| return undefined; |
amcasey
reviewed
Aug 10, 2017
| } | ||
|
|
||
| private getTypeDefinition(args: protocol.FileLocationRequestArgs): protocol.FileSpan[] { | ||
| private getTypeDefinition(args: protocol.FileLocationRequestArgs): ReadonlyArray<protocol.FileSpan> { |
amcasey
reviewed
Aug 10, 2017
| } | ||
|
|
||
| private getDocumentHighlights(args: protocol.DocumentHighlightsRequestArgs, simplifiedResult: boolean): protocol.DocumentHighlightsItem[] | DocumentHighlights[] { | ||
| private getDocumentHighlights(args: protocol.DocumentHighlightsRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.DocumentHighlightsItem> | ReadonlyArray<DocumentHighlights> { |
Member
|
@Andy-MS It might be safest to revert this (and hold off on #17727) until we further discuss the implications for clients. (cc: @minestarks, @rbuckton) |
Author
|
Might be better to wait for |
Member
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sequel to #16773
This doesn't yet fix
SignatureHelp, since that doesn't return an array. I'm not sure if VSCode is depending on us sending back an "error" response if the user isn't currently at a signature.