Path completions from subpath exports containing /
have broken replacement range
#57313
Labels
Bug
A bug in TypeScript
Domain: Completion Lists
The issue relates to showing completion lists in an editor
Help Wanted
You can do this
Milestone
Fourslash test:
The actual replacement range is the full module specifier. (VS Code shows nothing since the text of the replacement range doesn’t match the insertion text.) The root cause is #41412. At the time, only full module specifiers from
compilerOptions.paths
were able to return slashes (I guess?).The replacement range logic is really overcomplicated and based on weird heuristics like this. I think it would be simpler and more reliable for path completions to always return entries with replacement ranges equal to the entire string literal (and with text starting from the beginning of the string literal), instead of sometimes returning fragments intended to be inserted after the last slash. However, the existing code makes this really difficult, as nearly all functions directly mutate the set of results without having any knowledge of what’s already been typed in the string literal.
Originally reported at #56412 (comment)
The text was updated successfully, but these errors were encountered: