-
Notifications
You must be signed in to change notification settings - Fork 1
Adding code completion #87
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
base: main
Are you sure you want to change the base?
Conversation
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.
Overall this is really nice in my opinion, I think the API could be improved by not hiding CompletableFuture as that gives more control to implementations (if we then see we tend to repeat boilerplate code around CF we can always include a default base completion engine as an abstract base class)
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/CompletionEngine.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Outdated
Show resolved
Hide resolved
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.
I do not know enough about this library to provide a meaningful review, so I just provided some comments
library/src/main/kotlin/com/strumenta/kolasu/languageserver/CompletionEngine.kt
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Show resolved
Hide resolved
library/src/main/kotlin/com/strumenta/kolasu/languageserver/KolasuServer.kt
Outdated
Show resolved
Hide resolved
): CompletableFuture<CompletionItem> = | ||
CompletableFuture.completedFuture( | ||
try { completionEngine?.resolve(item) ?: item } | ||
catch (t: Throwable) { |
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.
It's rarely appropriate to catch Throwable as that includes system errors such as OutOfMemoryError so unless there are compelling reasons to keep it like that I'd just catch Exception
item: CompletionItem | ||
): CompletableFuture<CompletionItem> = | ||
CompletableFuture.completedFuture( | ||
try { completionEngine?.resolve(item) ?: item } |
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.
I would have moved this CompletableFuture to the engine interface as well for consistency, even though we've rarely used that method. However we can keep it like that and open an issue if this is blocking further work on code completion.
Description
Testing
Checklist