Skip to content
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

Fixed override-only JB warning #38

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading