-
Notifications
You must be signed in to change notification settings - Fork 13
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
[VS Classic] Distinguish multiline and single line completions #9
Comments
Current behavior:
|
@olegklimov Currently the the lsp server returns completion suggestions by providing the text that should go after the current cursor position. If you want the completion to replace white space the code should use a different endpoint for the completions. If the lsp server supported textDocument/inlineCompletion from the latest spec that could be used instead which would provide the information needed to replace white space on the current line. |
@olegklimov just to clarify if the cursor is at the end of the line it should use the multi line version. Is that right? |
No, if the cursor line is empty or has only spaces => multiline (this happens often when you hit Enter) |
* adding files for refact extension * testing github workflow * removing default exe to test workflow * uploading artifacts in workflow * readding exe * cleaning up files * C/C++ now works with grey text * fixed minor typo * can now select intellisense options, whitespace causes less problems for grey text completions and the code will only ask for completions when the cursor is at the end of a line * removing binary and updating build scripts * fixing build script typo * fixing minor build naming issue * Updating code to be consistent with new build script * improved the options page * added comments and fixed formatting * updating enter behaviour * fixing minor bugs and functional issues * added code to fix issues around single vs multiline completions issues #9 and #6 * added scroll bars for the options page * adding status bar and killing server process on shutdown * fixing minor bug where grey text was inserted into incorrect places
This works. There are still problems with overlapping characters but that one works. |
Multi line completion -- should happen when the cursor is on a empty string, or on a string with only spaces.
A typical example of multi line completion:
User hits Enter, IDE provides auto-indent, and then a function body should appear as grey text.
To implement it, the plugin should check if the line is empty or it has only spaces, then delete all the spaces on the empty line (in memory, not in the editor), and then request the model for completions.
It's important to delete spaces before asking the model, because there should be a way for the model to suggest code with less indent. Typical example of this:
Now the completion is "}", but it will not work unless there are no spaces on that line. With spaces, the model is constrained to " }".
Now the single line completion should happen when the current line is not empty, and there is nothing except closing special characters on the right:
If
multiline=false
, the model will return only the remainder of the current line, and stop. The plugin needs to replace the line ending in the editor with the new completion given by the model.If the cursor is not exactly on the last character of the current line, then #6 about how to deal with that case.
The text was updated successfully, but these errors were encountered: