backport: 17.3.0
This commit is contained in:
parent
0596c5cafb
commit
9df5793581
9 changed files with 156 additions and 12 deletions
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -17,6 +17,23 @@ Changelog structure reference:
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [17.3.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Zig
|
||||
- Structure view
|
||||
|
||||
### Changed
|
||||
|
||||
- LSP
|
||||
- Updated to LSP4IJ 0.6.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Project
|
||||
- CLion will no longer prompt you to import zig projects as CMake
|
||||
|
||||
## [17.2.0]
|
||||
|
||||
### Added
|
||||
|
|
|
@ -14,7 +14,7 @@ plugins {
|
|||
java
|
||||
`maven-publish`
|
||||
`java-library`
|
||||
id("org.jetbrains.intellij.platform") version("2.0.1")
|
||||
id("org.jetbrains.intellij.platform") version("2.1.0")
|
||||
id("org.jetbrains.changelog") version("2.2.1")
|
||||
id("org.jetbrains.grammarkit") version("2022.3.2.2")
|
||||
id("de.undercouch.download") version("5.6.0")
|
||||
|
@ -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 lsp4jVersion = "0.21.1"
|
||||
val lsp4ijVersion = "0.5.0"
|
||||
val lsp4ijVersion = "0.6.0"
|
||||
|
||||
val lsp4ijNightly = lsp4ijVersion.contains("-")
|
||||
val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion"
|
||||
|
@ -105,7 +105,7 @@ allprojects {
|
|||
dependencies {
|
||||
compileOnly("org.projectlombok:lombok:1.18.32")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.32")
|
||||
if (path !in listOf(":", ":plugin", ":debugger")) {
|
||||
if (path !in listOf(":", ":plugin", ":debugger", ":cidr")) {
|
||||
intellijPlatform {
|
||||
intellijIdeaCommunity(ideaVersion, useInstaller = false)
|
||||
}
|
||||
|
@ -224,6 +224,19 @@ project(":project") {
|
|||
}
|
||||
}
|
||||
|
||||
project(":cidr") {
|
||||
dependencies {
|
||||
implementation(project(":common"))
|
||||
implementation(project(":project"))
|
||||
intellijPlatform {
|
||||
clion(clionVersion, useInstaller = false)
|
||||
for (p in clionPlugins) {
|
||||
bundledPlugin(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project(":debugger") {
|
||||
dependencies {
|
||||
implementation(project(":zig"))
|
||||
|
@ -280,6 +293,7 @@ project(":plugin") {
|
|||
implementation(project(":zig"))
|
||||
implementation(project(":project"))
|
||||
implementation(project(":zon"))
|
||||
implementation(project(":cidr"))
|
||||
implementation(project(":debugger"))
|
||||
intellijPlatform {
|
||||
zipSigner()
|
||||
|
|
|
@ -11,10 +11,10 @@ baseIDE=clion
|
|||
ideaVersion=2024.2.2
|
||||
clionVersion=2024.2.2
|
||||
|
||||
pluginVersion=17.2.0
|
||||
pluginVersion=17.3.0
|
||||
|
||||
# Gradle Releases -> https://github.com/gradle/gradle/releases
|
||||
gradleVersion=8.10.1
|
||||
gradleVersion=8.10.2
|
||||
|
||||
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
|
||||
# TODO grammarkit breaks with this
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.falsepattern.zigbrains.cidr.workspace;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.jetbrains.cidr.external.system.workspace.ExternalWorkspace;
|
||||
import com.jetbrains.cidr.lang.toolchains.CidrToolEnvironment;
|
||||
import com.jetbrains.cidr.toolchains.EnvironmentProblems;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ZigExternalWorkspace extends ExternalWorkspace {
|
||||
public ZigExternalWorkspace(@NotNull Project project) {
|
||||
super(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable CidrToolEnvironment createEnvironment(@Nullable Project project, @Nullable String s, @NotNull EnvironmentProblems environmentProblems, boolean b, @Nullable Runnable runnable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getClientKey() {
|
||||
return "ZIG_WORKSPACE";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.falsepattern.zigbrains.cidr.workspace;
|
||||
|
||||
import com.falsepattern.zigbrains.project.util.ProjectUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.jetbrains.cidr.project.workspace.CidrWorkspace;
|
||||
import com.jetbrains.cidr.project.workspace.CidrWorkspaceManager;
|
||||
import com.jetbrains.cidr.project.workspace.CidrWorkspaceProvider;
|
||||
import lombok.Cleanup;
|
||||
import lombok.val;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class ZigWorkspaceProvider implements CidrWorkspaceProvider {
|
||||
private @Nullable ZigExternalWorkspace getExistingWorkspace(@NotNull Project project) {
|
||||
val workspaces = CidrWorkspaceManager.getInstance(project).getWorkspaces().keySet();
|
||||
for (val ws: workspaces) {
|
||||
if (ws instanceof ZigExternalWorkspace zew)
|
||||
return zew;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public @Nullable CidrWorkspace getWorkspace(@NotNull Project project) {
|
||||
val existingWorkspace = getExistingWorkspace(project);
|
||||
if (existingWorkspace != null) {
|
||||
return existingWorkspace;
|
||||
}
|
||||
val projectDir = ProjectUtil.guessProjectDir(project);
|
||||
try {
|
||||
@Cleanup val files = Files.walk(projectDir);
|
||||
if (files.anyMatch(file -> file.getFileName().toString().endsWith(".zig") || file.getFileName().toString().endsWith(".zig.zon"))) {
|
||||
return new ZigExternalWorkspace(project);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWorkspace(@NotNull Project project) {
|
||||
if (getExistingWorkspace(project) != null) {
|
||||
return;
|
||||
}
|
||||
val workspace = getWorkspace(project);
|
||||
if (workspace != null) {
|
||||
val manager = CidrWorkspaceManager.getInstance(project);
|
||||
manager.markInitializing(workspace);
|
||||
manager.markInitialized(workspace);
|
||||
manager.markLoading(workspace);
|
||||
manager.markLoaded(workspace);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<!--
|
||||
~ Copyright 2023-2024 FalsePattern
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<idea-plugin package="com.falsepattern.zigbrains.cidr.workspace">
|
||||
<depends>com.intellij.cidr.base</depends>
|
||||
<extensions defaultExtensionNs="cidr.project">
|
||||
<workspaceProvider implementation="com.falsepattern.zigbrains.cidr.workspace.ZigWorkspaceProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
|
@ -49,6 +49,10 @@
|
|||
<lang.foldingBuilder language="Zig"
|
||||
implementationClass="com.redhat.devtools.lsp4ij.features.foldingRange.LSPFoldingRangeBuilder"
|
||||
order="first"/>
|
||||
<!-- LSP textDocument/documentSymbol -->
|
||||
<lang.psiStructureViewFactory
|
||||
language="Zig"
|
||||
implementationClass="com.redhat.devtools.lsp4ij.features.documentSymbol.LSPDocumentSymbolStructureViewFactory"/>
|
||||
|
||||
<notificationGroup displayType="BALLOON"
|
||||
bundle="zigbrains.Bundle"
|
||||
|
@ -65,7 +69,7 @@
|
|||
name="Zig ZLS"
|
||||
factoryClass="com.falsepattern.zigbrains.zig.lsp.ZLSLanguageServerFactory">
|
||||
<description><![CDATA[
|
||||
The <a href="https://github.com/Zigtools/ZLS">Zig Language Server</a>, for ZigBrains
|
||||
The <a href="https://github.com/Zigtools/ZLS">Zig Language Server</a>, via ZigBrains
|
||||
]]>
|
||||
</description>
|
||||
</server>
|
||||
|
@ -181,6 +185,7 @@ The <a href="https://github.com/Zigtools/ZLS">Zig Language Server</a>, for ZigBr
|
|||
</actions>
|
||||
<!-- endregion Project -->
|
||||
|
||||
<depends optional="true" config-file="zigbrains-zig-cidr-workspace.xml">com.intellij.cidr.base</depends>
|
||||
<depends optional="true" config-file="zigbrains-zig-debugger.xml">com.intellij.modules.cidr.debugger</depends>
|
||||
<depends optional="true" config-file="zigbrains-zig-clion.xml">com.intellij.modules.clion</depends>
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.falsepattern.zigbrains.common.util.StringUtil;
|
|||
import com.falsepattern.zigbrains.zig.environment.ZLSConfigProvider;
|
||||
import com.falsepattern.zigbrains.zig.settings.ZLSProjectSettingsService;
|
||||
import com.google.gson.Gson;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationType;
|
||||
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.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider;
|
||||
import com.redhat.devtools.lsp4ij.server.ProcessStreamConnectionProvider;
|
||||
import lombok.val;
|
||||
|
||||
|
@ -27,19 +29,22 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class ZLSStreamConnectionProvider extends ProcessStreamConnectionProvider {
|
||||
public class ZLSStreamConnectionProvider extends OSProcessStreamConnectionProvider {
|
||||
private static final Logger LOG = Logger.getInstance(ZLSStreamConnectionProvider.class);
|
||||
public ZLSStreamConnectionProvider(Project project) {
|
||||
val command = getCommand(project);
|
||||
val projectDir = ProjectUtil.guessProjectDir(project);
|
||||
if (projectDir != null) {
|
||||
setWorkingDirectory(projectDir.getPath());
|
||||
}
|
||||
GeneralCommandLine commandLine;
|
||||
try {
|
||||
setCommands(command.get());
|
||||
commandLine = new GeneralCommandLine(command.get());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (projectDir != null) {
|
||||
commandLine.setWorkDirectory(projectDir.getPath());
|
||||
}
|
||||
setCommandLine(commandLine);
|
||||
}
|
||||
|
||||
private static List<String> doGetCommand(Project project) {
|
||||
|
|
Loading…
Add table
Reference in a new issue