claude-code: add lsp servers support

This commit is contained in:
natsukium 2026-03-08 23:16:06 +09:00 committed by Austin Horstman
parent f0e123a7e2
commit a455ac1bb3
5 changed files with 86 additions and 3 deletions

View file

@ -47,7 +47,7 @@
};
test.asserts.assertions.expected = [
"`programs.claude-code.package` cannot be null when `mcpServers` or `enableMcpIntegration` is configured"
"`programs.claude-code.package` cannot be null when `mcpServers`, `lspServers`, or `enableMcpIntegration` is configured"
"Cannot specify both `programs.claude-code.memory.text` and `programs.claude-code.memory.source`"
"Cannot specify both `programs.claude-code.agents` and `programs.claude-code.agentsDir`"
"Cannot specify both `programs.claude-code.commands` and `programs.claude-code.commandsDir`"

View file

@ -1,6 +1,7 @@
{
claude-code-basic = ./basic.nix;
claude-code-full-config = ./full-config.nix;
claude-code-lsp = ./lsp.nix;
claude-code-mcp = ./mcp.nix;
claude-code-mcp-integration = ./mcp-integration.nix;
claude-code-assertion = ./assertion.nix;

View file

@ -0,0 +1,2 @@
#! /nix/store/00000000000000000000000000000000-bash/bin/bash -e
exec -a "$0" "/nix/store/00000000000000000000000000000000-claude-code/bin/.claude-wrapped" "$@" --plugin-dir /nix/store/00000000000000000000000000000000-claude-code-lsp-plugin

View file

@ -0,0 +1,38 @@
{ config, ... }:
{
programs.claude-code = {
package = config.lib.test.mkStubPackage {
name = "claude-code";
buildScript = ''
mkdir -p $out/bin
touch $out/bin/claude
chmod 755 $out/bin/claude
'';
};
enable = true;
lspServers = {
go = {
command = "gopls";
args = [ "serve" ];
extensionToLanguage = {
".go" = "go";
};
};
typescript = {
command = "typescript-language-server";
args = [ "--stdio" ];
extensionToLanguage = {
".ts" = "typescript";
".tsx" = "typescriptreact";
};
};
};
};
nmt.script = ''
normalizedWrapper=$(normalizeStorePaths home-path/bin/claude)
assertFileContent $normalizedWrapper ${./expected-lsp-wrapper}
'';
}