Skip to content

Handle replaceStart/replaceEnd in completion proposal - #526

Open
Mathias Fußenegger (mfussenegger) wants to merge 2 commits into
microsoft:mainfrom
mfussenegger:completion-inserttext
Open

Handle replaceStart/replaceEnd in completion proposal#526
Mathias Fußenegger (mfussenegger) wants to merge 2 commits into
microsoft:mainfrom
mfussenegger:completion-inserttext

Conversation

@mfussenegger

@mfusseneggerMathias Fußenegger (mfussenegger) commented Dec 8, 2023

Copy link
Copy Markdown
Contributor

First commit is from #525


Second commit fixes#524
Ensures completion text can be appended by clients

E.g.

For com.| the completion proposal has:

completion: com.sun.jndi.ldap.pool
completionLocation: 3
replaceEnd: 4
replaceStart: 0

insertText will be sun.jndi.ldap.pool

For List.| the completion proposal has:

completion: of()
completionLocation: 4
replaceStart: 5
replaceEnd: 5

insertText will be of()

I didn't find any existing completion tests, so not sure how to write a test case for this

Fixes build errors. The old location is no longer available:
https://download.eclipse.org/releases/2023-12/202311171000/ returns 404
@mfusseneggerMathias Fußenegger (mfussenegger) changed the title completion inserttextHandle replaceStart/replaceEnd in completion proposalDec 8, 2023
Fixesmicrosoft#524
Ensures completion text can be appended by clients
E.g.
For `com.|` the completion proposal has:
completion: com.sun.jndi.ldap.pool
completionLocation: 3
replaceEnd: 4
replaceStart: 0
`insertText` will be `sun.jndi.ldap.pool`
For `List.|` the completion proposal has:
completion: of()
completionLocation: 4
replaceStart: 5
replaceEnd: 5
`insertText` will be `of()`
@mfussenegger

Copy link
Copy Markdown
ContributorAuthor

Any chance to get some feedback on this?

$.setInsertText(insertText.substring(prefix));
} else {
$.setInsertText(insertText);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work for VS Code. Typing Sys to trigger completion, select System and it becomes tem.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CompletionItem of completions response always have start = 0 and text prefix inclusion is mixed

3 participants

@mfussenegger@testforstephen@Jorgep77