Handle undefined `location.parent` when getting completionEntryDetails
Fixes #54106
Tests are pending because I don't know how to test completionEntryDetails. verify.completions seems to only check completionInfo, and I cannot use the resulting andApplyCodeAction because the entry I want to test doesn't have a description or source (which are needed in the parameter options).
Where is this location coming from? All source files should be bound and have parents, so is this location the SourceFile itself?
Where is this location coming from? All source files should be bound and have parents, so is this location the SourceFile itself?
Correct. So with the example from the bug:
/**/
type lolol = any;
declare const lolol: any;
When explicitly requesting completions in /**/, location will be the source file itself, which causes the error in the line I'm changing.
@jakebailey @DanielRosenwasser @andrewbranch any hints on how I can test this with fourslash?
Are the details in https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralMethod2.ts what you're trying to get at?
Are the details in https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralMethod2.ts what you're trying to get at?
Hmm no this isn't helping me here. The completion entry remains the same with and without my change, like I need to simulate selecting the actual completion to trigger the failure.
Okay I was able to test this with verify.baselineCompletions(). You were right @iisaduan!