feat: LSP4IJ 0.6.0

This commit is contained in:
FalsePattern 2024-09-27 13:38:59 +02:00
parent c1584a5081
commit 32f13aae72
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
3 changed files with 16 additions and 6 deletions

View file

@ -17,6 +17,11 @@ Changelog structure reference:
## [Unreleased] ## [Unreleased]
### Changed
- LSP
- Updated to LSP4IJ 0.6.0
### Fixed ### Fixed
- Project - Project

View file

@ -40,7 +40,7 @@ val clionVersion = properties("clionVersion").get()
val clionPlugins = listOf("com.intellij.clion", "com.intellij.cidr.lang", "com.intellij.cidr.base", "com.intellij.nativeDebug") val clionPlugins = listOf("com.intellij.clion", "com.intellij.cidr.lang", "com.intellij.cidr.base", "com.intellij.nativeDebug")
val lsp4jVersion = "0.21.1" val lsp4jVersion = "0.21.1"
val lsp4ijVersion = "0.5.0" val lsp4ijVersion = "0.6.0"
val lsp4ijNightly = lsp4ijVersion.contains("-") val lsp4ijNightly = lsp4ijVersion.contains("-")
val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion" val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion"

View file

@ -4,6 +4,7 @@ import com.falsepattern.zigbrains.common.util.StringUtil;
import com.falsepattern.zigbrains.zig.environment.ZLSConfigProvider; import com.falsepattern.zigbrains.zig.environment.ZLSConfigProvider;
import com.falsepattern.zigbrains.zig.settings.ZLSProjectSettingsService; import com.falsepattern.zigbrains.zig.settings.ZLSProjectSettingsService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.notification.Notification; import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType; import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications; import com.intellij.notification.Notifications;
@ -13,6 +14,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider;
import com.redhat.devtools.lsp4ij.server.ProcessStreamConnectionProvider; import com.redhat.devtools.lsp4ij.server.ProcessStreamConnectionProvider;
import lombok.val; import lombok.val;
@ -27,19 +29,22 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
public class ZLSStreamConnectionProvider extends ProcessStreamConnectionProvider { public class ZLSStreamConnectionProvider extends OSProcessStreamConnectionProvider {
private static final Logger LOG = Logger.getInstance(ZLSStreamConnectionProvider.class); private static final Logger LOG = Logger.getInstance(ZLSStreamConnectionProvider.class);
public ZLSStreamConnectionProvider(Project project) { public ZLSStreamConnectionProvider(Project project) {
val command = getCommand(project); val command = getCommand(project);
val projectDir = ProjectUtil.guessProjectDir(project); val projectDir = ProjectUtil.guessProjectDir(project);
if (projectDir != null) { GeneralCommandLine commandLine;
setWorkingDirectory(projectDir.getPath());
}
try { try {
setCommands(command.get()); commandLine = new GeneralCommandLine(command.get());
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
if (projectDir != null) {
commandLine.setWorkDirectory(projectDir.getPath());
}
setCommandLine(commandLine);
} }
private static List<String> doGetCommand(Project project) { private static List<String> doGetCommand(Project project) {