feat(lsp): add Claude Code LSP plugins with multi-language server support - #52
Conversation
…port Add comprehensive LSP (Language Server Protocol) plugin integration for Claude Code: - Add LSP CLI for language server setup and management (kotlin, dart) - Create 8 LSP plugins (astro, biome, dart, deno, kotlin, prisma, svelte, vue) - Each plugin includes .claude-plugin metadata and LSP configuration - Support Kotlin LSP launcher script for multiple platforms - Add bin entry point for lsp CLI command in package.json Supported language servers: - Astro: Astro SFC with TypeScript support - Biome: JavaScript/TypeScript linting and formatting - Dart: Dart language server with Flutter support - Deno: Deno runtime TypeScript/JavaScript - Kotlin: Kotlin language server with Java 21 runtime - Prisma: Prisma ORM schema editor - Svelte: Svelte component development - Vue: Vue 3 Single File Component support Each plugin provides: - .claude-plugin/plugin.json: Plugin metadata - .lsp.json: LSP server configuration - README.md: Setup and usage documentation
Summary of ChangesHello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the language server capabilities of Claude Code by integrating support for eight additional programming languages and frameworks. It introduces a new command-line tool to streamline the installation and configuration of these language servers, particularly for Kotlin and Dart, which now feature automated, cross-platform setup with bundled dependencies. This expansion aims to provide a richer development experience for a wider range of projects within the Claude Code environment. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces an impressive set of new LSP plugins and a CLI for managing them, which is a great enhancement. The auto-download feature for Kotlin and Dart is particularly useful. My review focuses on improving security and maintainability. I've suggested adding checksum validation for downloaded files to enhance security and dynamically fetching release information to improve long-term maintainability of hardcoded configurations. Overall, this is a solid contribution with a few areas for refinement.
| console.log('Downloading Java 21...') | ||
| await downloadAndExtract(javaConfig.url, javaDir) | ||
| if (!isWindows) { | ||
| await fs.chmod(javaPath, 0o755) | ||
| } | ||
| console.log('Java 21 installed') |
There was a problem hiding this comment.
The downloadAndExtract function is used to fetch and unpack dependencies from the internet, but there's no validation of the downloaded file's integrity. This poses a security risk. If the download source is compromised, or in a man-in-the-middle attack, a malicious archive could be served, leading to arbitrary code execution on the user's machine.
It's highly recommended to add checksum validation (e.g., SHA256) for all downloaded artifacts. Many release pages (like on GitHub) provide checksums for their assets. These checksums should be stored in the configuration and verified after download, before extraction.
A similar concern applies to the Kotlin LSP download on line 114 and the Dart SDK download on line 161.
| const KOTLIN_CONFIG = { | ||
| version: '0.253.10629', | ||
| lspUrl: 'https://download-cdn.jetbrains.com/kotlin-lsp/0.253.10629/kotlin-0.253.10629.zip', | ||
| java: { | ||
| 'win-x64': { | ||
| url: 'https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-win32-x64-1.42.0-561.vsix', | ||
| javaHomePath: 'extension/jre/21.0.7-win32-x86_64', | ||
| }, | ||
| 'linux-x64': { | ||
| url: 'https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-linux-x64-1.42.0-561.vsix', | ||
| javaHomePath: 'extension/jre/21.0.7-linux-x86_64', | ||
| }, | ||
| 'linux-arm64': { | ||
| url: 'https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-linux-arm64-1.42.0-561.vsix', | ||
| javaHomePath: 'extension/jre/21.0.7-linux-aarch64', | ||
| }, | ||
| 'osx-x64': { | ||
| url: 'https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-darwin-x64-1.42.0-561.vsix', | ||
| javaHomePath: 'extension/jre/21.0.7-macosx-x86_64', | ||
| }, | ||
| 'osx-arm64': { | ||
| url: 'https://github.com/redhat-developer/vscode-java/releases/download/v1.42.0/java-darwin-arm64-1.42.0-561.vsix', | ||
| javaHomePath: 'extension/jre/21.0.7-macosx-aarch64', | ||
| }, | ||
| } as Record<string, { url: string, javaHomePath: string }>, | ||
| } | ||
|
|
||
| /** | ||
| * Dart SDK setup configuration | ||
| */ | ||
| const DART_CONFIG = { | ||
| version: '3.7.1', | ||
| platforms: { | ||
| 'win-x64': 'https://storage.googleapis.com/dart-archive/channels/stable/release/3.7.1/sdk/dartsdk-windows-x64-release.zip', | ||
| 'linux-x64': 'https://storage.googleapis.com/dart-archive/channels/stable/release/3.7.1/sdk/dartsdk-linux-x64-release.zip', | ||
| 'linux-arm64': 'https://storage.googleapis.com/dart-archive/channels/stable/release/3.7.1/sdk/dartsdk-linux-arm64-release.zip', | ||
| 'osx-x64': 'https://storage.googleapis.com/dart-archive/channels/stable/release/3.7.1/sdk/dartsdk-macos-x64-release.zip', | ||
| 'osx-arm64': 'https://storage.googleapis.com/dart-archive/channels/stable/release/3.7.1/sdk/dartsdk-macos-arm64-release.zip', | ||
| } as Record<string, string>, | ||
| } |
There was a problem hiding this comment.
The configuration objects KOTLIN_CONFIG and DART_CONFIG contain hardcoded version numbers and download URLs. This can become a maintenance burden, as the tool will quickly become outdated and require manual updates to the source code to support newer versions of the LSPs.
Consider fetching the latest stable release information dynamically. For dependencies hosted on GitHub, like vscode-java, you can use the GitHub API to get the latest release tag. For other dependencies, there might be a metadata file (e.g., a latest.json) you can query.
References
- When downloading dependencies from GitHub, prefer fetching the latest stable release tag dynamically via the GitHub API instead of using the 'master' branch to ensure stability.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
=======================================
Coverage 39.82% 39.82%
=======================================
Files 55 55
Lines 6345 6345
=======================================
Hits 2527 2527
Misses 3818 3818 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Integrate all LSP servers into the existing code-please plugin using the `code lsp-server <id>` command. This approach leverages existing root detection logic to safely activate servers only when appropriate config files exist (e.g., biome.json for Biome, deno.json for Deno). Changes: - Add `lsp-server` command to @pleaseai/code CLI - Add `lspServers` field to .claude-plugin/plugin.json (8 servers) - Delete separate LSP plugin directories (plugins/lsp/*) - Remove standalone CLI from @pleaseai/code-lsp package Supported servers: biome, vue, svelte, deno, kotlin, dart, prisma, astro
Add ESLint and Oxlint language server configurations to the Claude Code plugin for linting support.
…mand - Add try-catch around server.spawn() with proper error logging - Add stdin null check before piping - Add process and pipe error handlers - Fix Biome extensions (add 8 missing extensions) - Add tests for lsp-server command edge cases
Summary
This PR adds 8 new LSP plugins for Claude Code, providing language server support for Tier 1 languages not covered by official Claude Code plugins. Each plugin includes automatic language server setup and configuration.
Changes
LSP Plugins (plugins/lsp/)
Plugin Structure
Each plugin includes:
.claude-plugin/plugin.json- Plugin manifest.lsp.json- LSP configurationREADME.md- Setup instructionsLSP CLI (packages/lsp/src/cli.ts)
New CLI commands for language server setup:
lsp setup kotlin- Download and configure Kotlin LSP with bundled JRE (21.0.7)lsp setup dart- Download and configure Dart SDK (v3.7.1)lsp version- Show version infolsp help- Show helpKey Features
Test Plan
lsp setup kotlinlsp setup dartRelated Issues
Closes #50