‹ BackHN Continuity

Thread

Why building a Rust LSP is hard

144 points · 77 comments · agluszak

  1. octoberfranklin · · focus · HN ↗
    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.

    1. duttish · · focus · HN ↗
      I've never looked into LSP, how would you design it?
      1. kuschku · · focus · HN ↗
        One of the largest issues of LSP is that each language implementation needs to do everything separately, and that means each language will work differently.

        Imagine if all the editing tools in microsoft word were specific to the language you used, and if you mixed German and English, each had different tooling.

        Now if you mix Rust, HTML, JS, and CSS, they'll all have separate tooling, seperate "go to definition", and separate refactoring. Worst of all, none of them can see the definitions of the other ones.

        So what you'd actually want to do is parse each language into your AST, with proper annotations as to what is what, and have all the "go to definition", the UI rendering, highlighting, refactoring, etc all done generically by the IDE ontop.

        Which is much much closer to how Jetbrains IntelliJ does it, and why their tooling can handle "find usages" on an HTML element to find matching querySelector in .js files and matching selectors in .css

        And if you subscribe to the AI stuff, you'd also want your AI to operate on this AST so it can learn skills that generalize across all languages.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.