Skip to content
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

CompletionEntry.insertText #20730

Closed
mjbvz opened this issue Dec 15, 2017 · 1 comment
Closed

CompletionEntry.insertText #20730

mjbvz opened this issue Dec 15, 2017 · 1 comment
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Dec 15, 2017

Problem
#19433 requests the ability to have completion items for symbols that require bracket access, such as obj['space prop']. This is currently implemented using additionalTextEdits, which have their own complications on the VS Code side (see microsoft/vscode#39893).

As a simplified approach that better matches the VS Code API, we would instead like to introduce an insertText property on for CompletionEntry

Proposal
Add a new insertText property on CompletionEntry:

interface CompletionEntry {
    name: string
    ...

    // Text to be inserted instead of `name`.
    insertText?: string
}

When used alongside the replacementSpan property, this would allow us to implement #19433

To keep this change non-breaking, I propose we add a new flag to CompletionsRequestArgs to enable these symbols being returned:

    interface CompletionsRequestArgs extends FileLocationRequestArgs {
      ...
      includeInsertTextCompletions?: boolean;
    }

Completions that require insertText would only be returned if includeInsertTextCompletions is set to true.

includeInsertTextCompletions seems like a poor name. We could be more specific to #19433 and call it includeBracetCompletions

@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Dec 15, 2017
@mhegazy mhegazy added Suggestion An idea for TypeScript API Relates to the public API for TypeScript labels Jan 4, 2018
@mhegazy mhegazy assigned ghost Jan 4, 2018
@mhegazy mhegazy added this to the TypeScript 2.7 milestone Jan 4, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jan 4, 2018

//CC @amcasey since this will have implications on VS.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jan 9, 2018
@mhegazy mhegazy closed this as completed Jan 9, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants