Skip to content

Commit

Permalink
Fixed override-only JB warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kizeevov committed Mar 20, 2024
1 parent 5c47e08 commit 9f0f9f0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pluginRepositoryUrl = https://github.com/kizeevov/slint-idea-plugin

pluginGroup = dev.slint
pluginName = SlintPlugin
pluginVersion = 1.0.0
pluginVersion = 1.0.1
platformType = IU
# platformType = CL
platformVersion = 232-EAP-SNAPSHOT
Expand Down
85 changes: 47 additions & 38 deletions src/main/kotlin/dev/slint/ideaplugin/ide/lsp/LspLanguageClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,108 @@ import org.eclipse.lsp4j.*
import org.eclipse.lsp4j.jsonrpc.services.JsonNotification
import java.util.concurrent.CompletableFuture

class LspLanguageClient(serverNotificationsHandler: LspServerNotificationsHandler, project: Project)
: Lsp4jClient(LspServerNotificationsMiddleware(serverNotificationsHandler, project)) {
class LspLanguageClient(project: Project) :
Lsp4jClient(LspServerNotificationsMiddleware(project)) {
@JsonNotification("experimental/serverStatus")
fun serverStatus(status: Any?) {}
fun serverStatus(status: Any?) {
}
}

@Suppress("OverrideOnly")

class LspServerNotificationsMiddleware(
private val serverNotificationsHandler: LspServerNotificationsHandler,
project: Project
): LspServerNotificationsHandler {

) : LspServerNotificationsHandler {
private val fileEditorService = project.service<FileEditorService>()

override fun applyEdit(params: ApplyWorkspaceEditParams): CompletableFuture<ApplyWorkspaceEditResponse> {
fileEditorService.applyEdit(params)
return CompletableFuture.supplyAsync {
null
ApplyWorkspaceEditResponse(true)
}
}

override fun configuration(params: ConfigurationParams): CompletableFuture<List<Any?>> {
return serverNotificationsHandler.configuration(params)
return CompletableFuture.supplyAsync {
null
}
}

override fun createProgress(params: WorkDoneProgressCreateParams): CompletableFuture<Void> {
return serverNotificationsHandler.createProgress(params)
return CompletableFuture.supplyAsync {
null
}
}

override fun logMessage(params: MessageParams) {
return serverNotificationsHandler.logMessage(params)
}
override fun logMessage(params: MessageParams) {}

override fun logTrace(params: LogTraceParams) {
return serverNotificationsHandler.logTrace(params)
}
override fun logTrace(params: LogTraceParams) {}

override fun notifyProgress(params: ProgressParams) {
return serverNotificationsHandler.notifyProgress(params)
}
override fun notifyProgress(params: ProgressParams) {}

override fun publishDiagnostics(params: PublishDiagnosticsParams) {
return serverNotificationsHandler.publishDiagnostics(params)
}
override fun publishDiagnostics(params: PublishDiagnosticsParams) {}

override fun refreshCodeLenses(): CompletableFuture<Void> {
return serverNotificationsHandler.refreshCodeLenses()
return CompletableFuture.supplyAsync {
null
}
}

override fun refreshDiagnostics(): CompletableFuture<Void> {
return serverNotificationsHandler.refreshDiagnostics()
return CompletableFuture.supplyAsync {
null
}
}

override fun refreshInlayHints(): CompletableFuture<Void> {
return serverNotificationsHandler.refreshInlayHints()
return CompletableFuture.supplyAsync {
null
}
}

override fun refreshInlineValues(): CompletableFuture<Void> {
return serverNotificationsHandler.refreshInlineValues()
return CompletableFuture.supplyAsync {
null
}
}

override fun refreshSemanticTokens(): CompletableFuture<Void> {
return serverNotificationsHandler.refreshSemanticTokens()
return CompletableFuture.supplyAsync {
null
}
}

override fun registerCapability(params: RegistrationParams): CompletableFuture<Void> {
return serverNotificationsHandler.registerCapability(params)
return CompletableFuture.supplyAsync {
null
}
}

override fun showDocument(params: ShowDocumentParams): CompletableFuture<ShowDocumentResult> {
fileEditorService.showDocument(params)
return CompletableFuture.supplyAsync {
null
ShowDocumentResult(true)
}
}

override fun showMessage(params: MessageParams) {
return serverNotificationsHandler.showMessage(params)
}
override fun showMessage(params: MessageParams) {}

override fun showMessageRequest(params: ShowMessageRequestParams): CompletableFuture<MessageActionItem> {
return serverNotificationsHandler.showMessageRequest(params)
return CompletableFuture.supplyAsync {
null
}
}

override fun telemetryEvent(`object`: Any) {
return serverNotificationsHandler.telemetryEvent(`object`)
}
override fun telemetryEvent(`object`: Any) {}

override fun unregisterCapability(params: UnregistrationParams): CompletableFuture<Void> {
return serverNotificationsHandler.unregisterCapability(params)
return CompletableFuture.supplyAsync {
null
}
}

override fun workspaceFolders(): CompletableFuture<List<WorkspaceFolder>> {
return serverNotificationsHandler.workspaceFolders()
return CompletableFuture.supplyAsync {
null
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class SlintLspServerDescriptor(project: Project) : ProjectWideLspServerDescripto

override fun createInitializationOptions(): Any = SlintSettingsState.getInstance().lspSettings

override fun createLsp4jClient(handler: LspServerNotificationsHandler): Lsp4jClient =
LspLanguageClient(handler, project)
override fun createLsp4jClient(handler: LspServerNotificationsHandler): Lsp4jClient = LspLanguageClient(project)

override fun startServerProcess(): OSProcessHandler =
ServerProcessHandler.addListeners(super.startServerProcess(), project)
Expand Down

0 comments on commit 9f0f9f0

Please sign in to comment.