Skip to content

feat: fix LSP configuration for Claude Code integration - #310

Merged
keito4 merged 4 commits into
mainfrom
feat/fix-lsp-configuration
Jan 4, 2026
Merged

feat: fix LSP configuration for Claude Code integration#310
keito4 merged 4 commits into
mainfrom
feat/fix-lsp-configuration

Conversation

@keito4

@keito4 keito4 commented Jan 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Claude Code の LSP (Language Server Protocol) 設定を修正
  • languageServerslspServers キーに変更(正しい形式)
  • filetypesextensionToLanguage マッピングに変更
  • Language Server自動インストール用スクリプトを追加
  • DevContainerのpostCreateCommandにセットアップを追加

Changes

ファイル 変更内容
.claude-plugin/plugin.json LSP設定の形式を修正
script/setup-lsp.sh Language Serverインストールスクリプト(新規)
.devcontainer/devcontainer.json postCreateCommandにsetup-lsp.shを追加
npm/global.json Language Serverバージョンを最新化
.claude/commands/devcontainer-checklist.md 正しいLSP設定形式を反映

Test plan

  • npm run format:check - パス
  • npm run lint - パス
  • npm test - 101/101 パス
  • shellcheck script/setup-lsp.sh - パス
  • DevContainer再ビルド後にLSPが動作することを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Renamed top-level LSP config key to a single external LSP configuration reference and added extension→language mappings for JS/TS, Bash, JSON, and YAML.
  • Documentation

    • Updated DevContainer checklist and troubleshooting to use the new LSP format, added verification steps and setup guidance, and bumped the target DevContainer version.
  • Chores

    • Added automated LSP setup during environment initialization, enabled the LSP config plugin by default, and bumped language-server package versions.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/S PR サイズ Small label Jan 4, 2026
@coderabbitai

coderabbitai Bot commented Jan 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Renames top-level LSP config key languageServerslspServers (now referencing ../.lsp.json), moves per-server configs into a new .lsp.json, adds script/setup-lsp.sh and invokes it from the DevContainer postCreateCommand, bumps npm language-server pins, and updates DevContainer checklist/docs and settings.

Changes

Cohort / File(s) Summary
LSP Configuration Schema
\.claude-plugin/plugin\.json, \.lsp\.json
Replaced top-level languageServers with lspServers (string path "../.lsp.json"). Introduced .lsp.json containing per-language server command/args and extensionToLanguage mappings for TypeScript/JavaScript, Bash, JSON, and YAML.
DevContainer & Setup Script
\.devcontainer/devcontainer\.json, script/setup-lsp\.sh
Added ENABLE_LSP_TOOL env var and inserted script/setup-lsp.sh into postCreateCommand; new script/setup-lsp.sh installs/verifies LSP binaries via npm and reports status (exits 0).
Docs & Checklist
\.claude/commands/devcontainer-checklist\.md
Replaced languageServers references with lspServers and extensionToLanguage; added jq-based checks, instruction to run script/setup-lsp.sh, and bumped config-base requirement to 1.43.0+.
Dependency Pins
npm/global\.json
Bumped npm package versions: bash-language-server 5.4.0→5.6.0, typescript 5.7.3→5.9.3, yaml-language-server 1.16.0→1.19.2, typescript-language-server 4.3.3→5.1.3.
Claude Settings
\.claude/settings\.json
Enabled plugin: added "config-lsp": true to enabledPlugins.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant DevContainer
    participant SetupScript as script/setup-lsp.sh
    participant NPM
    participant LSPs as LanguageServers
    participant Verifier

    DevContainer->>SetupScript: run postCreateCommand -> invoke setup-lsp.sh
    SetupScript->>NPM: npm install -g [tsc, typescript-language-server, bash-language-server, vscode-json-language-server, yaml-language-server]
    NPM-->>LSPs: install binaries globally
    SetupScript->>Verifier: check binaries (tsc, typescript-language-server, bash-language-server, yaml-language-server, vscode-json-language-server)
    Verifier-->>SetupScript: report OK / MISSING per binary
    SetupScript->>DevContainer: print summary (all OK or missing count)
    DevContainer->>DevContainer: continue with remaining postCreateCommand (e.g., setup-claude)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

size/L

Poem

🐰
I hopped through JSON, YAML, and shell,
Mapped extensions so editors tell.
npm drums a tune, servers align,
DevContainer hums—scripts run in line.
Hooray for LSPs—cheers from a rabbit! 🎉

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: fixing LSP configuration for Claude Code integration, which aligns with the primary objective of restructuring language server configurations.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

プルリクエストレビュー

概要

Claude CodeのLSP設定を修正し、Language Serverの自動セットアップスクリプトを追加するPRです。変更内容は的確で、品質基準を満たしています。


✅ Good Points

1. 正しいAPI形式への修正

  • languageServerslspServers への変更は正しい (.claude-plugin/plugin.json:5)
  • filetypesextensionToLanguage への変更により、より明示的なマッピングを実現 (.claude-plugin/plugin.json:9-16)

2. 拡張子の網羅性

TypeScript設定で .mjs.cjs を追加している点が優れています (.claude-plugin/plugin.json:14-15)

3. 自動化スクリプト

setup-lsp.sh による自動インストールで開発者体験が向上します (script/setup-lsp.sh)

4. 堅牢なエラーハンドリング

  • set -e でエラー時の即座終了を保証 (script/setup-lsp.sh:5)
  • command -v でコマンド存在確認を実施 (script/setup-lsp.sh:10-12)
  • 検証結果のカウンタでインストール成否を明確化 (script/setup-lsp.sh:45-57)

5. ドキュメント更新

.claude/commands/devcontainer-checklist.md で正しい設定形式を明記し、トラブルシューティング手順も追加されています


⚠️ Potential Issues

1. TypeScript バージョン不一致の可能性

npm/global.json で TypeScript を 5.9.3 に更新していますが、TypeScript 5.9 はまだリリースされていません(最新安定版は 5.7.x)。

推奨対応:

"typescript": {
  "version": "5.7.3",
  "overridden": false
}

2. shellcheckカバレッジの確認

npm run shellchecksetup-lsp.sh を対象としているか確認が必要です。

確認コマンド:

npm run shellcheck 2>&1 | grep setup-lsp.sh

3. テストカバレッジ

現状、setup-lsp.sh の自動テストがありません。

推奨対応:

  • BATS(Bash Automated Testing System)でインストールスクリプトのテストを追加
  • または手動テスト項目をTest Planに明記

4. rootPatterns の削除

rootPatterns がすべて削除されていますが、一部のLSPクライアントはプロジェクトルート検出に使用します。

質問:
Claude Code LSPは rootPatterns を必要としない仕様ですか?必要な場合は以下を追加推奨:

"typescript": {
  "command": "typescript-language-server",
  "args": ["--stdio"],
  "extensionToLanguage": { ... },
  "rootPatterns": ["package.json", "tsconfig.json"]
}

🔒 Security

問題なし

  • 認証情報の漏洩なし
  • 外部からの入力検証は不要(静的インストールスクリプト)
  • npm install -g でグローバルインストールを実施(DevContainer内で適切)

🚀 Performance

影響なし

  • LSP設定はビルドプロセスに影響しない
  • postCreateCommand への追加は初回ビルド時のみ実行
  • Language Serverインストールは並列処理不可だが、DevContainer構築時のみなので許容範囲

📋 Test Coverage

現状:

  • ✅ format/lint/testはパス
  • ✅ shellcheckを実行(ただし対象確認が必要)
  • setup-lsp.sh の自動テストなし
  • ⏳ DevContainer再ビルド後の動作確認は未完了

推奨追加テスト:

# test/integration/setup-lsp.bats
@test "setup-lsp.sh installs all language servers" {
  run bash script/setup-lsp.sh
  [ "$status" -eq 0 ]
  command -v typescript-language-server
  command -v bash-language-server
  command -v yaml-language-server
  command -v vscode-json-language-server
}

💡 Recommendations

Priority 1: TypeScriptバージョン修正

npm/global.json の TypeScript バージョンを 5.7.3 に戻すか、5.9.3が実在するか確認してください。

Priority 2: Test Plan完了

Test Planの最後の項目「DevContainer再ビルド後にLSPが動作することを確認」を実施し、結果を報告してください。

Priority 3 (Optional): rootPatterns の必要性確認

Claude Code LSP仕様を確認し、rootPatterns が不要であれば問題なし、必要であれば追加を検討してください。


✅ Approval Status

条件付き承認

以下の対応後にマージを推奨します:

  1. TypeScript バージョンの確認・修正
  2. DevContainer での動作確認完了

その他の指摘事項は改善推奨ですが、マージをブロックするものではありません。


レビュー完了日: 2026-01-04
レビュアー: Claude Sonnet 4.5

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8fc225e and 943ea62.

📒 Files selected for processing (5)
  • .claude-plugin/plugin.json
  • .claude/commands/devcontainer-checklist.md
  • .devcontainer/devcontainer.json
  • npm/global.json
  • script/setup-lsp.sh
🧰 Additional context used
📓 Path-based instructions (1)
{.codex/**,.devcontainer/codex*,package*.json,npm/global.json}

📄 CodeRabbit inference engine (CLAUDE.md)

Use Conventional Commits format with release-triggering types (feat/fix/perf/revert/docs) for commits touching .codex/**, .devcontainer/codex*, package*.json, or npm/global.json

Files:

  • npm/global.json
🧠 Learnings (5)
📚 Learning: 2026-01-04T04:05:56.900Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-04T04:05:56.900Z
Learning: Use automated Claude commands from `.claude/commands/` directory for maintenance, Git workflows, code analysis, quality checks, dependency management, security reviews, and tool configuration

Applied to files:

  • .devcontainer/devcontainer.json
  • .claude/commands/devcontainer-checklist.md
📚 Learning: 2026-01-04T04:05:56.900Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-04T04:05:56.900Z
Learning: Follow development quality standards defined in `CLAUDE.md` for AI-assisted development workflows

Applied to files:

  • .claude/commands/devcontainer-checklist.md
📚 Learning: 2026-01-04T04:05:56.900Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-04T04:05:56.900Z
Learning: Refer to `CLAUDE.md` for quality standards, AI prompt design guidelines, and CI integration

Applied to files:

  • .claude/commands/devcontainer-checklist.md
📚 Learning: 2026-01-04T04:05:56.900Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-04T04:05:56.900Z
Learning: Use specialized Claude Code agents from `.claude/agents/` directory for architecture validation, performance analysis, concurrency safety, and testability analysis

Applied to files:

  • .claude/commands/devcontainer-checklist.md
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/claude.yml : Trigger automatic AI assistance on claude mentions in issues, PRs, and comments using .github/workflows/claude.yml

Applied to files:

  • .claude/commands/devcontainer-checklist.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: claude-review
  • GitHub Check: Trivy Container Scan
  • GitHub Check: Generate SBOM
🔇 Additional comments (9)
script/setup-lsp.sh (2)

32-50: LGTM!

The verify_command function is well-structured with proper error handling. The || ((errors++)) pattern correctly counts failures without triggering set -e.


15-26: LGTM!

The language server list is comprehensive and matches the verification checks. Global installation is appropriate for LSP binaries.

.claude-plugin/plugin.json (2)

5-17: LGTM!

The lspServers key and TypeScript extensionToLanguage mappings are comprehensive, covering all common JavaScript/TypeScript file extensions including ESM (.mjs) and CommonJS (.cjs).


18-33: LGTM!

Bash and JSON server configurations look correct with appropriate extension-to-language mappings.

.devcontainer/devcontainer.json (1)

53-53: LGTM!

The setup-lsp.sh script is correctly integrated into the postCreateCommand chain, positioned after dependency installation and before the final Claude setup.

Note: Per the review of setup-lsp.sh, if that script's exit code is changed to propagate errors, ensure the DevContainer build won't fail unexpectedly on LSP installation issues.

.claude/commands/devcontainer-checklist.md (3)

93-104: LGTM!

Documentation correctly reflects the new lspServers key and extensionToLanguage property. The jq verification command is helpful for troubleshooting.


301-314: LGTM!

The troubleshooting section is well-updated with the new setup script reference and clear guidance about the deprecated configuration format.


353-353: LGTM!

Version reference updated to align with the DevContainer base image version in devcontainer.json.

npm/global.json (1)

24-46: Version updates are valid and align with the LSP setup workflow.

All updated packages (bash-language-server@5.6.0, typescript@5.9.3, typescript-language-server@5.1.3, yaml-language-server@1.19.2) exist on npm and are consistent with the new LSP installation requirements.

Likely an incorrect or invalid review comment.

Comment thread .claude-plugin/plugin.json Outdated
Comment on lines +37 to +40
"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.

Comment thread script/setup-lsp.sh
# 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.

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 <noreply@anthropic.com>
@github-actions github-actions Bot added size/S PR サイズ Small and removed size/S PR サイズ Small labels Jan 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 943ea62 and f6fa862.

📒 Files selected for processing (1)
  • .claude/settings.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-04T04:05:56.900Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-04T04:05:56.900Z
Learning: Follow development quality standards defined in `CLAUDE.md` for AI-assisted development workflows

Applied to files:

  • .claude/settings.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: claude-review
  • GitHub Check: Generate SBOM
  • GitHub Check: Trivy Container Scan

Comment thread .claude/settings.json
"deny": []
},
"enabledPlugins": {
"config-lsp": true,

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:

# First, check if the files mentioned exist and explore the structure
git ls-files | grep -E "(claude|settings|plugin)" | head -20

Repository: keito4/config

Length of output: 850


🏁 Script executed:

# Look at the .claude/settings.json file to verify the change context
if [ -f ".claude/settings.json" ]; then
  echo "=== .claude/settings.json ===" 
  cat -n ".claude/settings.json" | head -120
else
  echo "File not found"
fi

Repository: keito4/config

Length of output: 4252


🏁 Script executed:

# Check if .claude-plugin/plugin.json exists
if [ -f ".claude-plugin/plugin.json" ]; then
  echo "=== .claude-plugin/plugin.json ===" 
  cat ".claude-plugin/plugin.json"
else
  echo "File not found"
fi

Repository: keito4/config

Length of output: 1096


🏁 Script executed:

# Look for CLAUDE.md to understand development quality standards
if [ -f "CLAUDE.md" ]; then
  echo "=== CLAUDE.md ===" 
  cat "CLAUDE.md"
else
  echo "CLAUDE.md not found in root"
fi

Repository: keito4/config

Length of output: 4030


🏁 Script executed:

# Check if there are any references to "config-lsp" plugin in the codebase
rg "config-lsp" --type json

Repository: keito4/config

Length of output: 39


LGTM! Verify LSP functionality before merging.

The addition of "config-lsp": true correctly enables the local LSP plugin configuration defined in .claude-plugin/plugin.json, which aligns with the PR's objective to fix LSP configuration for Claude Code integration.

Per the PR test plan, DevContainer LSP verification is incomplete. Please ensure the TypeScript, Bash, JSON, and YAML language servers integrate correctly with Claude Code and provide expected functionality in the DevContainer environment before merging.

🤖 Prompt for AI Agents
In .claude/settings.json around line 107, you enabled "config-lsp": true but
haven’t verified LSP functionality in the DevContainer; follow the PR test plan
to validate and fix integration: start the DevContainer, open representative
TypeScript, Bash, JSON, and YAML files, confirm language servers activate,
diagnostics/hover/completion/formatting work with Claude Code, inspect extension
and plugin logs for errors, adjust plugin.json or settings.json (e.g., server
paths, activation events, workspaceFolder mappings, environment variables) or
install missing language-server binaries as needed, and document the
verification steps and any fixes before merging.

@claude

claude Bot commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

PR Review: LSP Configuration Fix

✅ 良い点 (Strengths)

  1. 正確な修正: languageServers → lspServers および filetypes → extensionToLanguage への変更は、Claude Codeの正しいLSP設定形式に準拠しています

  2. 包括的な対応:

    • プラグイン設定の修正 (.claude-plugin/plugin.json:5)
    • 自動インストールスクリプトの追加 (script/setup-lsp.sh)
    • DevContainer統合 (.devcontainer/devcontainer.json:53)
    • ドキュメント更新 (.claude/commands/devcontainer-checklist.md)
    • プラグイン有効化 (.claude/settings.json:107)
  3. 拡張性: .mjs, .cjs などの追加JavaScriptファイル拡張子をサポート (.claude-plugin/plugin.json:14-15)

  4. 検証機能: setup-lsp.shに各Language Serverのインストール検証が含まれている (script/setup-lsp.sh:45-50)

⚠️ 改善提案 (Suggestions for Improvement)

1. TypeScriptバージョンの不整合

問題: npm/global.json で TypeScript 5.9.3 が指定されていますが、TypeScript 5.9.x は存在しません(最新は5.7.x系)

推奨: 実在するバージョンに修正してください。

2. テストカバレッジの欠如

問題: LSP設定の検証テストが存在しない

推奨: TDDの原則(Red → Green → Refactor)に従い、test/config-validation.test.js にLSPプラグイン設定の検証テストを追加することを推奨します。

3. エラーハンドリングの強化

問題: setup-lsp.sh でnpm installが失敗した場合のハンドリングが不十分

推奨: npm installのエラーチェックを追加し、失敗時に適切なメッセージを表示することを推奨します。

🔒 セキュリティレビュー

  • ✅ 認証情報の漏洩なし
  • ✅ shellcheckパス済み
  • ✅ npm package sourcesは信頼できる公式パッケージ
  • ⚠️ グローバルインストール権限に注意

📊 品質ゲート準拠状況

項目 状態 備考
Format Check パス
Lint パス
Test (101/101) パス
Test Coverage (TDD) ⚠️ LSP設定の単体テスト未実装
ShellCheck パス
Security Scan パス
Documentation 適切に更新済み

🎯 総合評価

推奨アクション: Approve with minor changes

このPRは明確な問題を解決する良い修正ですが、以下の対応を推奨します:

  1. Critical: TypeScriptバージョンを実在するものに修正
  2. Recommended: テストカバレッジ追加(TDD原則準拠)
  3. Optional: エラーハンドリング強化

修正後は .claude/CLAUDE.md の Definition of Done 基準を満たします。


レビュー基準: CLAUDE.md Section 2 (Development Philosophy), Section 7 (Quality Gates)

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 <noreply@anthropic.com>
@github-actions github-actions Bot added size/S PR サイズ Small and removed size/S PR サイズ Small labels Jan 4, 2026
@claude

claude Bot commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

PR Review Summary

このPRは Claude Code の LSP 設定を修正する重要な変更です。全体的に実装は適切ですが、いくつかの改善提案があります。

✅ Good Points

  1. 正しい設定形式への移行

    • languageServerslspServers への変更は正しい
    • filetypesextensionToLanguage への変更も適切
    • 各ファイル拡張子のマッピングが明示的で分かりやすい
  2. 自動化の追加

    • script/setup-lsp.sh による Language Server の自動インストールは優れたアプローチ
    • DevContainer の postCreateCommand への統合により、環境構築が自動化されている
  3. ドキュメント更新

    • DevContainer チェックリストの更新により、トラブルシューティング情報が充実
  4. Commit Message

    • Conventional Commits に準拠
    • feat: タイプの使用により semantic-release がトリガーされる

🔍 Potential Issues & Improvements

1. セキュリティ: エラーハンドリングの強化

script/setup-lsp.sh:26 で npm install を実行していますが、エラー処理が不十分です。ネットワークエラーや権限エラー時の対応を追加することを推奨します。

2. パフォーマンス: npm install の冗長性

既にインストール済みのパッケージを再インストールする可能性があります。バージョンチェックを追加して、必要な場合のみインストールすることを推奨します。

3. テストカバレッジの欠如

新規追加された script/setup-lsp.sh に対する自動テストが存在しません。CLAUDE.md では 70%+ のカバレッジが要求されています。BATS などを使用したテストの追加を推奨します。

4. ドキュメント: npm/global.json のバージョン更新理由

以下のパッケージバージョンが更新されていますが、PR の説明に変更理由が記載されていません:

  • bash-language-server: 5.4.0 → 5.6.0
  • typescript: 5.7.3 → 5.9.3
  • typescript-language-server: 4.3.3 → 5.1.3
  • yaml-language-server: 1.16.0 → 1.19.2

破壊的変更やセキュリティパッチの有無を PR 説明に追加してください。

📋 Test Plan Status

  • ✅ Format/Lint/Test パス (101/101)
  • ⚠️ DevContainer 再ビルド後の LSP 動作確認が未完了

質問: DevContainer での実環境テストは完了していますか?

🔒 Security Considerations

  • ✅ 新規スクリプトにハードコードされた credential なし
  • set -e によるエラー時の即座終了
  • ⚠️ npm install -g の権限昇格リスク(DevContainer 内では問題なし)

🎯 Recommendations Summary

  1. 必須(Blocking): DevContainer での LSP 動作確認を完了し、Test plan を更新
  2. 強く推奨: setup-lsp.sh のエラーハンドリング強化、npm/global.json のバージョン更新理由を追加
  3. 推奨: シェルスクリプトのテストカバレッジ追加、npm install の冗長性改善
  4. Nice to Have: --quiet フラグの追加

総評

LSP 設定の修正は正しく、Claude Code との統合を大幅に改善する変更です。上記の改善提案に対応すれば、マージ可能です。

推奨アクション: DevContainer 再ビルドテストの完了後、エラーハンドリングを強化してマージ


🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@github-actions github-actions Bot added size/S PR サイズ Small and removed size/S PR サイズ Small labels Jan 4, 2026
@keito4
keito4 merged commit ff4bfa8 into main Jan 4, 2026
17 of 18 checks passed
@claude

claude Bot commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

Pull Request Review - PR #310

総合評価 ✅

このPRは、Claude CodeのLSP設定を修正する重要な改善です。設定形式の誤りを正し、自動セットアップスクリプトを追加しています。全体的に品質が高く、リポジトリの品質基準を満たしています。


📋 レビューサマリ

項目 評価 コメント
コード品質 ✅ Good 設定ファイルとスクリプトが適切に構造化されている
ベストプラクティス ✅ Good 設定の外部化とインストール検証が適切
バグ・問題 ⚠️ Minor 小さな改善点あり(後述)
パフォーマンス ✅ Good パフォーマンスへの影響なし
セキュリティ ✅ Good セキュリティ上の懸念なし
テストカバレッジ ⚠️ Minor スクリプトの自動テスト不足

✅ 良い点

1. 設定形式の修正(.claude-plugin/plugin.json:5)

  • languageServerslspServers への変更は正しい形式への修正
  • filetypesextensionToLanguage マッピングへの変更も適切
  • 設定の外部ファイル化(.lsp.json)により保守性が向上

2. 包括的なLSP設定(.lsp.json:1-38)

  • TypeScript/JavaScript、Bash、JSON、YAMLの4つの主要言語をカバー
  • .mjs.cjsなどのモダンなJavaScript拡張子も対応
  • 各LSPに適切なコマンドと引数が設定されている

3. 自動セットアップスクリプト(script/setup-lsp.sh)

  • Language Serverの自動インストール機能
  • インストール検証機能付き
  • エラーハンドリングが適切(set -e

4. ドキュメント更新

  • DevContainerチェックリストに新しい設定形式を反映
  • トラブルシューティング手順を追加
  • バージョン情報も更新

⚠️ 改善提案

1. スクリプトのエラーハンドリング(script/setup-lsp.sh:46-50)

現在のコード:

verify_command "typescript-language-server" "TypeScript LSP" || ((errors++))
verify_command "bash-language-server" "Bash LSP" || ((errors++))

問題点:

  • set -e が設定されているため、最初のverify失敗時にスクリプトが終了する可能性
  • || ((errors++)) は成功時にexit code 0を返すが、コマンド置換時の挙動が不明確

推奨事項:

verify_command "typescript-language-server" "TypeScript LSP" || errors=$((errors + 1))
verify_command "bash-language-server" "Bash LSP" || errors=$((errors + 1))

または、検証セクションの前に set +e を追加:

# Verify installation (allow failures)
set +e
echo ""
echo "=== Verifying Language Server Installation ==="

2. npm global install の警告抑制

script/setup-lsp.sh:26

グローバルインストールは環境によって権限エラーが発生する可能性があります。

推奨事項:

  • エラーメッセージをユーザーに分かりやすく表示
  • または、npm prefixを確認してユーザー空間にインストール
# Install language servers globally
echo "Installing language servers globally..."
if ! npm install -g "${LANGUAGE_SERVERS[@]}"; then
    echo "Error: Failed to install language servers"
    echo "You may need to run with sudo or configure npm prefix"
    exit 1
fi

3. .lsp.json の rootPatterns 設定

現在の設定:
rootPatterns が設定されていません。

推奨事項:
各LSPに rootPatterns を追加することで、プロジェクトルートの検出精度が向上します:

"typescript": {
  "command": "typescript-language-server",
  "args": ["--stdio"],
  "rootPatterns": ["package.json", "tsconfig.json", "jsconfig.json"],
  "extensionToLanguage": { ... }
}

4. Language Server バージョンの整合性

npm/global.json:25-49

TypeScriptのバージョンが 5.9.3 になっていますが、TypeScript 5.9はまだリリースされていません(現在の最新は5.7系)。

確認事項:

  • これは意図的な将来のバージョン指定ですか?
  • それとも 5.7.35.9.3 へのタイポですか?

5. DevContainer postCreateCommand の長さ

.devcontainer/devcontainer.json:54

postCreateCommandが1行で非常に長くなっています。

推奨事項:
配列形式に変更して可読性を向上:

"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"
]

🔍 セキュリティ確認

✅ 認証情報の漏洩なし
✅ 外部依存パッケージは信頼できるソース(npm公式)
✅ シェルインジェクションのリスクなし
✅ ファイルパーミッションの問題なし


🧪 テストに関する推奨事項

現在のテスト計画は良好ですが、以下を追加検討してください:

  1. setup-lsp.sh の自動テスト

    • スクリプトが正しく動作するかの自動テスト
    • CI環境での実行確認
  2. LSP設定のバリデーション

    • .lsp.json のJSON schemaバリデーション
    • 各LSPコマンドが実際に存在するかのテスト
  3. 統合テスト

    • DevContainer再ビルド後にLSPが実際に動作することの確認(Test planでチェック予定)

📊 品質基準への準拠

基準 状態 備考
TDD ⚠️ スクリプトのテストがない
Static Quality Gates format:check, lint, shellcheck パス
Git Workflow Conventional Commits準拠
Code Coverage N/A 設定ファイルのため対象外
Documentation チェックリストとトラブルシューティング更新済み

🎯 推奨アクション

必須(Must)

  • TypeScriptバージョン(5.9.3)が正しいか確認

推奨(Should)

  • script/setup-lsp.sh のエラーハンドリング改善
  • .lsp.json に rootPatterns を追加
  • postCreateCommand を配列形式に変更

オプション(Could)

  • setup-lsp.sh の自動テスト追加
  • LSP設定のJSON schemaバリデーション

🏁 結論

このPRは、LSP設定の重要な修正を含む高品質な変更です。小さな改善点はありますが、現状でもマージ可能な品質です。上記の改善提案を検討いただければ、さらに堅牢な実装になります。

マージ推奨度:承認(Minor改善後が理想)


レビュー実施日: 2026-01-04
レビュアー: Claude Code (Automated Review)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0474e9 and f205501.

📒 Files selected for processing (2)
  • .claude-plugin/plugin.json
  • .lsp.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .claude-plugin/plugin.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: claude-review
  • GitHub Check: Trivy Container Scan
  • GitHub Check: Generate SBOM
🔇 Additional comments (1)
.lsp.json (1)

22-29: The JSON configuration correctly includes both .json and .jsonc with appropriate language identifiers. The vscode-json-language-server command is part of the vscode-langservers-extracted package and is verified by your setup script.

Comment thread .lsp.json
Comment on lines +2 to +13
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"],
"extensionToLanguage": {
".js": "javascript",
".jsx": "javascriptreact",
".ts": "typescript",
".tsx": "typescriptreact",
".mjs": "javascript",
".cjs": "javascript"
}
},

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:

#!/bin/bash
# Search for .cts and .mts files in the repository
fd -e cts -e mts

# Check for package.json and typescript configuration
find . -name "package.json" -o -name "tsconfig.json" | head -20

# Display the .lsp.json file to see full context
cat -n .lsp.json 2>/dev/null || echo "File not found at root"

Repository: keito4/config

Length of output: 1127


Fix incorrect YAML extension language mapping.

The TypeScript server command typescript-language-server is correct. However, line 35 has an issue: the .yml extension should map to "yaml" (not "yml"), as "yaml" is the VSCode language identifier for both .yaml and .yml files.

🤖 Prompt for AI Agents
In .lsp.json around lines 2 to 13, the language mapping for the YAML file
extension is incorrect; update the mapping so that ".yml" maps to "yaml" (the
VSCode language identifier) instead of "yml" — ensure any YAML extension entries
(e.g., ".yml", and optionally ".yaml") use the value "yaml".

Comment thread .lsp.json
Comment on lines +14 to +21
"bash": {
"command": "bash-language-server",
"args": ["start"],
"extensionToLanguage": {
".sh": "sh",
".bash": "bash"
}
},

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

🌐 Web query:

bash-language-server npm configuration command arguments --stdio

💡 Result:

Use the "start" subcommand — you do not pass a separate --stdio flag. Example editor/client configs:

  • coc.nvim / VSCode settings:
    "language.bash.languageServer.command": "bash-language-server",
    "language.bash.languageServer.arguments": ["start"]. [1][2]

  • nvim-lspconfig (Lua):
    cmd = { "bash-language-server", "start" }. [3]

The server speaks the Language Server Protocol over stdio when started with "start", so no explicit --stdio argument is required. [1][3]

Sources:
[1] npm bash-language-server README.
[2] npm package documentation examples.
[3] GitHub bash-language-server README.


🌐 Web query:

language identifiers shell bash sh vscode lsp languageId

💡 Result:

Short answer:

  • VS Code's built-in Shell Script language identifier is "shellscript". [1]
  • Some extensions may define their own ids (e.g. an extension could use "bash" — check the extension's package.json). [1]
  • For the Language Server Protocol, the editor sends the languageId (e.g. "shellscript") in the initialize/didOpen notifications; extensions declare their language id in package.json under "languages". [1][2]

How to confirm / use it:

  • See the known identifiers list (shows Shell Script → "shellscript"). [1]
  • To associate files: add to settings.json:
    "files.associations": { "*.sh": "shellscript", "myfile": "shellscript" }. [1]
  • To find an installed language's id in VS Code: open Change Language Mode (Ctrl/Cmd+K M) or inspect an extension's package.json "languages" entry. [2]

Sources:
[1] Visual Studio Code — Language Identifiers (official docs).
[2] Visual Studio Code — Programming Languages / Language identifier (official docs).


🏁 Script executed:

cat -n .lsp.json | head -50

Repository: keito4/config

Length of output: 1112


Update Bash language identifiers to match VS Code standard.

The bash configuration correctly uses "start" as the argument (this is the correct subcommand for bash-language-server), but the language identifiers are incorrect. VS Code's standard Shell Script identifier is "shellscript", not "sh" and "bash".

Update the extensionToLanguage mapping:

"extensionToLanguage": {
  ".sh": "shellscript",
  ".bash": "shellscript"
}

This matches the pattern used by other servers in this file and ensures the language server receives file notifications for shell scripts.

🤖 Prompt for AI Agents
In .lsp.json around lines 14 to 21, the bash language mapping uses nonstandard
identifiers ("sh" and "bash"); update the extensionToLanguage mapping so both
".sh" and ".bash" map to VS Code's standard "shellscript" identifier to ensure
the bash-language-server receives proper file notifications.

Comment thread .lsp.json
Comment on lines +30 to +37
"yaml": {
"command": "yaml-language-server",
"args": ["--stdio"],
"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 | 🟠 Major

🧩 Analysis chain

🌐 Web query:

VSCode language identifier yaml yml correct standard

💡 Result:

Use the language identifier "yaml" (lowercase). VS Code's built-in language id is "yaml"; both file extensions ".yaml" and ".yml" are supported by YAML language extensions. Example settings entry: "files.associations": { ".yml": "yaml", ".yaml": "yaml" }. [1][2]

Sources:
[1] VS Code Language Identifiers (built‑in list) — YAML = "yaml".
[2] redhat-developer vscode-yaml (YAML support/extension; recognizes .yaml/.yml).


🌐 Web query:

yaml-language-server correct command name npm package

💡 Result:

The npm package is named "yaml-language-server" and the CLI command it installs is yaml-language-server (commonly run as yaml-language-server --stdio). [1][2]

Sources:

  • npm package page for yaml-language-server. [1]
  • yaml-language-server README / docs showing node .../server.js [--stdio] / usage (--stdio). [2]

Fix YAML language identifier mapping.

Line 35 maps .yml to "yml", but VSCode language identifiers use "yaml" (lowercase) for both .yaml and .yml files. This will cause .yml files to not be properly recognized by the language server. The command name yaml-language-server and --stdio argument are correct.

Fix
   "yaml": {
     "command": "yaml-language-server",
     "args": ["--stdio"],
     "extensionToLanguage": {
       ".yaml": "yaml",
-      ".yml": "yml"
+      ".yml": "yaml"
     }
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"yaml": {
"command": "yaml-language-server",
"args": ["--stdio"],
"extensionToLanguage": {
".yaml": "yaml",
".yml": "yml"
}
}
"yaml": {
"command": "yaml-language-server",
"args": ["--stdio"],
"extensionToLanguage": {
".yaml": "yaml",
".yml": "yaml"
}
}
🤖 Prompt for AI Agents
In .lsp.json around lines 30 to 37, the language mapping maps ".yml" to "yml"
which is incorrect; update the extensionToLanguage mapping so both ".yaml" and
".yml" map to the VSCode language identifier "yaml" (lowercase) so the
yaml-language-server recognizes .yml files correctly.

@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.44.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Jan 4, 2026
@keito4
keito4 deleted the feat/fix-lsp-configuration branch January 4, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み size/S PR サイズ Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant