Discussion
Loading...

#Tag

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Hacker News
Hacker News
@h4ckernews@mastodon.social  ·  activity timestamp 2 weeks ago

Tree-sitter vs. Language Servers

https://lambdaland.org/posts/2026-01-21_tree-sitter_vs_lsp/

#HackerNews #TreeSitter #LanguageServers #Programming #Tools #Development

Lambda Land

Explainer: Tree-sitter vs. LSP

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.
  • Copy link
  • Flag this post
  • Block
Alan Zimmerman and 1 other boosted
Eugen
Eugen
@ieugen@mas.to  ·  activity timestamp 3 weeks ago

The #emacs #scheme #treesitter mode is now a proper emacs package with install instructions https://git.sr.ht/~dieggsy/scheme-ts-mode #guile

~dieggsy/scheme-ts-mode -

Scheme tree-sitter mode for Emacs -

sourcehut git

  • Copy link
  • Flag this post
  • Block
Eugen
Eugen
@ieugen@mas.to  ·  activity timestamp 3 weeks ago

hmm... a #scheme #treesitter #emacs mode in progress
https://git.sr.ht/~dieggsy/scheme-ts-mode

Should work for #guile

https://github.com/6cdh/tree-sitter-scheme/issues/9#issuecomment-1735486629

~dieggsy/scheme-ts-mode -

Scheme tree-sitter mode for Emacs -

sourcehut git

Eugen
Eugen
@ieugen@mas.to replied  ·  activity timestamp 3 weeks ago

The #emacs #scheme #treesitter mode is now a proper emacs package with install instructions https://git.sr.ht/~dieggsy/scheme-ts-mode #guile

~dieggsy/scheme-ts-mode -

Scheme tree-sitter mode for Emacs -

sourcehut git

  • Copy link
  • Flag this comment
  • Block
algernon e. coyote boosted
Paco Velobs
Paco Velobs
@PacoVelobs@mamot.fr  ·  activity timestamp 3 weeks ago

@algernon
This is called a #TextObject and it's a bliss.

The d deletes, the di deletes Inside and the di( deletes inside the parenthesis.

Use da[ to delete around the square brackets.
Or ci{ to change inside the curly braces.

One I use a lot is dap to delete the whole paragraph.

And it gets better with extra text objects based on #TreeSitter.

  • Copy link
  • Flag this post
  • Block
algernon e. coyote
algernon e. coyote
@algernon@come-from.mad-scientist.club  ·  activity timestamp 3 weeks ago

TIL di( is a thing, and it is really useful. The whole di thing is great.

#DoomEmacs #vim

Paco Velobs
Paco Velobs
@PacoVelobs@mamot.fr replied  ·  activity timestamp 3 weeks ago

@algernon
This is called a #TextObject and it's a bliss.

The d deletes, the di deletes Inside and the di( deletes inside the parenthesis.

Use da[ to delete around the square brackets.
Or ci{ to change inside the curly braces.

One I use a lot is dap to delete the whole paragraph.

And it gets better with extra text objects based on #TreeSitter.

  • Copy link
  • Flag this comment
  • Block
Eugen
Eugen
@ieugen@mas.to  ·  activity timestamp 3 weeks ago

hmm... a #scheme #treesitter #emacs mode in progress
https://git.sr.ht/~dieggsy/scheme-ts-mode

Should work for #guile

https://github.com/6cdh/tree-sitter-scheme/issues/9#issuecomment-1735486629

~dieggsy/scheme-ts-mode -

Scheme tree-sitter mode for Emacs -

sourcehut git

  • Copy link
  • Flag this post
  • Block
Alan Zimmerman boosted
vindarel
vindarel
@vindarel@framapiaf.org  ·  activity timestamp last month

Lem news: #treesitter support for JSON, YAML, Markdown, Nix, WAT.

https://lem-project.github.io/development/tree-sitter/

with AI in the loop.

#lisp #commonlisp

Lem

Tree-sitter Integration

Lem integrates tree-sitter for advanced syntax highlighting and indentation. Tree-sitter provides incremental parsing that can efficiently update syntax trees as you edit, enabling features that understand code structure rather than just patterns. Overview The tree-sitter integration in Lem provides: Syntax Highlighting: Accurate, language-aware highlighting based on AST nodes Indentation: Structure-based indentation using tree-sitter queries Incremental Parsing: Efficient updates without re-parsing entire files Graceful Fallback: Falls back to regex-based highlighting when tree-sitter is unavailable Architecture ┌─────────────────┐ │ tree-sitter-cl │ │ (FFI bindings) │ └────────┬────────┘ │ ┌─────────────────┐ ┌────────▼────────┐ │ Language Mode │──────────▶│ lem-tree-sitter │ │ (json, nix.
  • Copy link
  • Flag this post
  • Block
vindarel
vindarel
@vindarel@framapiaf.org  ·  activity timestamp last month

Lem news: #treesitter support for JSON, YAML, Markdown, Nix, WAT.

https://lem-project.github.io/development/tree-sitter/

with AI in the loop.

#lisp #commonlisp

Lem

Tree-sitter Integration

Lem integrates tree-sitter for advanced syntax highlighting and indentation. Tree-sitter provides incremental parsing that can efficiently update syntax trees as you edit, enabling features that understand code structure rather than just patterns. Overview The tree-sitter integration in Lem provides: Syntax Highlighting: Accurate, language-aware highlighting based on AST nodes Indentation: Structure-based indentation using tree-sitter queries Incremental Parsing: Efficient updates without re-parsing entire files Graceful Fallback: Falls back to regex-based highlighting when tree-sitter is unavailable Architecture ┌─────────────────┐ │ tree-sitter-cl │ │ (FFI bindings) │ └────────┬────────┘ │ ┌─────────────────┐ ┌────────▼────────┐ │ Language Mode │──────────▶│ lem-tree-sitter │ │ (json, nix.
  • Copy link
  • Flag this post
  • Block
Alan Zimmerman boosted
Bricked
Bricked
@bricked@tilde.zone  ·  activity timestamp 2 months ago

TIL that in Nix, if you have a multi-line string of code, you can simply prefix it with a comment stating the name of the language and Tree-sitter will highlight it for you!

{
# The TOML string below will be highlighted!
programs.foo.extraConfig = /* toml */ ''
bar = "baz"
'';
}

#nix #nixos #treesitter

  • Copy link
  • Flag this post
  • Block
Bricked
Bricked
@bricked@tilde.zone  ·  activity timestamp 2 months ago

TIL that in Nix, if you have a multi-line string of code, you can simply prefix it with a comment stating the name of the language and Tree-sitter will highlight it for you!

{
# The TOML string below will be highlighted!
programs.foo.extraConfig = /* toml */ ''
bar = "baz"
'';
}

#nix #nixos #treesitter

  • Copy link
  • Flag this post
  • Block
Alan Zimmerman boosted
snamellit
snamellit
@snamellit@social.snamellit.com  ·  activity timestamp 7 months ago

Recently with verion 0.25 the treesitter library changed ABI version
to 15. Newer parsers will complain about a version mismatch if the
installed library used by emacs is lower than this version. This ABI
version was introduced in the 0.25 branch of treesitter.

The best course of action till lib treesitter is updated is to pin
the version of the parser to the last version supporting ABI 14.

With the new ABI 15 version, parsers are required to provide a
treesitter.json file with additional metadata which can be used as
proxy to find a version which still supports ABI-14, i.e. the commit
before that.

A lot of the parsers are provided by the treesitter project as sub
repos, and they follow the same version convention as the library,
selecting the last tag before the 0.25 tag is a good way to find a
compatible version.

This branch can be added after the repo url in the
treesit-language-source-alist variable. Note that if you use
treesit-auto-install-all to get it over with, you have to probably
restart your emacs as treesit-auto apparently caches the value
during iniitialisation and changes are not picked up. #emacs#treesitter

  • Copy link
  • Flag this post
  • Block
snamellit
snamellit
@snamellit@social.snamellit.com  ·  activity timestamp 7 months ago

Recently with verion 0.25 the treesitter library changed ABI version
to 15. Newer parsers will complain about a version mismatch if the
installed library used by emacs is lower than this version. This ABI
version was introduced in the 0.25 branch of treesitter.

The best course of action till lib treesitter is updated is to pin
the version of the parser to the last version supporting ABI 14.

With the new ABI 15 version, parsers are required to provide a
treesitter.json file with additional metadata which can be used as
proxy to find a version which still supports ABI-14, i.e. the commit
before that.

A lot of the parsers are provided by the treesitter project as sub
repos, and they follow the same version convention as the library,
selecting the last tag before the 0.25 tag is a good way to find a
compatible version.

This branch can be added after the repo url in the
treesit-language-source-alist variable. Note that if you use
treesit-auto-install-all to get it over with, you have to probably
restart your emacs as treesit-auto apparently caches the value
during iniitialisation and changes are not picked up. #emacs#treesitter

  • Copy link
  • Flag this post
  • Block
Programming Languages Delft
Programming Languages Delft
@DelftPL@akademienl.social  ·  activity timestamp 12 months ago

Master thesis by Hendy Liang: "Property-Based ASTs: Enabling Language Parametricity in Refactoring Tools"

"By leveraging Tree-Sitter, a parser generator that creates parsers that produce generic, property-based ASTs, this research adapts Renaissance, an existing industrial refactoring tool, to support multi-language extensibility with minimal additional effort."

https://repository.tudelft.nl/record/uuid:6e143a35-32b8-4f7e-928e-52057ea57566

#LanguageParametricity #refactoring #treesitter #thesis

Property-Based ASTs | TU Delft Repository

  • Copy link
  • Flag this post
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.7 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct