Skip to content

feat(ui) introducing an lsp menu dialog to fit more features than just codeactions - #2702

Open
gat0sy wants to merge 3 commits into
Acode-Foundation:mainfrom
gat0sy:feat/lsp-ui-integration
Open

feat(ui) introducing an lsp menu dialog to fit more features than just codeactions#2702
gat0sy wants to merge 3 commits into
Acode-Foundation:mainfrom
gat0sy:feat/lsp-ui-integration

Conversation

@gat0sy

@gat0sy gat0sy commented Aug 8, 2026

Copy link
Copy Markdown

Adds a dedicated LSP actions menu to the editor.

The tooltip button now opens the new LSP menu instead of directly showing code actions. Code actions have been moved into this menu alongside the other go-to actions.

The menu provides quick access to:

  • Go to Definition
  • Go to Declaration
  • Go to Implementation
  • Go to Type Definition
  • Find References
  • Rename Symbol
  • Code Actions

Single-result actions are executed directly without opening the menu.

This PR is based on PR #2701

gat0sy added 3 commits August 7, 2026 21:41
LspToPosition threw range error on format error.
We attempt to fix it here with by clamping so we get the correct line count between the client and server.

applyTextEdit as also been extracted so both transport and client manager can import it from the helper.
go to def and similar fonction have been added,
a new interceptFileLink method has been created to solve an FileUriExposedException you may get if taping the signature link on the hover.

if the link is a website, it skips and let the normal behavior occur ( open a web browser page )
if the link is a file, it modifies the uri so the tap behave like a go to instead of crashing the whole app.
There are notably also some fixes for code actions, rename...ect, now they use the new lspPostionToOffset that uses clamping
…actions menu

Added resolveContentUriForFileUri() to map LSP file:// responses back to
content:// and sftp:// URIs via addedFolder matching

Refactor editorManager displayFile/openFile to resolve URIs before
opening, enabling cross-workspace go-to-definition and references

Added SFTP path-aware root URI resolution for remote workspace context

Replace selection menu code-actions button with full LSP actions menu
(definition, declaration, implementation, type-definition, references,
rename, code-actions) with single-item auto-execution
@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds an LSP actions picker with go-to operations and expands URI, client-lifecycle, tooltip-link, and server-initiated workspace-edit handling.

  • Adds definition, declaration, implementation, and type-definition navigation.
  • Moves code actions, references, and rename into a shared selection menu.
  • Adds workspace/applyEdit support and shared LSP text-edit utilities.
  • Adds file/content/SFTP URI translation for navigation and a client idle grace period.

Confidence Score: 3/5

The PR is not safe to merge until multi-client action selection and ordered workspace edits are handled without hiding capabilities or dropping edits.

The menu can omit valid actions in documents served by multiple LSP clients, while workspace/applyEdit can silently discard earlier edit groups when a document appears more than once.

Files Needing Attention: src/lib/selectionMenu.js, src/cm/lsp/definition.ts, src/cm/lsp/transport.ts

Important Files Changed

Filename Overview
src/lib/selectionMenu.js Adds the unified LSP picker, but capability discovery assumes a single client and can hide supported actions in multi-client documents.
src/cm/lsp/definition.ts Implements four go-to requests and result navigation, but dispatch also assumes one active LSP client.
src/cm/lsp/transport.ts Adds asynchronous workspace/applyEdit handling, but collapses ordered document changes by URI and can silently drop edit groups.
src/cm/lsp/textEditUtils.ts Centralizes LSP-position conversion and synchronized text-edit application.
src/components/referencesPanel/utils.js Adds local, SAF, and SFTP translation for file URIs returned by language servers.
src/cm/lsp/clientManager.ts Expands capabilities and URI normalization, sends post-initialization configuration, and delays disposal of idle clients.
src/cm/lsp/tooltipExtensions.ts Intercepts file links in hover and signature documentation and routes them through the editor workspace.
src/lib/editorManager.js Resolves LSP file URIs to accessible storage URLs before opening or displaying files.

Sequence Diagram

sequenceDiagram
  participant User
  participant Menu as LSP Actions Menu
  participant Plugin as LSP Client Plugin
  participant Server as Language Server
  participant Workspace
  User->>Menu: Open LSP actions
  Menu->>Plugin: Inspect capabilities
  User->>Menu: Select action
  Menu->>Server: Send textDocument request
  Server-->>Menu: Locations or WorkspaceEdit
  alt Navigation result
    Menu->>Workspace: Open target URI
  else workspace/applyEdit
    Server->>Workspace: Apply edits by URI
  end
Loading

Reviews (1): Last reviewed commit: "feat(editor): resolve LSP file:// URIs a..." | Re-trigger Greptile

Comment thread src/lib/selectionMenu.js
Comment on lines +43 to +46
const plugin = LSPPlugin.get(editor);
if (!plugin) return;

const capabilities = plugin.client.serverCapabilities || {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Single-client capability discovery

When multiple language-server clients are attached to a document, this menu reads capabilities from only one plugin, causing actions supported by another client to be omitted; the go-to implementation repeats the same single-client lookup and can reject an otherwise supported action.

Knowledge Base Used: LSP Integration

Comment thread src/cm/lsp/transport.ts
Comment on lines +175 to +181
const changesByUri: Record<string, TextEdit[]> =
edit.changes ??
Object.fromEntries(
(edit.documentChanges ?? [])
.filter((c): c is { textDocument: { uri: string }; edits: TextEdit[] } => "edits" in c)
.map((c) => [c.textDocument.uri, c.edits]),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Duplicate document edits are dropped

When documentChanges contains multiple entries for the same URI, Object.fromEntries overwrites every earlier edit group with the final one, causing workspace refactors to be only partially applied while the client can still report success.

Knowledge Base Used: LSP Integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant