-
Notifications
You must be signed in to change notification settings - Fork 183
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
Completion with text edits #602
Conversation
This looks great! Nice job 👏 The only example I can think of is when // before
val name = "John"
val message = """
Hello $nam<COMPLETE>
"""
// after
val name = "John"
val message = s"""
Hello $name
"""
|
@tomv564 Have you considered saving the |
Thanks for testing this so quickly, great to see your demo. Forgot to mention here, but @ayoub-benali your suggestions in #536 were key to getting this done! In your example it's pretty clear that an import occurred, but imports added to the top won't be visible when you're two pages down. What do you think of showing a popup briefly (or less visibly, a message in the status bar)? |
I think a status bar message is fine because in my example an import was added but in general we don't know which kind of text edits are sent by the server |
completion inside double quoted text isn't even triggered by sublime text see sublimehq/sublime_text#2793 Something has to be on sublime side before we can test this case |
@ayoub-benali LSP should already do what you suggested, the logic is roughly if item.additionalTextEdits:
apply_additional_edits(item.additionalTextEdits)
elif resolveProvider:
resolve_completion_item(item) |
Awesome ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working fine for clangd.
Sets up a post-completion hook so we can:
completionItem/resolve
is used to get the additionalTextEdits if the server indicates support.Code is tested using examples given in issues, but more live testing with specific servers is needed!
Assumptions:
'commit_completion', 'insert_best_completion', 'auto_complete'
runs, the nexton_modified
is the insertion of the completion.To do: