-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4927f5c
commit ab63a53
Showing
6 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/nixos/idea/lsp/NixLspServerSupportProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.nixos.idea.lsp; | ||
|
||
import com.intellij.execution.ExecutionException; | ||
import com.intellij.execution.configurations.GeneralCommandLine; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
import com.intellij.platform.lsp.api.LspServerSupportProvider; | ||
import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.nixos.idea.file.NixFileType; | ||
|
||
@SuppressWarnings("UnstableApiUsage") | ||
public class NixLspServerSupportProvider implements LspServerSupportProvider { | ||
@Override | ||
public void fileOpened(@NotNull Project project, @NotNull VirtualFile virtualFile, @NotNull LspServerStarter lspServerStarter) { | ||
if (virtualFile.getFileType() == NixFileType.INSTANCE) { | ||
lspServerStarter.ensureServerStarted(new NixLspServerDescriptor(project)); | ||
} | ||
} | ||
|
||
private static final class NixLspServerDescriptor extends ProjectWideLspServerDescriptor { | ||
public NixLspServerDescriptor(@NotNull Project project) { | ||
super(project, "nix --extra-experimental-features nix-command --extra-experimental-features flakes run nixpkgs#nixd"); | ||
} | ||
|
||
@Override | ||
public @NotNull GeneralCommandLine createCommandLine() throws ExecutionException { | ||
return new GeneralCommandLine(); | ||
} | ||
|
||
@Override | ||
public boolean isSupportedFile(@NotNull VirtualFile virtualFile) { | ||
return virtualFile.getFileType() == NixFileType.INSTANCE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters