-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add exported members of all project files in the global completion list #19069
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
d99675b
checker.ts: Remove null check on symbols
minestarks 5bef866
tsserverProjectSystem.ts: add two tests
minestarks 087de79
client.ts, completions.ts, types.ts: Add codeActions member to Comple…
minestarks a84b5b5
protocol.ts, session.ts: Add codeActions member to CompletionEntryDet…
minestarks 15b73d0
protocol.ts, session.ts, types.ts: add hasAction to CompletionEntry
minestarks 8a1a124
session.ts, services.ts, types.ts: Add formattingOptions parameter to…
minestarks 0aa865f
completions.ts: define SymbolOriginInfo type
minestarks 25831a8
completions.ts, services.ts: Add allSourceFiles parameter to getCompl…
minestarks 9940c92
completions.ts, services.ts: Plumb allSourceFiles into new function g…
minestarks c838093
completions.ts: add symbolToOriginInfoMap parameter to getCompletionE…
minestarks c5cc2f1
utilities.ts: Add getOtherModuleSymbols, getUniqueSymbolIdAsString, g…
minestarks b024285
completions.ts: Set CompletionEntry.hasAction when symbol is found in…
minestarks 041302f
completions.ts: Populate list with possible exports (implement getSym…
minestarks abe1fdb
completions.ts, services.ts: Plumb host and rulesProvider into getCom…
minestarks ae0ab47
completions.ts: Add TODO comment
minestarks 95a9c01
importFixes.ts: Add types ImportDeclarationMap and ImportCodeFixContext
minestarks 380b299
Move getImportDeclarations into getCodeActionForImport, immediately a…
minestarks 22c3373
importFixes.ts: Move createChangeTracker into getCodeActionForImport,…
minestarks 8d5e075
importFixes.ts: Add convertToImportCodeFixContext function and refere…
minestarks 2875c15
importFixes.ts: Add context: ImportCodeFixContext parameter to getCod…
minestarks e7d966b
importFixes.ts: Remove moduleSymbol parameter from getImportDeclarati…
minestarks e912a76
importFixes.ts: Use cachedImportDeclarations from context in getCodeA…
minestarks de7b821
importFixes.ts: Move createCodeAction out, immediately above convertT…
minestarks fa33d50
Move the declaration for lastImportDeclaration out of the getCodeActi…
minestarks 13a47e2
importFixes.ts: Use symbolToken in getCodeActionForImport
minestarks 8e5febb
importFixes.ts: Remove useCaseSensitiveFileNames altogether from getC…
minestarks 2ea36a6
importFixes.ts: Remove local getUniqueSymbolId function and add check…
minestarks b11f6e8
importFixes.ts: Move getCodeActionForImport out into an export, immed…
minestarks 72dd99f
completions.ts: In getCompletionEntryDetails, if there's symbolOrigin…
minestarks e68c951
importFixes.ts: Create and use importFixContext within getCodeActions…
minestarks bc14bb0
importFixes.ts: Use local newLineCharacter instead of context.newLine…
minestarks d1bdc25
importFixes.ts: Use local host instead of context.host in getCodeActi…
minestarks f0c983a
importFixes.ts: Remove dummy getCanonicalFileName line
minestarks a41f3df
Filter symbols after gathering exports instead of before
minestarks 49bb2b8
Merge branch 'master' of https://github.com/Microsoft/TypeScript into…
minestarks 211e3f9
Lint
minestarks 71c7c3f
Merge branch 'exportsincompletionlist' of https://github.com/minestar…
64e30db
Test, fix bugs, refactor
30ebde4
Merge branch 'master' into exportsincompletionlist3
cb6e302
Merge branch 'master' into exportsincompletionlist4
mhegazy c844297
Suggestions from code review
5da1595
Update api baseline
13351db
Merge branch 'master' into exportsincompletionlist4
a5b846f
Fix bug if previousToken is not an Identifier
4c607e7
Replace `startsWith` with `stringContainsCharactersInOrder`
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would check if details.codeActions is not defined, and return details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or conisder:
this avoids the extra object allocation, and will not be marshaled to the caller, since JSON will not marshal undefined properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no type-safe way to mutate an object of one type into an object of a different type -- I would have to use
any
and that would cause errors if we needed to transform some other part ofdetails
and forgot about it. I don't think the extra allocation is a big deal, since it's only a single object percompletionEntryDetails
call.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
getCodeFix
andGetEditsForRefactor
have option of getting simplified result through those methods and full result throughGetCodeFixesFull
andGetEditsForRefactorFull
. Would we want something similar here too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I agree with @mhegazy we shouldnt be allocating object if there is no need. Also looking at this method it looks like there could be multiple entries requested which means those many more new objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplified results appear to be trying to reduce the amount of JSON sent? That would be more important for "completions" (which has a simplified version) than for "completionDetails".
The
mapDefined
is in case the client makes multiple requests together, as in trying to get details on "foo" and "fop" at the same time. I don't think it would ever be in the thousands. I think there's a genuine need for a new object since it would have a different type -- seedecorateNavigationTree
for a similar function that returns an object of different type from its input.