claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Feature Request: Add Dart/Flutter LSP support

Open billychl1 opened this issue 10 months ago • 2 comments

Summary

Add official Dart/Flutter language server support to Claude Code's LSP plugin system.

Motivation

Flutter is one of the most popular cross-platform mobile development frameworks, and Dart is its programming language. Currently, Claude Code supports LSP for many languages (TypeScript, Swift, Python, Go, Rust, Java, Kotlin, C#, C/C++, PHP, Lua) but lacks Dart/Flutter support.

This limits code intelligence features (go-to-definition, find references, hover info, document symbols) when working on Flutter projects.

Proposed Solution

Add a dart-lsp plugin to claude-plugins-official that enables the built-in Dart Analysis Server, similar to how other LSP plugins work.

The Dart SDK includes a language server that can be invoked with:

dart language-server

Suggested Configuration

{
  "dart": {
    "command": "dart",
    "args": ["language-server"],
    "extensionToLanguage": {
      ".dart": "dart"
    }
  }
}

Prerequisites

Users would need the Dart SDK or Flutter SDK installed, which includes the Dart language server.

Alternatives Considered

Attempted using a third-party plugin (dart-analyzer@claude-code-lsps), but Claude Code only supports built-in LSP implementations - external plugins can enable them but not add new language servers.

Additional Context

  • Dart SDK: https://dart.dev/get-dart
  • Flutter SDK: https://flutter.dev/docs/get-started/install
  • Dart Language Server Protocol: https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/doc/lsp.md

billychl1 avatar Jan 08 '26 11:01 billychl1

+1

fatihsever avatar Jan 09 '26 13:01 fatihsever

I'd set it up immediately. Super-nice-to-have feature for sure.

DrAlexHarrison avatar Jan 13 '26 10:01 DrAlexHarrison

https://github.com/anthropics/claude-plugins-official/pull/57

I found a PR in the anthropics/claude-plugins-official repo for this. FYI.

fatihsever avatar Jan 14 '26 05:01 fatihsever

Nice!

DrAlexHarrison avatar Jan 14 '26 07:01 DrAlexHarrison

Like!

rosherman2 avatar Jan 26 '26 09:01 rosherman2

meerhelm avatar Feb 26 '26 06:02 meerhelm

Like !

chrisjoe avatar Mar 03 '26 08:03 chrisjoe

anthropics/claude-plugins-official#57

I found a PR in the anthropics/claude-plugins-official repo for this. FYI.

why the PR was closed?

souoberg avatar Mar 11 '26 03:03 souoberg

seems like @tyler-jewell deleted his repo with the change. I think we should open another one. Would be amazing to have this

neokree avatar Mar 11 '26 14:03 neokree

seems like @tyler-jewell deleted his repo with the change. I think we should open another one. Would be amazing to have this

Yea, sorry. Would be happy to help contribute, can someone more responsible for me start it back up and I can contribute and test out?

tyler-jewell avatar Mar 11 '26 14:03 tyler-jewell

Hey! I published a dart-lsp plugin in my personal marketplace that provides exactly this.

To install, use /plugin to add the marketplace using the repo URL https://github.com/michelsciortino/claude-plugins then run: /plugin install dart-lsp@michelsciortino-marketplace.

michelsciortino avatar Mar 17 '26 15:03 michelsciortino

@michelsciortino — thanks for shipping the community plugin (https://github.com/michelsciortino/dart-lsp). Quick correction to a warning I posted earlier in this thread: I cast doubt on the lspServers-inline-in-plugin.json mechanism your plugin uses. After more empirical testing on Claude Code 2.1.119 I can confirm it works — it's a third valid config location alongside .lsp.json at the plugin root.

I just spent a session investigating the same question for a Zig plugin and the empirically-working shape on Claude Code 2.1.119 is .lsp.json at the plugin root, which gets copied to ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/.lsp.json on install. The runtime loader reads from that path. The lspServers-in-plugin.json approach also works — that's the third valid path alongside .lsp.json. The one config location that's empirically inert is lspServers in marketplace.json for non-claude-plugins-official marketplaces.

For Dart, that means a plugins/dart-lsp/.lsp.json like:

{
  "dart": {
    "command": "dart",
    "args": ["language-server", "--client-id=claude-code", "--client-version=1.0"],
    "extensionToLanguage": { ".dart": "dart" }
  }
}

…or keep it inline in plugin.json per @michelsciortino's setup — both work.

One important caveat for any third-party LSP plugin: do not include restartOnCrash or maxRestarts in the manifest. They're in the plugins reference but the runtime rejects them at init with "restartOnCrash is not yet implemented. Remove this field from the configuration." — the whole LSP server fails to initialize. startupTimeout is fine. Working reference layout (Zig, but the shape generalizes): https://github.com/agent-sh/zig-lsp v0.1.1. Empirical writeup of the third-party path with the full A/B comparison: https://github.com/anthropics/claude-code/issues/53399.

To verify any third-party LSP plugin loads:

  • Working: claude --debug log contains Loaded 1 LSP server(s) from plugin: <name> and Total LSP servers loaded: <N>.
  • Broken: log contains Checking plugin <name> with no following Loaded line — the loader sees the plugin but doesn't pick up its server config. Or Failed to initialize LSP server — usually means a bad/unimplemented field in the config.

avifenesh avatar Apr 26 '26 00:04 avifenesh

💯 🙏 👍

dawid-niedzwiecki avatar Jun 28 '26 16:06 dawid-niedzwiecki

Good news: you don't need a built-in Dart server for this. Any plugin can register its own language server through an .lsp.json file (or an lspServers block in plugin.json), and Claude Code will spawn it for the mapped extensions. The config you sketched is exactly the right shape:

{ "dart": { "command": "dart", "args": ["language-server"], "extensionToLanguage": { ".dart": "dart" } } }

Drop that in a local plugin (or a marketplace one), make sure dart is on your PATH, and check the /plugin Errors tab if it doesn't start. Details: https://code.claude.com/docs/en/plugins-reference#lsp-servers

Closing since this is possible today; if you hit a specific failure with a Dart plugin, please open a bug with the --debug output.

🤖 Generated with Claude Code

bcherny avatar Aug 17 '26 03:08 bcherny

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Oct 06 '26 14:10 github-actions[bot]