Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat .claude-plugin/plugin.json

Repository: keito4/config

Length of output: 1061


🌐 Web query:

YAML language identifier LSP language server protocol

💡 Result:

  • Standard LSP language identifier (languageId) for YAML: "yaml". [1]

  • Common YAML LSP server: Red Hat's yaml-language-server (invoked as the binary yaml-language-server, client name often yamlls), typically started with yaml-language-server --stdio. [2]

Sources: [1] Red Hat yaml-language-server README; [2] lsp-mode / nvim-lsp docs.


Change .yml extension mapping from "yml" to "yaml".

The .yml extension currently maps to the language identifier "yml", while .yaml maps to "yaml". According to LSP standards, the correct language identifier for YAML files is "yaml". Both extensions should map to the same identifier for consistent language server initialization.

Current code (lines 37-40)
      "extensionToLanguage": {
        ".yaml": "yaml",
        ".yml": "yml"
      }

Change ".yml": "yml" to ".yml": "yaml".

🤖 Prompt for AI Agents
In .claude-plugin/plugin.json around lines 37 to 40, the extensionToLanguage
mapping maps ".yml" to the incorrect identifier "yml"; change the value for
".yml" to "yaml" so both ".yaml" and ".yml" map to the standard "yaml" language
identifier per LSP conventions.

}
}
}
17 changes: 15 additions & 2 deletions .claude/commands/devcontainer-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -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機能の確認

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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+
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
8 changes: 4 additions & 4 deletions npm/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@
"overridden": false
},
"bash-language-server": {
"version": "5.4.0",
"version": "5.6.0",
"overridden": false
},
"codex": {
"version": "0.2.3",
"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": {
"version": "4.10.0",
"overridden": false
},
"yaml-language-server": {
"version": "1.16.0",
"version": "1.19.2",
"overridden": false
},
"corepack": {
Expand Down
59 changes: 59 additions & 0 deletions script/setup-lsp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# Language Server Protocol Setup Script
# Installs language servers required for Claude Code LSP integration

set -e

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider propagating failure status via exit code.

The script uses set -e but unconditionally exits with 0 even when language servers are missing. This masks failures from the calling process (devcontainer postCreateCommand), making troubleshooting harder if LSP installation silently fails.

🔎 Proposed fix to propagate error status
 if [ $errors -eq 0 ]; then
     echo "=== All Language Servers installed successfully ==="
 else
     echo "=== Warning: $errors language server(s) missing ==="
 fi
 
-exit 0
+exit $errors

If a non-zero exit would break the DevContainer build, consider making it configurable or at least documenting the intentional silent failure behavior.

Also applies to: 53-59

🤖 Prompt for AI Agents
In script/setup-lsp.sh around lines 5 and 53-59, the script currently uses set
-e but ends by unconditionally exiting with 0 which hides failures; modify the
flow so the script returns a non-zero exit code when any LSP install or check
fails (e.g., track a failure flag or capture command exit statuses and exit with
that code), or make this behavior configurable via an environment variable
(e.g., SKIP_LSP_ERRORS=true to preserve an exit 0) and document the default to
fail the DevContainer postCreateCommand; ensure any early returns respect set -e
and propagate the actual error code instead of always exiting 0.


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
Loading