News for hackers. Stuff that matters.
Re:Mastering Emacs: What's new in Emacs 29.1 by G3rn0ti on Friday September 08, 2023 @03:41AM (#37430692)
Most LSP server implementations I've seen are just parsing the source or even stop at just tokenizing it. They don't do anything magical inside the source language (unless a language exposes parsing/compiler internals e.g. like Raku's language server does). So I don't think most LSP servers leverage anything from inside the source language's compiler including performing type inference on your code snippets. Also note: If your code snippet is complete because you are just about typing it, this also cannot work in principle. That's exactly why treesitter was invented: To have a robust static parser able to process incomplete or erroneous code.

> if the language has type inference, which all modern languages do

Well, only if your "modern" language is a statically typed language ... And again: Unless your code is correct and complete, you really can not just run "eval" in your source language and obtain type checking out of the box.

Re:Mastering Emacs: What's new in Emacs 29.1 by yakubin on Friday September 08, 2023 @04:23AM (#37430996)
Rust-analyzer provides plenty semantics-level functionality, and it deals with incorrect code gracefully.
Re:Mastering Emacs: What's new in Emacs 29.1 by G3rn0ti on Friday September 08, 2023 @05:05AM (#37431274)
I am not a Rust dev. It surely looks great.

However, from what I understand it seems to supply just a parser separate from the Rust compiler (https://github.com/rust-lang/rust-analyzer/tree/master/crate...) trying to keep up with Rust‘s development. So, in principle, it could have been just another treesitter parser plugin, too.

So, again, the LSP framework does not directly provide any magical benefit over a static parsing framework. All the semantic analysis capabilities stem from a good parser.

Re:Mastering Emacs: What's new in Emacs 29.1 by nequo on Friday September 08, 2023 @10:43AM (#37434142)
One benefit is that you don’t have to write a complex tree sitter mode for every editor. You can write an LSP server once and plug it into every editor.

Rust analyzer also provides compilation errors, lints, and code actions. It would be a lot of unnecessary work to implement and maintain these functionalities five times in five different editors.