Skip to content

Conversation

@ktnyt
Copy link
Owner

@ktnyt ktnyt commented Jan 2, 2026

This PR adds 6 new LSP tools from PR #28, plus fixes and comprehensive tests.

Features Added

Adds the following new MCP tools to match Claude Code's built-in LSP capabilities:

  • get_hover: Get hover information (documentation, type info) for a symbol
  • find_workspace_symbols: Search for symbols across the entire workspace
  • find_implementation: Find implementations of interfaces/abstract methods
  • prepare_call_hierarchy: Get call hierarchy item at a position
  • get_incoming_calls: Find all callers of a function
  • get_outgoing_calls: Find all functions called by a function

Fixes

  • Windows path handling: Fixed incomingCalls and outgoingCalls to use uriToPath utility instead of string replacement, ensuring proper Windows path handling

Tests

Added comprehensive test coverage for all 6 new LSP methods:

  • hover: Tests hover information retrieval and null handling
  • workspaceSymbol: Tests workspace-wide symbol search with multiple scenarios
  • findImplementation: Tests implementation finding with array and object results
  • prepareCallHierarchy: Tests call hierarchy preparation
  • incomingCalls: Tests incoming calls retrieval (includes uriToPath usage verification)
  • outgoingCalls: Tests outgoing calls retrieval (includes uriToPath usage verification)

All tests follow existing patterns using mocks for getServer, ensureFileOpen, and sendRequest methods.

Changes

  • src/types.ts: Add CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall types
  • src/lsp-client.ts: Add 6 new methods + fix Windows path handling
  • index.ts: Add MCP tool definitions and handlers for all new tools
  • src/lsp-client.test.ts: Add comprehensive test coverage (654 lines)

Related

Jye10032 and others added 6 commits December 22, 2025 18:48
Add the following new MCP tools to match Claude Code's built-in LSP capabilities:

- get_hover: Get hover information (documentation, type info) for a symbol
- find_workspace_symbols: Search for symbols across the entire workspace
- find_implementation: Find implementations of interfaces/abstract methods
- prepare_call_hierarchy: Get call hierarchy item at a position
- get_incoming_calls: Find all callers of a function
- get_outgoing_calls: Find all functions called by a function

Changes:
- src/types.ts: Add CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall types
- src/lsp-client.ts: Add hover(), workspaceSymbol(), findImplementation(), prepareCallHierarchy(), incomingCalls(), outgoingCalls() methods
- index.ts: Add MCP tool definitions and handlers for all new tools
feat: add new LSP tools (hover, workspace_symbol, find_implementation…
Fix Windows path handling in incomingCalls and outgoingCalls methods.
Previously used item.uri.replace('file://', '') which doesn't work
correctly on Windows. Now uses the existing uriToPath utility function
which properly handles both Windows and Unix paths.
…ementation, prepareCallHierarchy, incomingCalls, outgoingCalls)

Add comprehensive test coverage for the 6 new LSP methods added in PR #28:
- hover: Test hover information retrieval and null handling
- workspaceSymbol: Test workspace-wide symbol search with multiple scenarios
- findImplementation: Test implementation finding with array and object results
- prepareCallHierarchy: Test call hierarchy preparation
- incomingCalls: Test incoming calls retrieval (includes uriToPath usage verification)
- outgoingCalls: Test outgoing calls retrieval (includes uriToPath usage verification)

All tests follow the existing test patterns using mocks for getServer,
ensureFileOpen, and sendRequest methods.
Fix formatting issues:
- Split long return type definition in hover() method across multiple lines
- Format sendRequest calls in workspaceSymbol, incomingCalls, and outgoingCalls to single line
Fix tests to use uriToPath() result instead of hardcoded '/test.ts' path.
This ensures tests work correctly across different platforms (Unix/Windows)
where uriToPath may return different path formats.
@Jye10032
Copy link
Contributor

Jye10032 commented Jan 5, 2026

Windows CI Fix

The 4 failing tests (incomingCalls and outgoingCalls) are caused by hardcoded Unix-style paths like /test.ts.

Problem: On Windows, /test.ts is not a valid absolute path (Windows requires drive letters like C:\test.ts), causing pathToUri() and uriToPath() to fail.

Solution: Replace hardcoded paths with join(TEST_DIR, 'test.ts') which generates valid absolute paths on all platforms:

  • Windows: D:\a\_temp\cclsp-test\test.ts
  • macOS/Linux: /tmp/cclsp-test/test.ts

I've prepared a fix PR below.

@Jye10032
Copy link
Contributor

Jye10032 commented Jan 5, 2026

Hi @ktnyt!

I found this project because Claude Code's official LSP plugin (typescript-lsp@claude-plugins-official) only contains a README and config files - there's no actual implementation. When I try to use the built-in LSP tool, it returns "No LSP server available for file type".

The official plugin is also closed-source - I only discovered this by digging through the local plugin directory after installation.

So I searched for alternatives and found cclsp, which actually works! I then added the missing LSP features (hover, workspaceSymbol, goToImplementation, prepareCallHierarchy, incomingCalls, outgoingCalls) based on the official LSP documentation.

cclsp has clear advantages:

  • It actually works (unlike the official plugin)
  • Open source - transparent and customizable
  • You can see exactly which LSP server is being used
  • MCP compatibility for other AI tools
  • Flexible server configuration and adapters

Thanks for reviewing my PR and fixing the bugs! I really appreciate you taking the time to improve the code quality. Happy to continue contributing to this project!

Windows test failures will no longer block the release job, while Ubuntu and macOS tests continue to block on failure.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@ktnyt
Copy link
Owner Author

ktnyt commented Jan 23, 2026

Apologies for my late response. I was trying to get the Windows tests to work with no avail. I'll merge this and try to fix the tests in the future.

@ktnyt ktnyt merged commit c8354e6 into main Jan 23, 2026
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants