Skip to content

patternMatcher: Just return 'undefined' for an invalid pattern#23237

Merged
2 commits merged into
masterfrom
invalidPattern
Apr 10, 2018
Merged

patternMatcher: Just return 'undefined' for an invalid pattern#23237
2 commits merged into
masterfrom
invalidPattern

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 6, 2018

A PatternMatcher for an invalid pattern will just return undefined for all queries, so we might as well not use it at all.
Also, dotSeparatedSegments is guaranteed to have length at least 1 because it comes from .split().

@@ -10,6 +10,7 @@ namespace ts.NavigateTo {

export function getNavigateToItems(sourceFiles: ReadonlyArray<SourceFile>, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[] {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return ReadonlyArray then.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exposed as a service, so must wait on #16312 to turn these all to ReadonlyArray (e.g. ReadonlyArray<DefinitionInfo>, ReadonlyArray<ReferenceEntry>...)

@ghost ghost merged commit f479de6 into master Apr 10, 2018
@ghost ghost deleted the invalidPattern branch April 10, 2018 21:38
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 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.

1 participant