Skip to content

feat: add lsp_format_document tool - #1194

Open
Dhirenderchoudhary wants to merge 2 commits into
Nano-Collective:mainfrom
Dhirenderchoudhary:feat/lsp-format-document-1171
Open

feat: add lsp_format_document tool#1194
Dhirenderchoudhary wants to merge 2 commits into
Nano-Collective:mainfrom
Dhirenderchoudhary:feat/lsp-format-document-1171

Conversation

@Dhirenderchoudhary

Copy link
Copy Markdown
Contributor

Description

Adds an agent-callable lsp_format_document tool that uses the existing LSPManager.formatDocument() API to format a file via the connected language server, apply the returned edits, and write the result to disk. This replaces the need to guess a formatter CLI through execute_bash.

Also wires approval, plan-mode exclusion, ACP tool kind, compact result display, and a short docs note.

Closes #1171

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Docs-only or internal chores need no changeset (or run pnpm changeset --empty to note that intentionally).

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

Expose the existing LSP formatDocument API as an agent-callable tool so
formatting can use the connected language server instead of guessing a CLI.
@github-actions github-actions Bot added area:tools Tool implementations and tool-calling area:docs Documentation labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

No changeset found

This PR does not add a changeset, so it will not appear in the changelog or trigger a release.

If the change is user-facing, add one:

pnpm changeset

Pick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated .changeset/*.md file.

If this PR is docs-only or a chore that needs no release note, you can ignore this - or run pnpm changeset --empty to record that intentionally.

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

Labels

area:docs Documentation area:tools Tool implementations and tool-calling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] expose lsp_format_document as an agent-callable tool

1 participant