diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index a0bbe1d2..78f0ee07 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -2,30 +2,5 @@ "name": "config-lsp", "version": "1.0.0", "description": "Language Server Protocol configuration for Claude Code", - "languageServers": { - "typescript": { - "command": "typescript-language-server", - "args": ["--stdio"], - "filetypes": ["javascript", "javascriptreact", "typescript", "typescriptreact"], - "rootPatterns": ["package.json", "tsconfig.json"] - }, - "bash": { - "command": "bash-language-server", - "args": ["start"], - "filetypes": ["sh", "bash"], - "rootPatterns": [".git"] - }, - "json": { - "command": "vscode-json-language-server", - "args": ["--stdio"], - "filetypes": ["json", "jsonc"], - "rootPatterns": ["package.json"] - }, - "yaml": { - "command": "yaml-language-server", - "args": ["--stdio"], - "filetypes": ["yaml", "yml"], - "rootPatterns": [".git"] - } - } + "lspServers": "../.lsp.json" } 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/.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, diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a0c6453e..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, @@ -50,6 +51,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/.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" + } + } +} 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