Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. San Francisco Onion Futures Company(onionfutures.com ↗)
    24comments
  2. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    342comments
  3. Science Is Open Software(jepedersen.dk ↗)
    16comments
  4. Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step(github.com/awlevin ↗)
    4comments
  5. SDCC – Small Device C Compiler(sourceforge.net ↗)
    9comments
  6. Cloudflare Quick Tunnels(cloudflare.com ↗)
    270comments
  7. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    71comments
  8. Saving another 100TB of RAM(cloudflare.com ↗)
    58comments
  9. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    13comments
  10. How to Write with an LLM(sockpuppet.org ↗)
    305comments
  11. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    discuss
  12. Harm Laundering in GPT Models: Gender Discrimination Transformed Rather Than(arxiv.org ↗)
    discuss
  13. Goroutine Leak Profiles(go.dev ↗)
    1comments
  14. Xcode 27.1 Beta Release Notes(developer.apple.com ↗)
    75comments
  15. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    86comments
  16. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    82comments
  17. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    61comments
  18. OpenJev(openjev.com ↗)
    250comments
  19. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    discuss
  20. The Farnese letter(simonklee.dk ↗)
    6comments
  21. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    12comments
  22. Minimal Phone 2(minimalcompany.com ↗)
    200comments
  23. Claude Code now reads AGENTS.md if there is no Claude.md(claude.com ↗)
    211comments
  24. Show HN: LiveWorld – Every 24/7 YouTube live camera on one globe(liveworld.info ↗)
    32comments
  25. Cyclomatic Complexity in C#(ndepend.com ↗)
    16comments
  26. LispBM is a concurrent Lisp for microcontrollers with message passing(lispbm.com ↗)
    3comments
  27. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    95comments
  28. Alibaba open-sources AI model that can detect cancer and nearly 150 conditions(scmp.com ↗)
    10comments
  29. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    40comments
  30. How SpaceX streamlined the Raptor engine(construction-physics.com ↗)
    63comments

Why building a Rust LSP is hard

29 pointsby 2d agorust-glancer.github.io
13 comments
2h agoHN ↗

Using a JSON TCP connection for what on Windows would be direct function calls (COM) or in Eclipse would be direct function calls between Java modules always felt a bit gross.

1h agoHN ↗

I agree, the only reason LSP exists as it does is for a world running on electron based applications. Plug-ins and application extensions are not new technology and they are nearly universally more efficient in the forms designed and used prior to 2005-ish. I understand why VSCode exists and why it is used so often by developers, but it is certainly a downgrade from more language specific options that could exist.

There are some arguments that do carry water in favor of using a client/server protocol transmitting JSON, in particular, the ability for a nearly complete decoupling of analysis of code and the displaying and editing of that code. Also, LSP was (to my knowledge) the first language/platform/usecase agnostic protocol intended for use in code editors.

I get why this is where a big chunk of developers have ended up, but I do bemoan the lost potential for a language to grab mindshare and popularity on the usability and performance of its tooling and developer experience via-a-vis a custom designed and hyper specific code editor. I mean, Rust and Elm received endless praise for their error messages as a massive boon to developer experience, so it is a facet of language design and implementation that can act as great advertisement. I just hate that the prevalence of LSP at this point precludes custom editors as a first choice in the current zeitgeist.

19m agoHN ↗

It only makes sense in the context of host security and stability, as proven by plugin issues in those IDEs.

However, to come back to your point, there are much better high performance OS IPC mechanisms for inter process communication than sending JSON down through a TCP wire.

As others point out, Electron.

2h agoHN ↗

Enter hell: LSP assumes that it's the source of truth, but you still need to access the filesystem yourself, and do it in a synchronized way

LSP is an example of utterly horrid technical design.

Stop letting Microsoft design protocols and APIs. They are so. bad. at. it.

2h agoHN ↗

I've never looked into LSP, how would you design it?

2h agoHN ↗

Well for one I wouldn't design it so both the LSP and the editor need a synchronized view of the underlying file.

2h agoHN ↗

Start with synchronous function calls instead of JSON. Microsoft knows how to do that - they invented COM and OLE. Function calls enable whatever data sharing is necessary to maintain a coherent view. Imagine trying to do OLE with JSON - just wouldn't work. (Does OLE still exist?)

1h agoHN ↗

Stupid idea.

So the LSP crashes and/or goes into a runaway memory consumption loop. And your main application dies with it.

Or what if you want, you know, to be able to use the same LSP from TWO different applications at the same time?

Never mind issues with other managed runtimes not expecting to deal with something else in their address space.

1h agoHN ↗

Moreover, it's not just stupid, it also does not actually solve _anything_.

A synchronous function can also have obsolete indexing information if it races with the code updates.

57m agoHN ↗

I feel like MS actually learned their lesson with synchronously integrating the language intelligence into the IDE. Old versions of VS would hang or crash based on bugs in the language tooling trying to provide intellisense. You'd restart and it'd work fine till you hit some other weird edge case. Generally this settled to a level of rare-bugginess where you were happy enough with the advantages not to go back to Emacs/VIM, but still annoyed at the occasional restart needed.

In no way does this mean LSP is a perfect solution, but anything synchronous would be a step backwards.

37m agoHN ↗

That doesn't really fix anything. The filesystem is fundamentally a racy shared data structure. If you made the entrypoint API synchronous, any half-way decent editor would shove the LSP queries to the synchronous API into a different thread, because "Do Not Block the UI Thread" is a fundamental principle of good UI programming.

Once you get past that, JSON-over-TCP is just another kind of asynchronous RPC mechanism, one that has the advantage that you can build it in just about any language with out-of-the-box tools. Trying to make a plugin system or a COM or CORBA or OLE based system really cuts out the ability to build language servers in most languages, because you have to be able to build the code in just the right way.

10m agoHN ↗

Actually, COM is inspired by DCE/RPC and the initial versions had some similarities.

Parallel to that, IBM had SOM on OS/2, which was even better allowing for metaclasses and proper class inheritance, it was the key mechanism between Smalltalk and C++ on OS/2, where Smalltalk enjoyed a role similar to .NET on Windows nowadays.

OLE naturally still exists when using Office natively on Windows, other vendors seem to have forgotten about it.

COM's role on Windows has grown since Vista, and the Windows team redid many of the Longhorn ideas originally implemented in .NET into COM/C++, with WinRT being an evolution of COM.

1h agoHN ↗

Stop letting Microsoft design protocols and APIs.

Unfortunately nobody else stepped up to do it.

I'm glad that the code editors out there didn't wait for your theoretical better designed protocol and decided to adopt LSP. Otherwise we'd still have editor that only support one language properly, and the rest is treated like text. If the price to pay is that it sucks for the handful of people who have to work with it, so be it. For every LSP developer that suffers there are tens of thousands of downstream users who benefit from better language support in their favorite editor!