fix: Updated lsp backend to fix deprecations

This commit is contained in:
FalsePattern 2023-08-12 18:28:03 +02:00
parent 0a62f1b0cb
commit 3e3d955bd1
Signed by: falsepattern
GPG key ID: FDF7126A9E124447
5 changed files with 24 additions and 11 deletions

View file

@ -18,6 +18,12 @@ Changelog structure reference:
## [Unreleased] ## [Unreleased]
### Added
- Proper documentation view (CTRL+Q) instead of the janky hover thing
### Removed
- IDEA 2022 support (Necessary change for the new documentation backend in lsp4intellij)
## [0.5.0] "The *ZON*iverse" ## [0.5.0] "The *ZON*iverse"
### Added ### Added

View file

@ -42,7 +42,7 @@ repositories {
dependencies { dependencies {
compileOnly(libs.annotations) compileOnly(libs.annotations)
implementation("com.github.FalsePattern:lsp4intellij:f557fc84bf") implementation("com.github.FalsePattern:lsp4intellij:ea62500d74")
} }
intellij { intellij {

View file

@ -5,12 +5,12 @@ pluginRepositoryUrl = https://github.com/FalsePattern/ZigBrains
pluginVersion = 0.5.0 pluginVersion = 0.5.0
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 222 pluginSinceBuild = 231
pluginUntilBuild = 232.* pluginUntilBuild = 232.*
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC platformType = IC
platformVersion = 2022.2.5 platformVersion = 2023.1.5
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22

View file

@ -22,17 +22,24 @@ import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications; import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.ProjectActivity;
import com.intellij.openapi.startup.StartupActivity; import com.intellij.openapi.startup.StartupActivity;
import kotlin.Result;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.wso2.lsp4intellij.IntellijLanguageClient; import org.wso2.lsp4intellij.IntellijLanguageClient;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.InvalidPathException; import java.nio.file.InvalidPathException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
public class ZLSStartupActivity implements StartupActivity { public class ZLSStartupActivity implements ProjectActivity {
private static final ReentrantLock lock = new ReentrantLock(); private static final ReentrantLock lock = new ReentrantLock();
public static void initZLS() { public static void initZLS() {
@ -121,15 +128,17 @@ public class ZLSStartupActivity implements StartupActivity {
return true; return true;
} }
@Nullable
@Override @Override
public void runActivity(@NotNull Project project) { public Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) {
var path = AppSettingsState.getInstance().zlsPath; var path = AppSettingsState.getInstance().zlsPath;
if ("".equals(path)) { if ("".equals(path)) {
Notifications.Bus.notify(new Notification("ZigBrains.Nag", "No ZLS binary", Notifications.Bus.notify(new Notification("ZigBrains.Nag", "No ZLS binary",
"Please configure the path to the zls executable in the Zig language configuration menu!", "Please configure the path to the zls executable in the Zig language configuration menu!",
NotificationType.INFORMATION)); NotificationType.INFORMATION));
return; return null;
} }
initZLS(); initZLS();
return null;
} }
} }

View file

@ -55,6 +55,9 @@
id="LSPFoldingRangeProvider" id="LSPFoldingRangeProvider"
order="first"/> order="first"/>
<!-- needed for documentation -->
<platform.backend.documentation.targetProvider implementation="org.wso2.lsp4intellij.contributors.LSPDocumentationTargetProvider"/>
<!-- endregion LSP4IntelliJ --> <!-- endregion LSP4IntelliJ -->
<fileType name="Zig File" <fileType name="Zig File"
@ -115,11 +118,6 @@
<!-- region LSP4IntelliJ --> <!-- region LSP4IntelliJ -->
<!-- needed for hover -->
<action id="org.intellij.sdk.action.QuickDocAction"
class="org.wso2.lsp4intellij.actions.LSPQuickDocAction">
</action>
<!-- needed for find references --> <!-- needed for find references -->
<action class="org.wso2.lsp4intellij.actions.LSPReferencesAction" <action class="org.wso2.lsp4intellij.actions.LSPReferencesAction"
id="LSPFindUsages"> id="LSPFindUsages">