All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Understanding the Differences Between Tree-sitter and Language Server Protocol (LSP)

By

ashton314

4mo ago· 6 min readenNews

Summary

This article explains the differences between Tree-sitter and Language Server Protocol (LSP), two important tools in modern code editors. Tree-sitter is a parser generator that creates fast, error-tolerant parsers for programming languages, used for syntax highlighting and basic code analysis. LSP is a protocol that enables communication between code editors and language servers, which provide advanced features like autocomplete, go-to-definition, and refactoring. The article clarifies that Tree-sitter handles parsing while LSP handles communication, and they can work together in modern development environments.

Key quotes

· 5 pulled
Tree-sitter is a parser generator. What this means is that you can hand Tree-sitter a description for a programming language and it will create a program that will parse that language for you.
What's special about Tree-sitter is that it is a.) fast, and b.) can tolerate syntax errors in the input.
A language server is a program that understands a programming language and can answer questions about code written in that language.
The Language Server Protocol (LSP) is a specification for how a code editor can talk to a language server.
Tree-sitter is a parser. LSP is a protocol. They are different things that can work together.
Snippet from the RSS feed
I got asked a good question today: what is the difference between Tree-sitter and a language server? I don’t understand how either of these tools work in depth, so I’m just going to explain from an observable, pragmatic point of view.

You might also wanna read