Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Send correct replacement range information (use OptionalReplacementSpan) #155

Closed

Description

Raised from: microsoft/vscode#134328
and: microsoft/vscode#134328 (comment)

It looks like this plugin doesn't send back the proper range information. meaning replacements and edits are a bit screwed up. OptionalReplacementSpan could help with this.

Looking at CompletionInfo theres a new property OptionalReplacementSpan I think maybe this needs adding. It could help with this issue

You can see we don't send it here:

function translateCompletionItemsToCompletionInfo(
typescript: typeof ts,
items: vscode.CompletionList
): ts.WithMetadata<ts.CompletionInfo> {
return {
metadata: {
isIncomplete: items.isIncomplete,
},
isGlobalCompletion: false,
isMemberCompletion: false,
isNewIdentifierLocation: false,
entries: items.items.map(x => translateCompetionEntry(typescript, x)),
};
}

Also, try setting the replacementSpan property for each CompletionEntry
https://github.com/microsoft/TypeScript/blob/main/lib/tsserverlibrary.d.ts#L6295

Activity

  1. jasonwilliams commented on Nov 20, 2021

    @jasonwilliams
    ContributorAuthor
  2. jasonwilliams commented on Nov 20, 2021

    @jasonwilliams
    ContributorAuthor

    See microsoft/vscode#134328 (comment) for update. ReplacementSpan needs to be set inside of completionEntry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy