GitHub Copilot CLI に言語サーバーによる本格的なコード知能を追加
GitHub は Copilot CLI のコード理解能力を向上させるため、言語サーバープロトコル(LSP)を統合する自動化スキルを導入し、テキスト検索に依存しない構造的な解析を実現した。
キーポイント
ヒューリスティック手法の限界と LSP の導入
従来の Copilot CLI は JAR ファイルの抽出や grep によるテキスト検索に依存していたが、これではジェネリックやオーバーロードなどの構文解析が不可能だった。LSP を導入することで、定義場所や型情報の正確な取得が可能になる。
自動化された LSP セットアップスキルの仕組み
新しい「LSP Setup skill」は、ユーザーの言語選択と OS 検知を行い、適切なパッケージマネージャーを使って LSP サーバーを自動的にインストール・設定する 7 ステップのプロセスを実行する。
エージェントスキルの標準化された構造
この機能は Markdown と YAML フロントマターで定義される再利用可能な「エージェントスキル」の枠組みに基づいており、トリガー、ワークフロー、制約条件を明確に定義することで AI エージェントの行動を制御する。
設定スコープと優先順位
ユーザーレベル(全リポジトリ適用)とリポジトリレベル(単一プロジェクト限定)の2つの設定スコープをサポートし、両方が存在する場合はリポジトリレベルの設定が優先されます。
自動インストールと設定マージ
エージェントはOSに応じた適切なインストールコマンドを実行し、既存の設定を破棄せずに新しいサーバー情報を安全にマージします。
LSP 導入後の知能向上効果
設定完了により、依存関係の型解決や定義へのジャンプが可能になり、エージェントは IDE のような構造的理解でコードを生成するため、誤った推測が減り精度が向上します。
言語サーバーのセットアップ方法
Copilot CLI に「set up LSP for Java」や「enable code intelligence for Python」などの指示を出して、必要な言語サーバーをセットアップできます。
影響分析・編集コメントを表示
影響分析
この発表は、CLI 環境における AI コーディングエージェントの信頼性を劇的に高める転換点となります。特に大規模なコードベースや複雑な型システムを持つプロジェクトにおいて、AI が誤った推論を行うリスクを大幅に低減し、開発者の生産性を支える基盤技術として定着する可能性があります。
編集コメント
CLI ツールにおける AI の信頼性向上は、開発ワークフローの根幹に関わる重要な進化です。特に大規模プロジェクトでの型安全性を担保する LSP 統合は、実務現場での採用加速に直結する要素と言えます。
GitHub Copilot CLI が JAR ファイルを一時ディレクトリに展開し、.class ファイルを grep で検索し、生バイトコードから API 署名を組み立てる様子を見たことはありますか?このエージェントは創意工夫に富んでいますが、言語サーバーがなければこれが精一杯です。
Language Server Protocol (LSP) は、VS Code などのエディタで「定義へ移動」「参照の検索」「型解決」を可能にする標準規格です。これはターミナル上でも同様に機能します。LSP Setup スキルは、Copilot CLI 向けの LSP サーバーのインストールと設定を自動化し、エージェントがテキスト検索ヒューリスティクスに頼るのではなく、コードに関する正確で構造化された回答を得られるようにします。
この記事では、このスキルが内部でどのように動作するかを学び、生成される設定形式を確認し、現在サポートされている 14 の言語のいずれかをセットアップする方法を解説します。
問題点:ヒューリスティックなコード理解
LSP サーバーがない場合、GitHub Copilot CLI のエージェントはテキスト検索とバイナリ抽出を通じて API 情報を逆解析します。Java プロジェクトの場合、以下のような手順になります。
依存関係 JAR を検索
find ~/.m2/repository -name "*httpclient*.jar"
一時ディレクトリに展開
mkdir /tmp/httpclient && cd /tmp/httpclient
jar xf ~/.m2/repository/org/apache/httpcomponents/httpclient/4.5.14/httpclient-4.5.14.jar
展開された class ファイルでメソッドを検索
grep -r "execute" --include="*.class" .
Python の場合、エージェントは site-packages 内のファイルを cat コマンドで表示するかもしれません。TypeScript の場合は node_modules を探索します。これらのテキストベースのアプローチは単純なケースでは機能しますが、生テキストに対するパターンマッチングを行っており、真の意味での意味解析ではないため、ジェネリックやオーバーロード、転送型を見逃し、コンパイル済みバイトコードを全く認識できません。まさにこれが言語サーバーが埋めるべきギャップです。
LSP サーバーは構造的にこの問題を解決します。エージェントがシンボルに対して textDocument/definition リクエストを送信すると、言語サーバーは正確なソース位置、完全に解決された型、およびシグネチャを返します。
エージェントスキルとは何か?
エージェントスキルとは、AI コードエージェントの機能を拡張する再利用可能な指示セットです。スキルは Markdown ファイルで定義され、YAML フロントマターを持ち、標準的な構造に従います:トリガーの説明、ステップバイステップのワークフロー、参照データ、および行動制約です。
LSP Setup スキルはこの構造を利用して、エージェントがオペレーティングシステムの検出、適切なパッケージマネージャーの選択、有効な設定の記述、結果の確認を行う多段階インストールプロセスを案内します。
LSP Setup スキルの動作原理
トリガーされると、このスキルは 7 つのステップからなるワークフローを実行します:
- 言語選択
エージェントは ask_user を使用して選択肢の一覧を表示し、ユーザーが LSP サポートを必要とする言語を特定します。これがその後のすべてのステップを駆動します。
- オペレーティングシステムの検出
エージェントは uname -s コマンドを実行するか、Windows では $env:OS または %OS% をチェックしてターゲットプラットフォームを特定します。インストールコマンドはオペレーティングシステムによって異なります。例えば、macOS では brew install jdtls と実行する一方、Linux では eclipse.org からダウンロードします。
- LSP サーバーの検索(LSP server lookup)
このスキルには、14 言語向けの厳選されたデータを含む参照ファイル (references/lsp-servers.md) が含まれています。これには、オペレーティングシステムごとのインストールコマンド、バイナリ名、すぐに使用可能な設定スニペットが記載されています。エージェントはこのファイルを読み込み、一致するエントリを選択します。
- 設定のスコープ(Configuration scope)
エージェントは、設定を以下のいずれのレベルで行うかを尋ねます:
ユーザーレベル:~/.copilot/lsp-config.json—すべてのリポジトリに適用されます
リポジトリレベル:リポジトリルートにある lsp.json または .github/lsp.json—単一プロジェクトに限定されます
両方が存在する場合、リポジトリレベルの設定が優先されます。
- インストール(Installation)
エージェントは適切なインストールコマンドを実行します。例:
任意の OS での TypeScript
npm install -g typescript typescript-language-server
macOS での Java
brew install jdtls
任意の OS での Rust
rustup component add rust-analyzer
- 設定(Configuration)
エージェントは、選択された設定ファイルにエントリを追加またはマージします。形式は lspServers オブジェクトを使用し、各キーがサーバー識別子となります:
{
"lspServers": {
"java": {
"command": "jdtls",
"args": [],
"fileExtensions": {
".java": "java"
}
}
}
}
このスキルが強制する主要なルール:
command は $PATH に存在するか、絶対パスであること
引数には通常、標準入出力転送用の「--stdio」が含まれます(jdtls などの一部のサーバーはこれを内部処理します)。
fileExtensions は、各拡張子(先頭のドット付き)を言語識別子にマッピングします。
設定ファイル内の既存のエントリは保持され、エージェントはマージを行い、上書きは行いません。
- 検証
エージェントは「which」(Windows の場合は「where.exe」)を実行してサーバーへのアクセスを確認し、設定ファイルが有効な JSON 形式であることを検証します。
対応言語
このスキルには、いくつかのプログラミング言語向けの事前定義済み言語サーバーセットが付属しています。コーディングエージェントが既にマッピングされていない言語に直面した場合、適切なサーバーを検索し、手動設定の手順を案内します。
設定完了後の変化
LSP サーバーを設定すると、CLI エージェントは以下が可能になります:
依存関係全体で型を解決 — JAR ファイルや node_modules を grep で探す必要がなくなります
ソースコードがリポジトリにコミットされていない場合でも、サードパーティライブラリの定義へジャンプできます
プロジェクト内のシンボルに対するすべての参照を検索できます
任意の関数、クラス、または型のホバードキュメントを読み取れます
これは、エージェントがツール呼び出しに費やす時間を減らし、最初の試行でより正確なコードを生成することを意味します。あなたにとっては、エージェントが IDE がすでに知っている質問に答えるために JAR ファイルのデコンパイルや node_modules の検索を行う間の待ち時間が短縮され、誤ったシグネチャの読み取りに基づいた間違った方向への進路が減ります。エージェントは、エディタでの「定義へ移動」機能から得られるような構造的な理解と同じものを使ってコードを推論するため、より大きく複雑なタスクを任せても結果を信頼できます。
始め方
スキルをダウンロードする:Awesome Copilot LSP Setup スキルページを訪れ、「Download」ボタンをクリックして ZIP ファイルを取得してください。
ZIP ファイルを ~/.copilot/skills/ に展開するには、以下を実行します:
unzip lsp-setup.zip -d ~/.copilot/skills/
GitHub Copilot CLI を再起動する:Copilot CLI が既に実行中の場合は、まず /exit と入力してください。その後、copilot を再起動して新しいスキルを読み込ませます。
エージェントに言語サーバーのセットアップを依頼する:例えば、「Java の LSP を設定する」や「Python のコードインテリジェンスを有効にする」といった指示を出します。
確認:スキルがインストールされ LSP サーバーが設定された後、Copilot CLI をもう一度再起動し(/exit して再起動)、/lsp を実行してサーバーの状態を確認し、依存関係のいずれかのシンボルに対して「定義へ移動」を試みてください。
このスキルは Awesome Copilot プロジェクトの一部です。オープンソースであるため、貢献やフィードバックを歓迎します!
本記事「言語サーバーを使って GitHub Copilot CLI に本当のコードインテリジェンスを与える」は、The GitHub Blog で最初に公開されました。
原文を表示
Ever watched GitHub Copilot CLI extract a JAR file to a temporary directory, grep through .class files, and piece together an API signature from raw bytecode? The agent is resourceful, but without a language server, that’s the best it can do.
The Language Server Protocol (LSP) is the standard that powers go to definition, find references, and type resolution in editors like VS Code. It works just as well in the terminal. The LSP Setup skill automates the installation and configuration of LSP servers for Copilot CLI, so the agent gets precise, structured answers about your code instead of relying on text search heuristics.
In this post, you’ll learn how the skill works under the hood, see the configuration format it generates, and get set up for any of the 14 languages it supports today.
The problem: heuristic code understanding
Without an LSP server, the agent in GitHub Copilot CLI reverse-engineers API information through text search and binary extraction. For a Java project, that might look like:
Find the dependency JAR
find ~/.m2/repository -name "*httpclient*.jar"
Extract it to a temp directory
mkdir /tmp/httpclient && cd /tmp/httpclient
jar xf ~/.m2/repository/org/apache/httpcomponents/httpclient/4.5.14/httpclient-4.5.14.jar
Search extracted class files for a method
grep -r "execute" --include="*.class" .
For Python, the agent might cat files inside site-packages. For TypeScript, it walks node_modules. These text-based approaches work for simple cases, but they’re doing pattern-matching over raw text rather than true semantic analysis, so they miss generics, overloads, and transitive types, and can’t see compiled bytecode at all. That’s exactly the gap a language server close.
An LSP server solves this structurally. When the agent sends a textDocument/definition request for a symbol, the language server returns the exact source location, fully resolved type, and signature.
What is an agent skill?
Agent skill is a reusable instruction set that extends what an AI coding agent can do. Skills are defined in Markdown files with YAML frontmatter and follow a standard structure: trigger descriptions, step-by-step workflows, reference data, and behavioral constraints.
The LSP Setup skill uses this structure to guide the agent through a multi-step installation process, detecting the operating system, choosing the right package manager, writing valid configuration, and verifying the result.
How the LSP Setup skill works
When triggered, the skill executes a seven-step workflow:
- Language selection
The agent uses ask_user with a set of choices to determine which language the user needs LSP support for. This drives all subsequent steps.
- Operating system detection
The agent runs uname -s (or checks $env:OS / %OS% on Windows) to determine the target platform. Install commands vary by operating system. For example, brew install jdtls on macOS versus downloading from eclipse.org on Linux.
- LSP server lookup
The skill includes a reference file (references/lsp-servers.md) with curated data for 14 languages: install commands per operating system, binary names, and ready-to-use config snippets. The agent reads this file and selects the matching entry.
- Configuration scope
The agent asks whether the config should be:
User-level: ~/.copilot/lsp-config.json—applies to all repositories
Repository-level: lsp.json at the repository root or .github/lsp.json—scoped to a single project
Repository-level configuration takes precedence when both exist.
- Installation
The agent runs the appropriate install command. For example:
TypeScript on any OS
npm install -g typescript typescript-language-server
Java on macOS
brew install jdtls
Rust on any OS
rustup component add rust-analyzer
- Configuration
The agent writes or merges an entry into the chosen config file. The format uses a lspServers object where each key is a server identifier:
{
"lspServers": {
"java": {
"command": "jdtls",
"args": [],
"fileExtensions": {
".java": "java"
}
}
}
}
Key rules the skill enforces:
command must be on $PATH or an absolute path
args typically includes "--stdio" for standard I/O transport (some servers like jdtls handle this internally)
fileExtensions maps each extension (with leading dot) to a language identifier
Existing entries in the config file are preserved — the agent merges, never overwrites
- Verification
The agent runs which <binary> (or where.exe on Windows) to confirm the server is accessible, then validates the config file is well-formed JSON.
Supported languages
The skill comes with a set of predefined language servers for several programming languages. If the coding agent faces one that it is not mapped out already, it will search for an appropriate server and walk you through manual configuration.
What changes after setup
Once an LSP server is configured, the CLI agent can:
Resolve types across dependencies — no more grepping through JAR files or node_modules
Jump to definitions in third-party libraries, even when source isn’t checked into the repository
Find all references to a symbol across the project
Read hover documentation for any function, class, or type
This means the agent spends less time on tool calls and produces more accurate code on the first pass. For you, that’s less time waiting while the agent decompiles a JAR file or greps through node_modules to answer a question your IDE already knows, and fewer wrong turns built on a misread signature. The agent reasons about your code with the same structured understanding you get from go-to-definition in your editor, so you can hand it bigger, gnarlier tasks and trust the result.
Get started
Download the skill: visit the Awesome Copilot LSP Setup skill page and click the Download button to get a ZIP file.
Extract the ZIP to ~/.copilot/skills/ by running:
unzip lsp-setup.zip -d ~/.copilot/skills/
Restart GitHub Copilot CLI: if Copilot CLI is already running, type /exit first. Then relaunch copilot so it picks up the new skill.
Ask the agent to set up a language server: for example, “set up LSP for Java” or “enable code intelligence for Python”.
Verify: after the skill installs and configures the LSP server, restart Copilot CLI one more time (/exit, then relaunch), run /lsp to check the server status, and try go-to-definition on a symbol from one of your dependencies.
The skill is part of the Awesome Copilot project. It’s open source, so contributions and feedback are welcome!
The post Give GitHub Copilot CLI real code intelligence with language servers appeared first on The GitHub Blog.
関連記事
ダンジョンズ&デスクトップ:GitHub Copilot CLI で手動生成型ローグライクを構築する
開発者が GitHub Copilot CLI を使用し、自身のコードベースを BSP アルゴリズムで生成されたプレイ可能なローグライクダンジョンゲームに変換した。このプロジェクトは「GitHub Dungeons」と呼ばれるターミナルゲームとして実装され、リポジトリ内の構造が部屋や通路、敵として表現される。
アイデアからプルリクエストへ:GitHub Copilot CLIで構築する実践ガイド
GitHubが、開発者がターミナルでプロジェクトを初期化・テスト・デバッグする現実に合わせて、GitHub Copilot CLIが意図からレビュー可能な差分まで直接支援する実践的なワークフローを紹介している。
社内データ分析エージェントの構築方法について
GitHub は、大規模なデータ組織が直面する自己完結型のデータアクセスと洞察提供の課題に対し、AI を活用した信頼性の高い解決策として、社内でデータ分析エージェントを構築したことを発表した。
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み