Skip to content

Commit

Permalink
fix: remove hacky LSP4IJ formatter workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Oct 3, 2024
1 parent 91ad1f7 commit 948d566
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 120 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0"
val lsp4ijVersion = "0.6.1-20241003-152535"

val lsp4ijNightly = lsp4ijVersion.contains("-")
val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion"
Expand Down
7 changes: 0 additions & 7 deletions modules/plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@

<lang.formatter language="Zig" implementationClass="com.falsepattern.zigbrains.zig.formatter.ZigFormattingModelBuilder"/>


<!--
TODO remove these two once https://github.com/redhat-developer/lsp4ij/issues/424 is resolved
-->
<formattingService id = "ZigLSPFormattingOnlyServiceProxy" implementation="com.falsepattern.zigbrains.zig.formatter.ZigLSPFormattingOnlyServiceProxy"/>
<formattingService id = "ZigLSPFormattingAndRangeBothServiceProxy" implementation="com.falsepattern.zigbrains.zig.formatter.ZigLSPFormattingAndRangeBothServiceProxy"/>

<postStartupActivity implementation="com.falsepattern.zigbrains.zig.lsp.ZLSStartupActivity"/>

<!-- LSP textDocument/signatureHelp -->
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.falsepattern.zigbrains.zig.lsp;

import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.redhat.devtools.lsp4ij.LanguageServerEnablementSupport;
import com.redhat.devtools.lsp4ij.LanguageServerFactory;
import com.redhat.devtools.lsp4ij.client.LanguageClientImpl;
import com.redhat.devtools.lsp4ij.client.features.LSPClientFeatures;
import com.redhat.devtools.lsp4ij.client.features.LSPFormattingFeature;
import com.redhat.devtools.lsp4ij.server.StreamConnectionProvider;
import org.jetbrains.annotations.NotNull;

Expand All @@ -14,6 +17,18 @@ public class ZLSLanguageServerFactory implements LanguageServerFactory, Language
return new ZLSStreamConnectionProvider(project);
}

@SuppressWarnings("UnstableApiUsage")
@Override
public @NotNull LSPClientFeatures createClientFeatures() {
return new LSPClientFeatures()
.setFormattingFeature(new LSPFormattingFeature() {
@Override
protected boolean isExistingFormatterOverrideable(@NotNull PsiFile file) {
return true;
}
});
}

@Override
public @NotNull LanguageClientImpl createLanguageClient(@NotNull Project project) {
return new ZLSLanguageClient(project);
Expand Down

0 comments on commit 948d566

Please sign in to comment.