Add readonly editor context capabilities for agents
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- clojure
調査の方向性
Start by locating the existing editor/getDiagnostics request, client capability handling, and protocol definitions; the issue does not name specific files or tests. Compare those paths with the editor-client implementations, especially eca-emacs, and identify how the initial symbolAtPosition, definitions, and documentSymbols scope fits the shared protocol. Done means the editor-agnostic request and per-feature capabilities support partial or unavailable results, with cursor/range filtering for diagnostics.
索引モデルが issue の本文から書いたものです。
説明
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Add readonly editor context capabilities for agents
Summary
ECA already supports editor/getDiagnostics, where the server asks the client/editor for diagnostics and the client maps editor-specific data into ECA protocol data.
We should add a similar readonly editor/getContext request so agents can ask the editor for semantic/navigation context around the current cursor instead of relying only on raw file reads and text search.
This should be editor-agnostic. eca-emacs can implement it via Emacs APIs, while VS Code/IntelliJ clients can implement the same protocol via their own APIs.
Motivation
Agents currently infer too much from text. For example, to understand a symbol under the cursor, the agent may grep for the name and read several files. Editors already know better through xref/LSP/PSI/indexes.
Readonly editor context would let the agent ask questions like:
- what symbol is under the cursor?
- where is its definition?
- what are the top-level symbols in this file?
- what diagnostic is at/near the cursor?
This should reduce wrong file reads, bad grep matches, and hallucinated API usage.
Proposed API
Add a new client capability, ideally per feature:
{
"editor": {
"diagnostics": true,
"context": {
"symbolAtPosition": true,
"documentSymbols": true,
"definitions": true,
"documentation": true,
"references": true,
"workspace": true,
"enclosingSymbols": true
}
}
}
Add a request:
editor/getContext
Example params:
{
"uri": "file:///repo/src/foo.clj",
"position": { "line": 42, "character": 10 },
"include": ["symbolAtPosition", "definitions", "documentSymbols"],
"limit": 100
}
The response should be best-effort and support unavailable capabilities:
{
"symbolAtPosition": { "text": "foo", "range": { "...": "..." } },
"definitions": [],
"documentSymbols": [],
"unavailable": [
{ "capability": "documentation", "reason": "No provider available" }
]
}
Initial scope
Start small:
-
symbolAtPosition- Helps the agent know what the user is pointing at.
- Emacs:
thing-at-point/ bounds. - VS Code: word range at position.
- IntelliJ: PSI element at caret.
- Gotcha: often textual, not fully semantic.
-
definitions- Replaces grep-based “find definition” with editor/language-backed resolution.
- Emacs:
xref. - VS Code/LSP: definition provider /
textDocument/definition. - IntelliJ: resolve / go to declaration.
- Gotcha: may return multiple targets or declarations instead of implementations.
-
documentSymbols- Gives the agent a compact outline of the current file.
- Emacs:
imenuindex. - VS Code/LSP: document symbols.
- IntelliJ: structure view / PSI.
- Gotcha: Emacs
imenumay provide positions but not full ranges.
Also extend editor/getDiagnostics with optional cursor/range filtering:
{
"uri": "file:///repo/src/foo.clj",
"position": { "line": 42, "character": 10 }
}
This should return/prioritize diagnostics at or near the cursor. Current diagnostics already include uri, range, severity, code, source, and message, so this is about relevance, not adding basic metadata.
Later additions
After the initial API is working, consider:
-
documentation- Emacs:
eldoc. - VS Code/LSP: hover/signature help.
- IntelliJ: quick documentation.
- Useful to avoid guessing APIs.
- Emacs:
-
references- Emacs:
xref. - VS Code/LSP: references provider.
- IntelliJ: find usages.
- Useful for refactors, but can be expensive; require explicit include and limit.
- Emacs:
-
workspace- Return workspace roots, current file, open/visible files.
- Avoid returning all project files by default.
-
enclosingSymbols- Current function/class/method around cursor.
- Best-effort only. Easy with PSI/tree-sitter or document symbol ranges; unreliable with plain Imenu if ranges are missing.
-
codeActions- Quick fixes for diagnostics.
- Useful but not readonly; probably separate design later.
Design constraints
- Keep
editor/getDiagnosticsandeditor/getContextseparate. - Use per-feature capabilities; not all clients will support everything.
- Return partial results and explicit
unavailableentries. - Avoid expensive defaults (
references, full workspace file list). - Do not make this Emacs-specific.
- Treat textual and semantic results differently where needed.
Suggested first implementation for eca-emacs
symbolAtPosition:thing-at-point/bounds-of-thing-at-pointdefinitions:xrefdocumentSymbols: programmatic Imenu index, not the interactiveimenucommand- diagnostics near cursor: filter existing collected diagnostics by range/distance
- 主要言語
- Clojure
- スター
- 1k
- フォーク
- 82
- 平均マージ
- 3日 39分
- マージ済み PR(30日)
- 15
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
editor-code-assistant/eca のほかの issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
editor-code-assistant/eca#655 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
editor-code-assistant/eca#652 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
editor-code-assistant/eca#648 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
editor-code-assistant/eca#644 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Add the ability to see what changed in the system prompt対応中かも @zikajk が 9 日前に担当しました。 オープンenhancement
editor-code-assistant/eca#642 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
editor-code-assistant/eca の issue をすべて見る
似ている issue
-
Usage analytics `v_tables` ignores table metadata set by users (`metabase_table_user_settings`)オープン.Needs Triage .Team/Graphy Priority:P3 Type:Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
metabase/metabase#84762 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NoahTheDuke/splint#57 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
IOP MCP
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
calcit-lang/calcit#2133 ·
メンテナーはふだん 1 日以内に返信