Add Full Svelte LSP Intelligence to Claude Code with This Plugin

Add Full Svelte LSP Intelligence to Claude Code with This Plugin

Install the svelte-lsp plugin to give Claude Code hover docs, go-to-definition, find references, and diagnostics for .svelte files.

4h ago·3 min read·83 views·via hn_claude_code
Share:

What It Does

Claude Code currently has no built-in language server protocol (LSP) support for Svelte files. This means when you're working with .svelte components, Claude lacks the code intelligence features you get with other languages: no hover documentation, no go-to-definition, no find references, no document symbols, and no diagnostics.

The svelte-lsp plugin solves this by registering svelte-language-server as the LSP handler for .svelte files. This is the same language server that VS Code uses for Svelte development, giving Claude Code full LSP-powered intelligence for Svelte components.

Setup

Installation takes about 30 seconds:

# Quick install
npx svelte-lsp-claude

# Or manual install
npm install -g svelte-language-server
claude plugin marketplace add RA1NCS/svelte-lsp
claude plugin install svelte-lsp@svelte-lsp

After installation, restart Claude Code. The plugin automatically registers svelteserver --stdio as the LSP server for .svelte files.

Prerequisites:

  • Node.js 16+
  • svelte-language-server installed globally (included in quick install)
  • Claude Code with plugin support enabled

How It Works

The plugin leverages Claude Code's plugin system, which reads the lspServers field from plugin.json at startup. This maps .svelte file extensions to the Svelte language server, giving Claude the same LSP capabilities you'd expect from a dedicated IDE.

What's particularly useful is that the plugin includes a CLAUDE.md file that instructs Claude to proactively use LSP when working with Svelte files. This means Claude will automatically leverage the language server for:

  • Hover documentation: See type information and documentation when hovering over Svelte components and directives
  • Go-to-definition: Jump to component definitions with Ctrl+Click
  • Find references: Find all usages of a component or variable
  • Document symbols: Navigate component structure via outline view
  • Diagnostics: Get real-time error checking and warnings

When To Use It

If you're building Svelte or SvelteKit applications with Claude Code, this plugin is essential. The difference is immediately noticeable:

  1. Component navigation: When Claude suggests using a component, you can now jump directly to its definition
  2. Error prevention: Get diagnostics before running code
  3. Learning Svelte: Hover docs help understand Svelte-specific syntax and APIs
  4. Refactoring: Find references makes renaming components safe and easy

Without this plugin, Claude treats .svelte files as plain text with some syntax highlighting. With it, you get full IDE-level intelligence that makes Svelte development in Claude Code comparable to VS Code.

The plugin is MIT licensed and open source, so you can inspect the implementation or contribute improvements. Given how quickly the Claude Code ecosystem is evolving, community plugins like this are becoming essential for language-specific workflows.

AI Analysis

Svelte developers using Claude Code should install this plugin immediately. The lack of LSP support for Svelte has been a significant gap in Claude Code's capabilities, forcing developers to switch to other editors for Svelte-specific tasks. After installation, update your workflow: when Claude suggests Svelte components or syntax, use hover (Ctrl+K, Ctrl+I) to see documentation. Use go-to-definition (Ctrl+Click) to navigate component trees. Most importantly, trust the diagnostics—Claude will now catch Svelte-specific errors that it previously missed. If you maintain a team CLAUDE.md, add a note about the Svelte LSP plugin being installed. This ensures all team members know about the enhanced capabilities. Consider similar plugins for other languages where Claude Code lacks built-in LSP support—this pattern of community LSP plugins is likely to expand.
Original sourcegithub.com

Trending Now

More in Products & Launches

View all