anitnilay20 / anitnilay20/thoth

[Future] Tree-sitter: general-purpose code file viewer with syntax highlighting

Open
#153 0 comments 0 reactions 0 assignees View on GitHub
feature future priority:low size:large
Dominant language
Rust
Stars
70
Forks
5
Avg merge
10h 33m
Merged PRs (30d)
2

Description

## Idea

Use [tree-sitter](https://tree-sitter.github.io/) as the foundation for making Thoth a capable viewer for source code files — not just data files. Tree-sitter provides incremental parsing and syntax highlighting for virtually every language via its grammar ecosystem.

## What this unlocks

Opening non-data files in Thoth today shows raw text. With tree-sitter:

- `schema.sql` → SQL syntax highlighting, keyword colouring, folding
- `config.yaml` / `config.toml` → structure-aware highlighting and folding
- `main.rs`, `app.py`, `index.ts` → full language highlighting
- Any language with a tree-sitter grammar works without additional code

## What this is NOT

Context-aware SQL completion in the query editor (issue #149) does **not** need tree-sitter. That uses `sqlparser-rs` (pure Rust, no C) to parse partial SQL and consult `FileQueryEngine::schema()` for completions — a much lighter approach.

Tree-sitter is the right call only if Thoth expands scope to become a general code file viewer across arbitrary languages. That is a separate product decision.

## Considerations before committing

- Tree-sitter is a C library — adds FFI complexity and cross-compilation burden
- Each language grammar is a separate compiled artifact to bundle
- Binary size impact from bundled grammars
- Decide whether Thoth's scope includes code files or remains data-focused

## Parking here

Not prioritised. Revisit if there is clear user demand for code file viewing beyond what the current plain-text fallback provides.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.