Hi,
I am a contributor to a sublime plugin providing LSP support available here and would like to suggest improvements for the Sublime API
on_query_completions
in the Sublime Text API has two major limitations when it comes to auto complete.
First, Sublime Text replaces only the prefix with the user choice for auto completion and doesn’t allow arbitrary text replacment but there are scenarios were completion has to replace before the prefix. This is very common for LSP servers.
Example:
// first
def myF<ctrl+space>
// could lead to
override def myFunction1(): Unit = ???
// but currently leads to this invalid code :(
def override def myFunction1(): Unit = ???
Notice that we have to do something before the prefix myF
.
So one feature request would be to allow on_query_completions
(or have an other function) to return with each user choice the range (or the start position) from which we do the replacement.
Second limitation is the lack of callback, once the user has made the choice for the auto complete there is no way to know which choice the user made. This is again needed for LSP implementations.
Example: after completing to function name
new SimpleFileVisitor[Path] {
override def visitFil<ctrl+space>
}
.We need to insert add an import
import java.nio.file.attribute.BasicFileAttributes
new SimpleFileVisitor[Path] {
override def visitFil<ctrl+space>
}
So the feature request would be to allow registering a callback with result of on_query_completions
to be called after user choice.
These two features would allow developers to provide a better user experience related to auto complete