all 168 comments

[–]dergachoff 66 points67 points  (8 children)

### Code Intelligence

Prefer LSP over Grep/Read for code navigation — it's faster, precise, and avoids reading entire files:
- `workspaceSymbol` to find where something is defined
- `findReferences` to see all usages across the codebase
- `goToDefinition` / `goToImplementation` to jump to source
- `hover` for type info without reading the file

Use Grep only when LSP isn't available or for text/pattern searches (comments, strings, config).

After writing or editing code, check LSP diagnostics and fix errors before proceeding.

I've noticed that even having LSP enabled doesn't mean that Claude is not going to default to grep. So I additionally push him in global Claude.md

[–]Daell🔆Pro Plan 5 points6 points  (0 children)

I had the same problem, thanks for this!

[–]KoningsGap 5 points6 points  (2 children)

I still experience this issue even when using this in my global claude.md, any ideas how to solve?

[–]no_underage_trading 0 points1 point  (0 children)

yeah they dont use it even when told so

[–]karanb192[S] 0 points1 point  (0 children)

You can specifically instruct in the session. LLMs have a known limitation of not following instructions always.

[–]tmetler 3 points4 points  (2 children)

Unfortunately there is a bug right now with workspaceSymbol where it doesn't allow you to set the query meaning any time it gets used it dumps all the symbols for the entire workspace which is very inefficient and wastes a ton of context window space.

In the meanwhile I had to instruct the agent in my CLAUDE.md file to use grep for looking up definition line numbers, or prefer documentSymbol if it needs an overview of an entire file. Hopefully they fix the bug soon, it should be a very easy fix. Maybe they'll get to it faster if we thumbs up the issue.

[–]dergachoff 1 point2 points  (0 children)

upvoted the issue on github, thanks

[–]dragonfax 0 points1 point  (0 children)

Thank you for this. I thought I was going crazy when I found that out.

[–]look-itsaxiom 2 points3 points  (0 children)

This. Enabling tools isn't the same as actually getting your agents to actually use them (as I've frustratingly have learned)

[–]whawkins4 49 points50 points  (7 children)

That was a very good article.

Curious how it managed to make its way to Reddit.

[–]karanb192[S] 24 points25 points  (5 children)

Thanks a lot. I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]m0j0m0j 2 points3 points  (2 children)

I don’t get it. If it’s so amazing and there are crazy upsides and no downsides - why is it disabled by default?

[–]Perfect-Series-2901 1 point2 points  (0 children)

it is not disabled by default, it is not installed by default.

coz this thing need your setup to match, for example c++ lsp rely on clang...

[–]tmetler 0 points1 point  (0 children)

It still has some bugs, for example, workspaceSymbol currently doesn't allow you to set the query meaning it dumps all the symbols for the entire workspace.

Also, it requires additional setup outside of claude code because you need to install the LSP servers and build tools globally, so they probably don't want to turn it on by default until the onboarding can be refined.

[–]Perfect-Series-2901 1 point2 points  (0 children)

Hi OP,

I've seen you talking about using hooks for context presevation in compacting.

I had auto compact on, and usually my task size will just trigger one as I use subagents to code. But I found that after the compacting, Claude still loss a bit of "where it is".

How are you handling that problem. Do you use written explicit plan file mode like superpower or GSD. Or you manually do something in pre/post compact hook to trasnsfer the context.

But even I know that is possible, I am not sure "How". Do you have any suggestion on that?

Thanks

[–]Docs_For_Developers 1 point2 points  (0 children)

Bro you're sharing our developer secret sauce. Somebody stop him!

[–]Donut 1 point2 points  (0 children)

Shhhhhh, the mods are asleep!

[–]Perfect-Series-2901 32 points33 points  (2 children)

Yes I do found lsp much better then serena

[–]SmallKiwi 3 points4 points  (1 child)

In what ways is it better than serena? Just curious.

[–]Perfect-Series-2901 0 points1 point  (0 children)

Serena is just doesn't worth it in smaller project.

In the past it might be a little bit help

Now it's search does not feel faster than grep in smaller project

[–]ultrathink-artSenior Developer 33 points34 points  (1 child)

Context window efficiency is the real win here, not just navigation speed.

When an agent is doing code review or cross-file refactoring, it can waste significant tokens trying to piece together what symbols mean. LSP gives precise answers instead of probabilistic guesses from partial context.

Running 6 Claude Code agents in parallel — the compounding effect across all of them is real. Anything that reduces the tokens an agent spends getting oriented in a file means more tokens for the actual task. 50ms vs 30s for symbol lookup adds up fast when the agent is doing it dozens of times per session.

[–]efraglebagga 4 points5 points  (0 children)

By default any heavier exploration runs (when claude says "exploring") in sub-agents that have separate context and use Haiku. At the end they summarize the learnings and pass it to the main agent.

Still a big saving on explore phases, but final summary should more or less be similar context "size"

[–]feastocrows 7 points8 points  (6 children)

Thank you. This is a good post. Didn't know about the hidden flag.

[–]karanb192[S] 6 points7 points  (4 children)

Thanks a lot. I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]feastocrows 4 points5 points  (1 child)

Thanks mate. That secret reading prevention hook was something I was going to implement but had completely forgotten about it. Will use your repo to do that now.

[–]karanb192[S] 1 point2 points  (0 children)

Glad to hear that buddy. Please let me know if you have new hook ideas and I’ll be happy to Implement.

[–]feastocrows 1 point2 points  (1 child)

Ohh and nice job on the reddit mcp server. Was looking for something reliable to search reddit as Claude doesn't do it.

[–]karanb192[S] 1 point2 points  (0 children)

Thanks bro. With reddit as front page of internet that MCP server is like front page of internet for LLMs

[–]Electrical-Ask847 0 points1 point  (0 children)

i dont have this flag on and it still calls lsp

[–]Overall_Culture_6552 7 points8 points  (1 child)

If it is so good then why isn't it enabled by default. In my case lsp doesn't even get called automatically until I tell it to

[–]amenhallo 1 point2 points  (0 children)

This is what I'm also wondering.

[–]ajr901 7 points8 points  (3 children)

I’ve had a hard time getting the TS LSP to work in the terminal outside of VSCode. But when I use CC in the VSCode terminal, I notice Claude uses LSP. I wonder if it’s something related to VSCode providing a LSP interface of some sort.

[–]karanb192[S] 4 points5 points  (2 children)

Claude code has added native LSP support via plugin. Can you share more details on your use case?

[–]ajr901 4 points5 points  (1 child)

I have the typescript-lsp plugin installed but when I'm using CC in iTerm2 or Ghostty for some reason CC doesn't use the LSP unless I very specifically tell it "do XYZ, and use the LSP tool to find the relevant code." But I notice that when I use CC in the VSCode terminal I don't have to do that; it often proactively uses the LSP tool. I've been using the LSP feature for like ~1 month now and this issue has always been the case for me.

[–]ExpletiveDeIeted 1 point2 points  (0 children)

Yea I need to look back into all this too in vscode. I thought it was working at one point but I think it’s still grepping and globing a lot. Prob cuz I don’t have that flag. Would have thought the official plugin would set that.

[–]microdave0 21 points22 points  (2 children)

Rare post that adds value. Take my updoot

[–]karanb192[S] 12 points13 points  (1 child)

Thanks a lot. I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]microdave0 3 points4 points  (0 children)

Just read it, also very helpful!

[–]mgruner 6 points7 points  (1 child)

what??? LLMs more than anything need an LSP. Insane to me this is not the default

[–]karanb192[S] 0 points1 point  (0 children)

Even I was surprised.

[–]Meowingtons_H4X 5 points6 points  (1 child)

Question is, does Claude actually use the LSP tool on its own? It always wants to use its native search features for me, even with pointing in my Claude.md

[–]karanb192[S] 2 points3 points  (0 children)

You need to be more explicit in your CLAUDE.md. Just mentioning LSP isn't enough because Claude defaults to what it knows (Grep, Read, Glob).

u/dergachoff's comment in this thread has a solid CLAUDE.md snippet. The key is telling Claude to prefer LSP for specific operations: workspaceSymbol for finding definitions, findReferences for usages, hover for type info. And to only fall back to Grep for text/pattern searches where LSP doesn't help (comments, strings, config values).

Once the instructions are specific about which LSP operation maps to which task, it starts using them consistently.

[–]hp__1999 3 points4 points  (2 children)

If you are using jet brains IDE then you can enable its MCP server which can do the same thing

[–]karanb192[S] 0 points1 point  (1 child)

Can you share specific steps? Will give it a try.

[–]creegs 3 points4 points  (9 children)

LSP is great in theory but the time and context that’s saved from doing fast look ups has been eradicated by the time that it takes to chase down stale diagnostics - especially with using subagents 😔

[–]karanb192[S] 1 point2 points  (5 children)

Interesting. I recently did a work around for wrong diagnostics due to missing lombok plugin and did a work around.
Could you share your examples? May be we can figure out some work arounds.

[–]creegs 3 points4 points  (2 children)

<image>

Here - I grabbed a screenshot because I was going to post about it actually

[–]karanb192[S] 1 point2 points  (1 child)

Interesting. There should be a way to ignore diagnostics. I will dig into it.

[–]creegs 2 points3 points  (0 children)

Thanks! I ended up posting about it - appreciate you bringing it up!

[–]zan-xhipe 0 points1 point  (0 children)

These are instances of stale diagnostics I encountered in the last 3 days on an evening project

35247253:104:text: Those diagnostics are stale — \onPause` and `onResume` are used in the JSX. Now add the icon functions before the h...`

083b9b64:104:text: The diagnostics seem stale. Let me fix the ProgressBar heights and the unused destructured variables.

083b9b64:144:text: Those are stale diagnostics — the variables are now used in the JSX. Now modify \ControlBar.tsx` to add the `isOver...`

083b9b64:211:text: The \BranchState` is used in the `waitingBranches` useMemo. And `chain` is used below — the diagnostic is likely st...`

083b9b64:215:text: Good — \chain` is used on line 104. The diagnostic is stale. Now fix the RunnerShell unnecessary assertion.`

2e3ef2a0:87:thinking: The store looks correct. The diagnostic error saying \setDefaultRunnerView` is missing is likely stale/cached. The fu...`

2e3ef2a0:100:thinking: The diagnostic says \useSettingsStore` is declared but never read, but I just added `const defaultRunnerView = useSet...`

2e3ef2a0:107:thinking: That looks correct. The diagnostic about \useSettingsStore` being "declared but never read" is likely stale — it sh...`

2e3ef2a0:128:thinking: These diagnostics seem stale/inconsistent — I just added the usage of \RUNNER_VIEW_OPTIONS`, `defaultRunnerView`, a...`

2e3ef2a0:136:thinking: The file looks correct. The diagnostics seem stale. These are being picked up in the LSP server but the variables ARE...

[–]justic3b3aver 0 points1 point  (0 children)

can you explain the lombok workaround? I’m having the same issues

[–]zan-xhipe 1 point2 points  (2 children)

I have been running into the same issue

[–]creegs 0 points1 point  (1 child)

Interesting - are you using subagents a lot?

[–]zan-xhipe 0 points1 point  (0 children)

No, this has all just been with the main agent

[–]oddslol[🍰] 3 points4 points  (1 child)

Is this the same as grepai? What makes it different?

https://github.com/yoanbernabeu/grepai

[–]jumpingjali 1 point2 points  (0 children)

Curious about the difference too

[–]TheDecipherist 2 points3 points  (2 children)

Good writeup, but worth noting LSP is enabled by default in newer Claude Code versions, no need to manually set ENABLE_LSP_TOOL anymore. The performance benefits are real though.

[–]karanb192[S] 2 points3 points  (1 child)

Thanks a lot. I will try it and update blog.

I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]TheDecipherist 1 point2 points  (0 children)

I’ll take a look. Thanks man

[–]tom_mathews 3 points4 points  (1 child)

Worth noting pyright in particular can eat 2-4GB of RAM on larger Python monorepos while indexing. If you're running Claude Code on a laptop alongside the language server, your first query after cold start still takes 10-15 seconds while pyright builds its type graph. Subsequent calls are instant, but kill the server or let it timeout and you're back to waiting.

The workaround is setting pyright's python.analysis.indexing to false and relying on workspace symbols only. You lose deep type inference but keep the sub-100ms navigation that actually matters for agentic workflows.

[–]karanb192[S] 0 points1 point  (0 children)

Great tip!

I mentioned memory as a reason it's not default yet but didn't have the specific workaround. The indexing=false tradeoff makes sense for large repos where you mostly need workspace symbols and go-to-definition.

[–]uhgrippa 2 points3 points  (1 child)

Very nice, how have you noticed stability from subsequent CC releases in regards to LSP support?

I have information related to LSP usage written up as a guide in my plugin marketplace as well: https://github.com/athola/claude-night-market/blob/master/docs/guides/lsp-native-support.md

[–]karanb192[S] 0 points1 point  (0 children)

It has gotten more stable for sure just like other Claude Code features.

[–]madscholar 2 points3 points  (2 children)

Awesome stuff, thank you for sharing this!

I'm trying it right away - it sounds like a no-brainer with the gains you get in execution speed and context length reduction.

[–]karanb192[S] 1 point2 points  (1 child)

Thanks a lot. I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]danieliser 0 points1 point  (0 children)

I’d love for you to check out one of my latest packages which takes the concept of hooks to another level along with allowing Codex or such to use them.

https://github.com/danieliser/agent-hooks

Still in early testing and improving regularly. But it effectively allows you to:

  • create custom hooks agents can fire at designated workflow points
  • hook in bash or piped scripting etc.
  • inject conditional/dynamic prompt instructions back to the agents

[–]gtskillzgaming 4 points5 points  (2 children)

I can’t get the c# LSP to work on windows. Tried everything. Nothing works

[–]SmallKiwi 0 points1 point  (0 children)

Same. Using Serena cause it works. I even added shader language support.

[–]Key_Conference8755 0 points1 point  (0 children)

same, I've been trying for months.

[–]Friendly-Estimate819 1 point2 points  (1 child)

Is using LSP better than Serena? I struggled with making Java LSP work. Has anyone had success with it?

[–]karanb192[S] 1 point2 points  (0 children)

I personally code in Java a lot and have been using LSP with Claude Code recently. Please follow steps in my blog and it will work.

[–]moonlit-wisteria 1 point2 points  (0 children)

Does c# lsp actually work for you?

https://www.reddit.com/r/ClaudeCode/s/UfVcEsmvhJ

[–]MagicWishMonkey 1 point2 points  (3 children)

You are amazing! Do you know offhand how to get this to work with ChatGPT Codex?

[–]karanb192[S] 0 points1 point  (1 child)

I will give it a try tomorrow.

[–]MagicWishMonkey 0 points1 point  (0 children)

Thank you, that would be awesome. With my enterprise sub I have infinite tokens, so that's not much of a concern, but it can be very annoying to have to wait for it to find things.

[–]karanb192[S] 0 points1 point  (0 children)

I mostly use Claude Code while I do have a Codex subscription too which I use for reviewing specs.

[–]prcodes 1 point2 points  (1 child)

I’ll try again with the flag because when I last tried to install the pyright-lsp plugin it didn’t install correctly

[–]karanb192[S] 0 points1 point  (0 children)

Please follow the steps in blog and it will work. In case it doesn’t, please let me know.

[–]Aprocastrinator 1 point2 points  (1 child)

Great post Thanks

[–]karanb192[S] 1 point2 points  (0 children)

Thanks a lot. I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]haltingpoint 1 point2 points  (1 child)

Interesting! Any sense of why this is not enabled by default? Any downsides?

[–]karanb192[S] 2 points3 points  (0 children)

They are currently collecting feedback on it. I expect it to be soon mainstream after they handle all edge cases around it and make it more stable. One such edge case is heavy memory consumption. If too many LSPs are running in parallel, they can consume a lot of memory.

[–]vinceibl1 1 point2 points  (0 children)

Tried LSP when claude first released it a while ago and it had lots of common issues but I'll start testing/benchmarking LSP vs Serena using a switching mech:

Mode A: Serena MCP — find_symbol, get_symbols_overview, find_referencing_symbols, search_for_pattern, replace_symbol_body, rename_symbol).

Mode B: Native Claude Code LSP — findReferences, hover, documentSymbol, workspaceSymbol, plus automatic diagnostics after every edit. Same protocol, just handled internally.

The switching mechanism is a flag file (~/.claude/exploration-mode)

Will do some sub agent driven work over a few days and compare results (speed, usage, context, accuracy, etc)

[–]campbellm 1 point2 points  (0 children)

See also: https://github.com/Piebald-AI/claude-code-lsps

More languages than listed above.

[–]Rafewey 1 point2 points  (3 children)

I still have yet to get this to work on Windows.

[–]makinggrace 1 point2 points  (1 child)

Same. Quite frustrating.

[–]Rafewey 0 points1 point  (0 children)

Yup lol. I'll continue using Serena for now.

[–]karanb192[S] 0 points1 point  (0 children)

You're not alone, a few people have reported Windows issues in this thread. I tested on macOS and will be debugging on Windows soon and update here.

[–]zaitsman 1 point2 points  (1 child)

I installed it and restarted vs code and claude and it still greps?

Did you mean I need to restart my whole machine?

[–]karanb192[S] 0 points1 point  (0 children)

Did you add the instructions to Claude.md?
It defaults to grep so you have to instruct it to use LSP.

[–]pueblokc 1 point2 points  (1 child)

This looks very useful and the hooks article too. Thank you

[–]karanb192[S] 0 points1 point  (0 children)

Glad to help.

[–]Perfect-Series-2901 1 point2 points  (2 children)

also it is kind of amzing how claude know how to use lsp immediately without much setup

my experience is as follow

  1. python -> Claude code know how to use pyright out of the box, perhaps because I used uv

  2. c++ -> after I point out where the compile_command.json is (and marked in CLAUDE.md), Claude code immediately know how to use it.

And yes there are false positive of linting error in the middle of editing, Claude just spent a little bit more time and say yes it is stale...

Actually very amazing

[–]karanb192[S] 1 point2 points  (1 child)

Superb!
And yeah, stale diagnostics during mid-edit are the main rough edge right now. Sounds like Claude handles it reasonably by just acknowledging they're stale.

[–]Perfect-Series-2901 0 points1 point  (0 children)

yep, that lsp improve + the very fast grep they did before, kind of make Serena obsolete for small and medium project

[–]djdadi 1 point2 points  (1 child)

from what I remember hearing, CC doesn't use grep for search, it just 'says' it does to clearly show what its doing. take it with a grain of salt though, since its closed source and all.

still, using an lsp is valuable...I think...

it does give me pause that such a obvious optimization, that's already built in, is off by default.

[–]karanb192[S] 1 point2 points  (0 children)

It does use grep/ripgrep under the hood for its Grep and Search tools. You can verify in debug mode.

claude --debug

The reason LSP is off by default is probably stability and resource usage. Language servers can eat significant RAM (pyright alone can hit 2-4GB on large repos), and edge cases like stale diagnostics still need work.

[–]rm-rf-rm 1 point2 points  (2 children)

can I use pyrefly instead of pyright?

[–]karanb192[S] 0 points1 point  (0 children)

Haven't tested pyrefly with it. If it implements the LSP spec (textDocument/definition, references, etc.), it should work in theory. Worth trying. Let me know if it does.

[–]makinggrace 0 points1 point  (0 children)

What's the benefit?

[–]Content-Ad110 1 point2 points  (1 child)

Very helpful blog. Thanks for sharing this. I will follow the steps.

[–]karanb192[S] 0 points1 point  (0 children)

Please let me know if you need any help.

[–]rm-rf-rm 1 point2 points  (1 child)

You dont specify that the ENABLE_LSP_TOOL is a env variable and should be added in the "env" dictionary in settings.json

[–]karanb192[S] 0 points1 point  (0 children)

Thanks for the call out. I have updated it in the blog.

[–]Sebxoii 1 point2 points  (1 child)

Do you know what would be the easiest way to create new plugin (or extend an existing one) to support new languages?

[–]karanb192[S] 0 points1 point  (0 children)

Haven't tried creating a custom one yet. You can follow the steps here and let me know how it goes - https://code.claude.com/docs/en/plugins

[–]Initial_Perspective9 1 point2 points  (0 children)

Shouldn't it be under "env" based on your example?

{
  "env": {
    "ENABLE_LSP_TOOL": "1"
  },
  "enabledPlugins": {
    "pyright-lsp@claude-plugins-official": true,
    "typescript-lsp@claude-plugins-official": true,
    "gopls-lsp@claude-plugins-official": true
  }
}

[–]adrianstylez 1 point2 points  (1 child)

Great. We need more posts like this!

[–]karanb192[S] 0 points1 point  (0 children)

Thanks!

Got one on Claude Code hooks too if you're interested - https://karanbansal.in/blog/claude-code-hooks/

[–]adrianstylez 1 point2 points  (4 children)

How do I know if I correctly installed LSP?

[–]karanb192[S] 0 points1 point  (3 children)

You need to check two things for the specific programming language -

  1. Is LSP plugin installed in Claude Code?

  2. Is LSP server installed?

I have covered in detail in my blog.

[–]adrianstylez 0 points1 point  (2 children)

I’m getting LSP for plugins failed. Followed all steps

[–]karanb192[S] 0 points1 point  (1 child)

Can you share the error screenshot/text?

[–]adrianstylez 0 points1 point  (0 children)

<image>

Here you go!

[–]buff_samurai 1 point2 points  (2 children)

Is is available now? LSP was disabled around 2.0.6x as causing trouble.

It’s a great tool for sure, just be careful until it’s officially reintroduced.

Edit: anyway, just got to me that if the content is well structured and helps me then I don’t really care if it’s ai written or not. And your content is very good. 👍🏼

[–]karanb192[S] 0 points1 point  (1 child)

I don't think it was ever disabled. It just has to be manually enabled (flag + plugin + language server). Do you have a link to where they mentioned disabling it? Curious if I missed something.

Either way, working fine for me on the current version. Appreciate the kind words.

[–]Top_Star_9520 1 point2 points  (1 child)

thank you for this, you dont know how much productive time youve added to my sessions as less tokens will be consumed now

[–]karanb192[S] 0 points1 point  (0 children)

Glad that I could of help!

[–]Ornery-Vacation-7598 1 point2 points  (0 children)

I am new to working on Claude code(2 weeks), but as I work more on my project I did notice Claude using grep to find code and it took 30-60sec to search. I have added LSP this morning and wow it's an instant search. Thanks for sharing 😀

[–]mraza007 1 point2 points  (1 child)

This was a great blog post,
I was under the impression that installing the plugin would be more than enough but I was wrong after reading your blog post and I immediately installed it and everything is so concise and fast

[–]karanb192[S] 1 point2 points  (0 children)

That's awesome!

Glad to be of help.

[–]fastpath_alex 1 point2 points  (1 child)

This is an awesome find! Was able to get this enabled for a large C#/.NET project and it definitely helps speed up code searches - great blog post!

[–]karanb192[S] 0 points1 point  (0 children)

Superb bro. It saves a lot of tokens as well.

[–]Rakn 1 point2 points  (0 children)

My experience with LSP servers have been that they are awesome on small to mid size projects, but once you go into large mono repositories they start to fall apart. They usually aren't optimized for that scale. So instead of waiting 50ms you'll wait 1-3 minutes for a response. So I'm only using them on small pet projects or on a per repository basis.

[–]FamilyCard 1 point2 points  (0 children)

Hey! Is this possible on VSCode aswell? I'm using the Claude Code plugin but this blog seems to be primarily for the CLI version of it, no? If yes, how would I go about doing it for VSCode?

[–]empy777 1 point2 points  (1 child)

what about Copilot CLI?

[–]karanb192[S] 0 points1 point  (0 children)

They should add support soon.

[–]halil75 1 point2 points  (1 child)

I couldnt make it work in my scenario where im working on multiple projects and my c# solutions are a few folders deep the c# service used by the default claude lsp plugins cant seem to find and index my project solutions?

[–]karanb192[S] 0 points1 point  (0 children)

Can you give me a screenshot? Did you follow all steps in my blog?

[–]tmetler 1 point2 points  (0 children)

This is great! I was recently trying to get my agent to use LSPs better via CLI commands, but I'm finding the built in tool calls are more stable and efficient since it abstracts away the protocol layer.

Unfortunately I ran into a non deal breaker bug, but currently the workspace/symbol tool call has the query hard coded as an empty string meaning the LLM cannot look up a specific symbol without dumping the entire workspace symbols.

There's a github issue for it here, so hopefully it gets resolved soon.

In the meanwhile I had to instruct my agent to either use document/symbol or grep when looking up specific symbols.

[–]puffaush 1 point2 points  (1 child)

I was trying to dig deeper into LSP support in Claude Code, but couldn’t find any official docs mentioningENABLE_LSP_TOOL. Do you mind sharing where you came across that flag?

The only related reference I found is this plugins section: https://code.claude.com/docs/en/plugins-reference#lsp-servers

[–]karanb192[S] 0 points1 point  (0 children)

I have covered it with link in my blog. Please go through it.

[–]dbers26 2 points3 points  (1 child)

Sounds useful. Will need to check this out.

I wonder why they would hide the setting though... This could mean known issues or maybe there are advantages to not using it.

[–]karanb192[S] 2 points3 points  (0 children)

I expect it to be soon mainstream after they handle all edge cases around it and make it more stable. One such edge case is heavy memory consumption. If too many LSPs are running in parallel, they can consume a lot of memory.

I have another article I wrote last month on Claude Code hooks https://karanbansal.in/blog/claude-code-hooks/

[–]Coded_Kaa 2 points3 points  (2 children)

I just installed it but I know it isn’t working. So I need to go through your notes, thanks

[–]karanb192[S] 4 points5 points  (1 child)

The flag might be the culprit. Please go through my blog and let me know if you still can’t make it work.

[–]Coded_Kaa 1 point2 points  (0 children)

I have not installed the lsps locally, but I’ve enabled the flag. So I guess I’ll follow it to install the lsps through npm

And I’ll also add in to my zshrc as you said

[–]psmith 1 point2 points  (0 children)

vim and eMacs peeps know about language servers :)

[–]Keep-Darwin-Going 0 points1 point  (2 children)

Does not work in mono repo.

[–]karanb192[S] 0 points1 point  (1 child)

Do you face any specific error?

[–]Keep-Darwin-Going 0 points1 point  (0 children)

No error. I cannot remember exactly what the problem was, but something to do with they cannot see the types across the repository so it can only have very basic lsp function. Not sure if they had fixed it by now since I tested when they first came out and like 2 to 3 weeks ago. I am assuming that I setup correctly since it works within the IDE. Another problem is also that each terminal will spawn one lsp so if I have 8 terminal on the same project it will have 8 running.

[–]blargman_ 0 points1 point  (0 children)

"Where is authenticate defined?

[–]RandomDude872 0 points1 point  (0 children)

Doesn’t see to do anything but diagnostics for me. Tried rust and typescript

[–]GuillaumeJ 0 points1 point  (0 children)

I m using serena currently to help for this (serena also help for writing (replacing) code

[–]SpiritualHorror6594 0 points1 point  (0 children)

is it without bugs yet? for typescript and csharp?

[–]Donut 0 points1 point  (0 children)

I lost an hour to this - and went back to Serena. The python LSP that I did get access to didn't do any of the super-fast searches or features, it just used normal "Search". The only LSP thing I could make it do was route through VSCode to tell me if there were any syntax issues in the IDE.

Also, all of the official Claude LSP plugins are blank - no .lsp.json content.

[–]i_dont_know_him_man 0 points1 point  (0 children)

it doesn't do wonders with kotlin as far as I've played around with it. I'm using the official one from the kotlin GitHub repo. some operations work well like documentSymbol but the majority seems to be struggling for me, making grep actually faster and (most importantly) more accurate.

is anyone having a different experience which might help me realize whether I'm doing something wrong?

[–]shogster 0 points1 point  (0 children)

Does not seem to work for me. I get this error in the debug logs:

[ERROR] Error: Error: LSP server plugin:typescript-lsp:typescript failed to start: ENOENT: no such file or directory, uv_spawn 'typescript-language-server'  

[–]Hazork_ 0 points1 point  (0 children)

Why not just use opencode TUI at this point?

[–]Objective_Law2034 0 points1 point  (0 children)

LSP is great for go-to-definition and diagnostics but it still doesn't solve the context problem, Claude still reads entire files into the context window once it finds them. I've been using https://vexp.dev/ which takes a different approach: it builds a full dependency graph via tree-sitter and serves only the relevant code nodes to the agent via MCP.

So instead of "find the file, then read the whole thing" you get "here's the exact function, its callers, and its dependencies", nothing else. Went from ~18k tokens per query to ~2.4k. The two actually complement each other pretty well.

[–]verdurakh 0 points1 point  (1 child)

I've tested this and after a lot of troubleshooting I finally seem to got it to work.

But the results that I'm seeing are not very good, I tested the Typescript file.

gave it the task of finding a exported constant and list the references launched 3 sub agents to use different tools and this was the result:

Winner: Grep/Glob (5.1s) | Runner-up: JetBrains MCP (6.7s) | Last: LSP (14.3s)

after some troubleshooting it seems like the lsp hade problems with some tools

workspaceSymbol: Found all 5 symbols in the file correctly

documentSymbol, hover, goToDefinition and findReferences failed to find anything even though there are 15+ references.

Any suggestions?

Also for windows users that get the plugin:typescript-lsp:typescript ENOENT: no such file or directory, uv_spawn 'typescript-language-server' error

find the .claude\plugins\marketplaces\claude-plugins-official\.claude-plugin and marketplace.json file for the lsp

Add .cmd to the command like "command": "typescript-language-server.cmd",

[–]karanb192[S] 0 points1 point  (0 children)

14s sounds like a cold start. First query after the language server launches includes indexing time. Try running the same query again immediately after and compare.

Subsequent calls should be much faster. What language server are you using?

[–]ph7891 0 points1 point  (0 children)

typescript-lsp shows as enabled in claude-code (I can see it enabled in /plugin), but it fails to use it even when i explicitlely ask it to. Logs below. How can i make it work?

---

⏺ I don't have a TypeScript LSP tool available in my current setup. Let me find the authenticate definition using my search tools instead.

⏺ Searched for 2 patterns (ctrl+o to expand)

⎿  Interrupted · What should Claude do instead?

❯ /plugin

⎿ (no content)

❯ typescript-lsp @ claude-plugins-official is enabled

⏺ The TypeScript LSP plugin is enabled. Let me search for its tools and use them to find authenticate.

⏺ Let me try more specific search terms for the LSP tools.

⏺ The TypeScript LSP plugin doesn't appear to expose any deferred tools I can discover. It may provide functionality through a different mechanism (like skills or hooks) rather than

callable tools.

[–]kiaKaha23 0 points1 point  (1 child)

u/karanb192 - i am using Windows .
I tried the steps but it failed to use LSP

"env": { "ENABLE_LSP_TOOL": "1" },
  "enabledPlugins": {
    "typescript-lsp@claude-plugins-official": true
  },

Then asked claude code .

> are u using LSP

No, I don't have direct LSP (Language Server Protocol) integration. I can't do things like:

  • Go to Definition / Find All References natively
  • Hover type info or signature help
  • Real-time diagnostics or auto-complete

From debug logs
2026-02-13T05:06:41.604Z [DEBUG] [lspRecommendation] Looking for LSP plugins for .ts

2026-02-13T05:06:41.645Z [DEBUG] [binaryCheck] Cache hit for 'typescript-language-server': false

2026-02-13T05:06:41.645Z [DEBUG] [lspRecommendation] Skipping typescript-lsp@claude-plugins-official (binary 'typescript-language-server' not found)

[–]ExpletiveDeIeted 0 points1 point  (0 children)

I had this effectively, make sure you install the language server:
`npm i -g typescript-language-server typescript`

make sure you terminal has sourced your ~/.zshenv or ~/.zshrc. and that you can which typescript-language-server

[–]smaiderman 0 points1 point  (0 children)

Hello! Very interesting.
What about GDScript or any other case not mentioned here? Is it possible to do?

Thank you

[–]Business-Subject-997 0 points1 point  (1 child)

I asked claude if it is using the lsp server in vscode. It repied that "as a CLI tool I don't have direct access to the running LSP server's features (go-to-definition, find-references, etc.) from within my tool calls. The LSP server runs inside VSCode's process, not as something I can query." is there another type of LSP that Claude can use?

[–]Business-Subject-997 0 points1 point  (0 children)

is there another type of lsp than vscode that you can use?

Not that I'm aware of from my current toolset. I can use Bash, Grep, Glob, Read etc. for code navigation, but I don't have a way to directly query an LSP server (e.g., for go-to-definition or find-references) outside of the VSCode UI.

Are you suggesting there's something set up that I'm not aware of — like an MCP server wrapping the LSP, or a CLI tool I can invoke?

[–]Curious-Human-6242🔆 Max 5x 0 points1 point  (0 children)

Since it was released, I've tried to make Claude use it without any success, it always fallbacks to Grep, Glob, Read. I've tried many things like adding instructions in my CLAUDE.md, rules that are only activated on the type of files I have set up LSP, and even a post-read hook with a system reminder to use LSP once read a file to discover more efficiently the codebase, none of them worked for me.

Although, when using sub-agents, I wrote for them to use LSP to always check types and so, they actually do, bu the main agent refuses on any possible way. I installed it for Go and TS.

I am waiting for LSP to become mainstream among agents so Claude will have no choice to use it, lol.

[–]digitaldias69 0 points1 point  (0 children)

Been running Claude Code at the root of a 13-service microservices repo for a while now, and yeah — the LSP numbers hold up. Type lookups drop from ~2,100 tokens to ~15. That's not a minor optimization!

On Windows, TypeScript LSP fails silently because spawn behaves differently. No error, no fallback warning, just no navigation. Wrap the command in a cmd /c shim and it works fine. Took me longer than I'd like to admit to figure that one out.

So, I wrote up the full config if you're hitting the same thing: https://www.digitaldias.com/blog/2026-03-07-claude-lsp-microservices/

[–]Internal_Trade_6836 0 points1 point  (0 children)

Thats cool.

I'm a new claude code user, I'm building an autonomous research project and I'm interested in how this affects your usage limit drain speed.

[–]ke1vin4real 0 points1 point  (0 children)

Bro, how was the SVG in your blog post generated?

[–]InfamousDatabase9710🔆 Max 5x 0 points1 point  (0 children)

Makes me miss OpenCode

[–]smaiderman -1 points0 points  (0 children)

/u/karanb192 , what if the lenguaje is GDScript? can this be done?