Hacker News new | ask | show | jobs
by tsar9x 1598 days ago
> I think this is a much better approach that baking tree sitter into VS Code

they're implementing both, with tree sitter being 'dumb' version of LSP syntax highlighting: https://github.com/microsoft/vscode-anycode

3 comments

Oh thanks for that link, that's really interesting.

Can someone explain the paragraph below -- I thought "this is an invocation of a function named bar" was what we mean by semantic information:

> All features are based on parse trees and there is no semantic information - that means there is no guarantee for correctness. Parse trees allow to identify declarations and usages, like "these lines define a function named foo" or "this is an invocation of a function named bar"

It uses heuristics to derive semantic information from the parse tree without doing a full semantic analysis.
Is "semantic analysis" in the sense you used it similar to "type checking"?
Semantic analysis is a broader term that (for languages with a type checker) includes type checking. https://cs.lmu.edu/~ray/notes/semanticanalysis/
What's "dumb" about Anycode is its semantic features such as "go to definition", code completion, etc., not its syntax highlighting. Alas, Anycode is a separate project.
I was curious about the implementation, and was surprised to find:

- they’re importing query files, with a .scm extension, in TypeScript

- they’re using esbuild to handle those imports

It’s surprising to me that the Microsoft, who created and maintains TypeScript, is using an alternative TypeScript compiler… in part to query semantic information from TypeScript.