From 943ea622ac95ad632a20b3122eba85d43736f06d Mon Sep 17 00:00:00 2001 From: keito4 Date: Sun, 4 Jan 2026 05:09:06 +0000 Subject: [PATCH 1/4] feat: fix LSP configuration for Claude Code integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix plugin.json to use correct lspServers key (not languageServers) - Use extensionToLanguage mapping (not filetypes) - Add setup-lsp.sh script for automatic Language Server installation - Update devcontainer.json to run setup-lsp.sh in postCreateCommand - Update npm/global.json with latest Language Server versions - Update devcontainer-checklist.md with correct LSP configuration format 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude-plugin/plugin.json | 30 +++++++---- .claude/commands/devcontainer-checklist.md | 17 ++++++- .devcontainer/devcontainer.json | 2 +- npm/global.json | 8 +-- script/setup-lsp.sh | 59 ++++++++++++++++++++++ 5 files changed, 100 insertions(+), 16 deletions(-) create mode 100755 script/setup-lsp.sh diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index a0bbe1d2..9cf1627a 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -2,30 +2,42 @@ "name": "config-lsp", "version": "1.0.0", "description": "Language Server Protocol configuration for Claude Code", - "languageServers": { + "lspServers": { "typescript": { "command": "typescript-language-server", "args": ["--stdio"], - "filetypes": ["javascript", "javascriptreact", "typescript", "typescriptreact"], - "rootPatterns": ["package.json", "tsconfig.json"] + "extensionToLanguage": { + ".js": "javascript", + ".jsx": "javascriptreact", + ".ts": "typescript", + ".tsx": "typescriptreact", + ".mjs": "javascript", + ".cjs": "javascript" + } }, "bash": { "command": "bash-language-server", "args": ["start"], - "filetypes": ["sh", "bash"], - "rootPatterns": [".git"] + "extensionToLanguage": { + ".sh": "sh", + ".bash": "bash" + } }, "json": { "command": "vscode-json-language-server", "args": ["--stdio"], - "filetypes": ["json", "jsonc"], - "rootPatterns": ["package.json"] + "extensionToLanguage": { + ".json": "json", + ".jsonc": "jsonc" + } }, "yaml": { "command": "yaml-language-server", "args": ["--stdio"], - "filetypes": ["yaml", "yml"], - "rootPatterns": [".git"] + "extensionToLanguage": { + ".yaml": "yaml", + ".yml": "yml" + } } } } diff --git a/.claude/commands/devcontainer-checklist.md b/.claude/commands/devcontainer-checklist.md index 00f41985..5c4d9a37 100644 --- a/.claude/commands/devcontainer-checklist.md +++ b/.claude/commands/devcontainer-checklist.md @@ -90,13 +90,18 @@ ls -la .claude-plugin/plugin.json # LSP設定ファイルの内容確認 cat .claude-plugin/plugin.json + +# lspServersキーが正しく設定されているか確認 +cat .claude-plugin/plugin.json | jq '.lspServers | keys' ``` **確認ポイント:** - [ ] `.claude-plugin/plugin.json` が存在する - [ ] JSONが正しくフォーマットされている +- [ ] `lspServers` キーが使用されている(`languageServers` ではない) - [ ] 4つのLanguage Server設定が含まれている(typescript, bash, json, yaml) +- [ ] 各サーバーに `extensionToLanguage` マッピングが設定されている ### Claude Code LSP機能の確認 @@ -293,13 +298,21 @@ act -l ### LSPが動作しない場合 ```bash -# Language Serverを手動でインストール +# Language Serverセットアップスクリプトを実行 +bash script/setup-lsp.sh + +# または手動でインストール npm install -g typescript-language-server typescript bash-language-server vscode-langservers-extracted yaml-language-server +# LSP設定ファイルの確認 +cat .claude-plugin/plugin.json | jq '.lspServers | keys' + # Claude Codeを再起動 # VS Code/Cursorを再起動 ``` +**注意**: LSP設定では `lspServers` キーと `extensionToLanguage` プロパティを使用してください。古い形式の `languageServers` と `filetypes` は動作しません。 + ### 環境変数が読み込まれない場合 ```bash @@ -337,4 +350,4 @@ npm run format:check && npm run lint && npm test --- **最終更新**: 2026-01-04 -**対象バージョン**: Claude Code 2.0.76+, DevContainer config-base 1.42.0+ +**対象バージョン**: Claude Code 2.0.76+, DevContainer config-base 1.43.0+ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a0c6453e..3de4a094 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -50,6 +50,6 @@ } } }, - "postCreateCommand": "bash script/setup-env.sh && bash script/setup-mcp.sh && sudo chown -R vscode:vscode /workspaces/config && npm ci && npm run prepare && cp -r /tmp/.husky /workspaces/config/ && cp git/commitlint.config.js commitlint.config.js && bash script/sync-claude-commands.sh && /usr/local/bin/setup-claude.sh", + "postCreateCommand": "bash script/setup-env.sh && bash script/setup-mcp.sh && sudo chown -R vscode:vscode /workspaces/config && npm ci && npm run prepare && cp -r /tmp/.husky /workspaces/config/ && cp git/commitlint.config.js commitlint.config.js && bash script/sync-claude-commands.sh && bash script/setup-lsp.sh && /usr/local/bin/setup-claude.sh", "runArgs": ["--env-file=${localEnv:HOME}/.devcontainer.env"] } diff --git a/npm/global.json b/npm/global.json index 7edf8e96..c5359c08 100644 --- a/npm/global.json +++ b/npm/global.json @@ -22,7 +22,7 @@ "overridden": false }, "bash-language-server": { - "version": "5.4.0", + "version": "5.6.0", "overridden": false }, "codex": { @@ -30,11 +30,11 @@ "overridden": false }, "typescript": { - "version": "5.7.3", + "version": "5.9.3", "overridden": false }, "typescript-language-server": { - "version": "4.3.3", + "version": "5.1.3", "overridden": false }, "vscode-langservers-extracted": { @@ -42,7 +42,7 @@ "overridden": false }, "yaml-language-server": { - "version": "1.16.0", + "version": "1.19.2", "overridden": false }, "corepack": { diff --git a/script/setup-lsp.sh b/script/setup-lsp.sh new file mode 100755 index 00000000..91bfac1f --- /dev/null +++ b/script/setup-lsp.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# Language Server Protocol Setup Script +# Installs language servers required for Claude Code LSP integration + +set -e + +echo "=== Installing Language Servers ===" + +# Check if npm is available +if ! command -v npm &> /dev/null; then + echo "Error: npm is not installed" + exit 1 +fi + +# Define language servers to install +LANGUAGE_SERVERS=( + "typescript" + "typescript-language-server" + "bash-language-server" + "vscode-langservers-extracted" + "yaml-language-server" +) + +# Install language servers globally +echo "Installing language servers globally..." +npm install -g "${LANGUAGE_SERVERS[@]}" + +# Verify installation +echo "" +echo "=== Verifying Language Server Installation ===" + +verify_command() { + local cmd=$1 + local name=$2 + if command -v "$cmd" &> /dev/null; then + version=$($cmd --version 2>/dev/null | head -1 || echo "installed") + echo "[OK] $name: $version" + return 0 + else + echo "[MISSING] $name" + return 1 + fi +} + +errors=0 +verify_command "typescript-language-server" "TypeScript LSP" || ((errors++)) +verify_command "bash-language-server" "Bash LSP" || ((errors++)) +verify_command "yaml-language-server" "YAML LSP" || ((errors++)) +verify_command "vscode-json-language-server" "JSON LSP" || ((errors++)) +verify_command "tsc" "TypeScript Compiler" || ((errors++)) + +echo "" +if [ $errors -eq 0 ]; then + echo "=== All Language Servers installed successfully ===" +else + echo "=== Warning: $errors language server(s) missing ===" +fi + +exit 0 From f6fa862aa5c5463be5431a656b1ea073bea6f343 Mon Sep 17 00:00:00 2001 From: keito4 Date: Sun, 4 Jan 2026 05:30:46 +0000 Subject: [PATCH 2/4] fix: enable config-lsp plugin in settings.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add config-lsp to enabledPlugins to activate the local LSP configuration. Without this setting, the LSP servers defined in .claude-plugin/plugin.json are not loaded by Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.claude/settings.json b/.claude/settings.json index 135628e0..ddeb2d22 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -104,6 +104,7 @@ "deny": [] }, "enabledPlugins": { + "config-lsp": true, "frontend-design@claude-code-plugins": true, "supabase-toolkit@claude-code-templates": true, "documentation-generator@claude-code-templates": true, From f0474e9fc61b0e1840af51db68baa80da79d3900 Mon Sep 17 00:00:00 2001 From: keito4 Date: Sun, 4 Jan 2026 06:31:24 +0000 Subject: [PATCH 3/4] fix: add ENABLE_LSP_TOOL environment variable for LSP support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ENABLE_LSP_TOOL=1 to remoteEnv in devcontainer.json. This environment variable is required for Claude Code to enable the LSP tool functionality. Reference: https://blog.lai.so/claude-code-lsp/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3de4a094..a16c7de3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,7 +29,8 @@ "remoteEnv": { "HOMEBREW_NO_AUTO_UPDATE": "1", "SHELL": "/bin/bash", - "TMPDIR": "/home/vscode/.claude/tmp" + "TMPDIR": "/home/vscode/.claude/tmp", + "ENABLE_LSP_TOOL": "1" }, "overrideCommand": true, "updateRemoteUserUID": false, From f2055010943e6f6848f4b609223dc66a5809be34 Mon Sep 17 00:00:00 2001 From: keito4 Date: Sun, 4 Jan 2026 06:53:21 +0000 Subject: [PATCH 4/4] refactor: use separate .lsp.json file for LSP configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move LSP server definitions to .lsp.json file at project root and reference it from plugin.json. This follows the recommended structure from the Claude Code documentation. Reference: https://azukiazusa.dev/blog/claude-code-lsp-support/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude-plugin/plugin.json | 39 +------------------------------------- .lsp.json | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 38 deletions(-) create mode 100644 .lsp.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 9cf1627a..78f0ee07 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -2,42 +2,5 @@ "name": "config-lsp", "version": "1.0.0", "description": "Language Server Protocol configuration for Claude Code", - "lspServers": { - "typescript": { - "command": "typescript-language-server", - "args": ["--stdio"], - "extensionToLanguage": { - ".js": "javascript", - ".jsx": "javascriptreact", - ".ts": "typescript", - ".tsx": "typescriptreact", - ".mjs": "javascript", - ".cjs": "javascript" - } - }, - "bash": { - "command": "bash-language-server", - "args": ["start"], - "extensionToLanguage": { - ".sh": "sh", - ".bash": "bash" - } - }, - "json": { - "command": "vscode-json-language-server", - "args": ["--stdio"], - "extensionToLanguage": { - ".json": "json", - ".jsonc": "jsonc" - } - }, - "yaml": { - "command": "yaml-language-server", - "args": ["--stdio"], - "extensionToLanguage": { - ".yaml": "yaml", - ".yml": "yml" - } - } - } + "lspServers": "../.lsp.json" } diff --git a/.lsp.json b/.lsp.json new file mode 100644 index 00000000..152cfac1 --- /dev/null +++ b/.lsp.json @@ -0,0 +1,38 @@ +{ + "typescript": { + "command": "typescript-language-server", + "args": ["--stdio"], + "extensionToLanguage": { + ".js": "javascript", + ".jsx": "javascriptreact", + ".ts": "typescript", + ".tsx": "typescriptreact", + ".mjs": "javascript", + ".cjs": "javascript" + } + }, + "bash": { + "command": "bash-language-server", + "args": ["start"], + "extensionToLanguage": { + ".sh": "sh", + ".bash": "bash" + } + }, + "json": { + "command": "vscode-json-language-server", + "args": ["--stdio"], + "extensionToLanguage": { + ".json": "json", + ".jsonc": "jsonc" + } + }, + "yaml": { + "command": "yaml-language-server", + "args": ["--stdio"], + "extensionToLanguage": { + ".yaml": "yaml", + ".yml": "yml" + } + } +}