Uh oh!
There was an error while loading. Please reload this page.
Fix string literal completions when a partially-typed string fixes inference to a type parameter - #48410
Conversation
| for (const targetProp of properties) { | ||
| const sourceProp = getPropertyOfType(source, targetProp.escapedName); | ||
| if (sourceProp) { | ||
| if (sourceProp && !some(sourceProp.declarations, hasSkipDirectInferenceFlag)) { |
There was a problem hiding this comment.
Maybe it would be nice to skip this at least in non-services calls, but it would be a lot of plumbing to get checkMode through. I can make a local in createTypeChecker if it seems worthwhile.
There was a problem hiding this comment.
I'm pretty sure you could translate the CheckMode to an InferenceFlag if you'd like.
There was a problem hiding this comment.
inferTypes doesn’t have access to the inference flags, so this doesn’t actually improve the plumbing situation 😕
There was a problem hiding this comment.
A dummy InferencePriority that's unset by the start of inference then? 😅
| getFullyQualifiedName, | ||
| getResolvedSignature: (node, candidatesOutArray, argumentCount) => | ||
| getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, CheckMode.Normal), | ||
| getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => |
There was a problem hiding this comment.
Can't we just add an @internal overload for getResolvedSignature that allows CheckMode to be passed in?
There was a problem hiding this comment.
editingArgument is also needed, and argumentCount isn’t needed... and I like that the name implies the signature you’re going to get is in fact not at all the same signature you would get for normal checking purposes.
Andrew Branch (andrewbranch)
commented
Mar 29, 2022
TypeScript Bot (@typescript-bot) perf test this |
Heya Andrew Branch (@andrewbranch), I've started to run the perf test suite on this PR at 0d266cd. You can monitor the build here. Update: The results are in! |
TypeScript Bot (typescript-bot)
commented
Mar 29, 2022
Andrew Branch (@andrewbranch) Here they are:Comparison Report - main..48410
System
Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Andrew Branch (andrewbranch)
commented
Mar 29, 2022
Wesley Wigham (@weswigham) the perf impact seems to be lost in the noise, so I’d rather not do something hacky to avoid the check. |
| verify.completions({ marker: ["ts", "tsx", "js"], exact: ["", "drag", "dragenter"] }); | ||
| edit.insert("drag"); | ||
| verify.completions({ marker: ["ts", "tsx", "js"], exact: ["", "drag", "dragenter"] }); No newline at end of file |
There was a problem hiding this comment.
Should we also have a test where drag is already entered and we check that we don't output ""? I mean, I guess we should just so we know what our current behavior is, I suppose.
There was a problem hiding this comment.
We do output "", but editors filter it out. This is intentional, because it means if the user backspaces, the editor doesn’t have to re-request completions given a different prefix.
There was a problem hiding this comment.
(The test you’re suggesting is already what’s happening on this line)
There was a problem hiding this comment.
Ahh, ok, I misread - thanks!
Andrew Branch (andrewbranch)
commented
Mar 29, 2022
* upstream/main: (473 commits) Correct node used for isDefinition calculation (microsoft#48499) fix(48405): emit dummy members from a mapped type (microsoft#48481) CFA for dependent parameters typed by generic constraints (microsoft#48411) No contextual typing from return types for boolean literals (microsoft#48380) fix(47733): omit JSDoc comment template suggestion on node with existing JSDoc (microsoft#47748) Ensure that we copy empty NodeArrays during transform (microsoft#48490) Add a new compiler option `moduleSuffixes` to expand the node module resolver's search algorithm (microsoft#48189) feat(27615): Add missing member fix should work for type literals (microsoft#47212) Add label details to completion entry (microsoft#48429) Enable method signature completion for object literals (microsoft#48168) Fix string literal completions when a partially-typed string fixes inference to a type parameter (microsoft#48410) fix(48445): show errors on type-only import/export specifiers in JavaScript files (microsoft#48449) Fix newline inserted in empty block at end of formatting range (microsoft#48463) Prevent looking up symbol for as const from triggering an error (microsoft#48464) Revise accessor resolution logic and error reporting (microsoft#48459) fix(48166): skip checking module.exports in a truthiness call expression (microsoft#48337) LEGO: Merge pull request 48450 LEGO: Merge pull request 48436 fix(48031): show circularity error for self referential get accessor annotations (microsoft#48050) Revert "Fix contextual discrimination for omitted members (microsoft#43937)" (microsoft#48426) ...

Fixes#43646
Very involved with #36556