Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ tree-sitter-css = "0.25"
tree-sitter-dart = "0.2.0"
tree-sitter-elixir = "0.3"
tree-sitter-erlang = "0.20"
tree-sitter-gdscript = "6.1"
tree-sitter-gdshader = "0.4"
tree-sitter-go = "0.25"
tree-sitter-godot-resource = "0.7"
tree-sitter-haskell = "0.23"
tree-sitter-html = "0.23"
tree-sitter-java = "0.23"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ See the [Installation Guide](docs/installation.md) for more options and troubles

🎬 **Commit Replay as Animation** — Realistic typing, cursor movement, deletions, and file operations
🔍 **Working Tree Diff View** — Visualize staged/unstaged changes before committing
🎨 **Tree-sitter Syntax Highlighting** — 29 languages supported
🎨 **Tree-sitter Syntax Highlighting** — 32 languages supported
🌳 **Project File Tree** — Directory structure with change statistics
🖥️ **Screensaver Mode** — Endless random commit playback
🎭 **Themes** — 9 built-in themes + full customization support
Expand Down Expand Up @@ -189,7 +189,7 @@ See the [Configuration Guide](docs/configuration.md) for full options and exampl

## Supported Languages

Astro, Bash, C, C#, C++, Clojure, CSS, Dart, Elixir, Erlang, Go, Haskell, HTML, Java, JavaScript, JSON, Kotlin, Lua, Markdown, Nix, PHP, Python, Ruby, Rust, Scala, Svelte, Swift, TypeScript, XML, YAML, Zig
Astro, Bash, C, C#, C++, Clojure, CSS, Dart, Elixir, Erlang, Go, Godot (GDScript / Shader / Resource), Haskell, HTML, Java, JavaScript, JSON, Kotlin, Lua, Markdown, Nix, PHP, Python, Ruby, Rust, Scala, Svelte, Swift, TypeScript, XML, YAML, Zig

## Documentation

Expand Down
10 changes: 6 additions & 4 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@ The engine uses carefully tuned timing multipliers to create realistic animation

**Responsibility**: Provide syntax highlighting for code using tree-sitter.

**Supported Languages** (26 total):
**Supported Languages** (32 total):
- Systems: Rust, C, C++, Zig
- Web: TypeScript, JavaScript, HTML, CSS
- Backend: Python, Go, Ruby, PHP, Java, C#, Kotlin, Swift
- Web: TypeScript, JavaScript, HTML, CSS, Astro, Svelte
- Backend: Python, Go, Ruby, PHP, Java, C#, Kotlin, Swift, Dart
- Functional: Haskell, Scala, Clojure, Elixir, Erlang
- Data: JSON, YAML, XML, Markdown, Dart
- Scripting/Config: Bash, Lua, Nix
- Game: Godot (GDScript / Shader / Resource)
- Data: JSON, YAML, XML, Markdown

**Architecture**:
- Language detection by file extension
Expand Down
10 changes: 6 additions & 4 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -872,13 +872,15 @@ scrot ~/Pictures/rice-$(date +%Y%m%d-%H%M%S).png

## Supported Languages

gitlogue provides syntax highlighting for 26 programming languages:
gitlogue provides syntax highlighting for 32 programming languages:

- **Systems**: Rust, C, C++, Zig
- **Web**: TypeScript, JavaScript, HTML, CSS
- **Backend**: Python, Go, Ruby, PHP, Java, C#, Kotlin, Swift
- **Web**: TypeScript, JavaScript, HTML, CSS, Astro, Svelte
- **Backend**: Python, Go, Ruby, PHP, Java, C#, Kotlin, Swift, Dart
- **Functional**: Haskell, Scala, Clojure, Elixir, Erlang
- **Markup/Data**: Markdown, JSON, YAML, XML, Dart
- **Scripting/Config**: Bash, Lua, Nix
- **Game**: Godot (GDScript / Shader / Resource)
- **Markup/Data**: Markdown, JSON, YAML, XML

The appropriate highlighter is automatically selected based on file extensions.

Expand Down
5 changes: 5 additions & 0 deletions src/syntax/languages/gdscript.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub fn language() -> tree_sitter::Language {
tree_sitter_gdscript::LANGUAGE.into()
}

pub const HIGHLIGHT_QUERY: &str = include_str!("queries/gdscript_highlights.scm");
5 changes: 5 additions & 0 deletions src/syntax/languages/gdshader.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub fn language() -> tree_sitter::Language {
tree_sitter_gdshader::LANGUAGE.into()
}

pub const HIGHLIGHT_QUERY: &str = tree_sitter_gdshader::HIGHLIGHTS_QUERY;
5 changes: 5 additions & 0 deletions src/syntax/languages/godot_resource.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub fn language() -> tree_sitter::Language {
tree_sitter_godot_resource::LANGUAGE.into()
}

pub const HIGHLIGHT_QUERY: &str = include_str!("queries/godot_resource_highlights.scm");
42 changes: 40 additions & 2 deletions src/syntax/languages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ pub mod css;
pub mod dart;
pub mod elixir;
pub mod erlang;
pub mod gdscript;
pub mod gdshader;
pub mod go_lang;
pub mod godot_resource;
pub mod haskell;
pub mod html;
pub mod java;
Expand Down Expand Up @@ -52,7 +55,10 @@ enum LanguageKind {
Dart,
Elixir,
Erlang,
Gdscript,
Gdshader,
Go,
GodotResource,
Haskell,
Html,
Java,
Expand Down Expand Up @@ -137,11 +143,26 @@ fn by_name(raw: &str) -> Option<LanguageSupport> {
highlight_query: erlang::HIGHLIGHT_QUERY,
injection_query: None,
},
LanguageKind::Gdscript => LanguageSupport {
language: gdscript::language(),
highlight_query: gdscript::HIGHLIGHT_QUERY,
injection_query: None,
},
LanguageKind::Gdshader => LanguageSupport {
language: gdshader::language(),
highlight_query: gdshader::HIGHLIGHT_QUERY,
injection_query: None,
},
LanguageKind::Go => LanguageSupport {
language: go_lang::language(),
highlight_query: go_lang::HIGHLIGHT_QUERY,
injection_query: None,
},
LanguageKind::GodotResource => LanguageSupport {
language: godot_resource::language(),
highlight_query: godot_resource::HIGHLIGHT_QUERY,
injection_query: None,
},
LanguageKind::Haskell => LanguageSupport {
language: haskell::language(),
highlight_query: haskell::HIGHLIGHT_QUERY,
Expand Down Expand Up @@ -265,7 +286,10 @@ fn resolve_language_kind(raw: &str) -> Option<LanguageKind> {
"dart" => Some(LanguageKind::Dart),
"ex" | "exs" | "elixir" => Some(LanguageKind::Elixir),
"erl" | "hrl" | "es" | "escript" | "erlang" => Some(LanguageKind::Erlang),
"gd" | "gdscript" => Some(LanguageKind::Gdscript),
"gdshader" | "gdshaderinc" => Some(LanguageKind::Gdshader),
"go" | "golang" => Some(LanguageKind::Go),
"tscn" | "tres" | "godot" | "godot-resource" => Some(LanguageKind::GodotResource),
"hs" | "lhs" | "haskell" => Some(LanguageKind::Haskell),
"html" | "htm" => Some(LanguageKind::Html),
"java" => Some(LanguageKind::Java),
Expand Down Expand Up @@ -304,7 +328,10 @@ impl LanguageKind {
LanguageKind::Dart => "dart",
LanguageKind::Elixir => "elixir",
LanguageKind::Erlang => "erlang",
LanguageKind::Gdscript => "gdscript",
LanguageKind::Gdshader => "gdshader",
LanguageKind::Go => "go",
LanguageKind::GodotResource => "godot-resource",
LanguageKind::Haskell => "haskell",
LanguageKind::Html => "html",
LanguageKind::Java => "java",
Expand Down Expand Up @@ -334,7 +361,7 @@ mod tests {
use super::*;
use tree_sitter::Parser;

const SUPPORTED_LANGUAGES: [(&str, bool); 31] = [
const SUPPORTED_LANGUAGES: [(&str, bool); 34] = [
("astro", true),
("bash", false),
("c", false),
Expand All @@ -345,7 +372,10 @@ mod tests {
("dart", false),
("elixir", false),
("erlang", false),
("gdscript", false),
("gdshader", false),
("go", false),
("godot-resource", false),
("haskell", false),
("html", true),
("java", false),
Expand All @@ -368,7 +398,7 @@ mod tests {
("zig", false),
];

const CANONICAL_ALIASES: [(&str, &str); 31] = [
const CANONICAL_ALIASES: [(&str, &str); 34] = [
("astro", "astro"),
("shell", "bash"),
("h", "c"),
Expand All @@ -379,7 +409,10 @@ mod tests {
("dart", "dart"),
("exs", "elixir"),
("escript", "erlang"),
("gd", "gdscript"),
("gdshaderinc", "gdshader"),
("golang", "go"),
("tscn", "godot-resource"),
("lhs", "haskell"),
("htm", "html"),
("java", "java"),
Expand Down Expand Up @@ -452,6 +485,11 @@ mod tests {
("styles/site.scss", "css"),
("components/App.tsx", "typescript"),
("templates/index.phtml", "php"),
("scripts/player.gd", "gdscript"),
("shaders/water.gdshaderinc", "gdshader"),
("scenes/main.tscn", "godot-resource"),
("resources/player.tres", "godot-resource"),
("game/project.godot", "godot-resource"),
("docs/guide.md", "markdown"),
]
.iter()
Expand Down
123 changes: 123 additions & 0 deletions src/syntax/languages/queries/gdscript_highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
; Comments and literals
(comment) @comment
(string) @string
(string_name) @string
(node_path) @string
(escape_sequence) @string.escape
(integer) @number
(float) @number
[
(true)
(false)
(null)
] @constant

; Types and declarations
(type) @type
(class_name_statement (name) @type)
(class_definition (name) @type)
(enum_definition (name) @type)
(enumerator (identifier) @constant)
(variable_statement (identifier) @variable)
(const_statement (name) @constant)
(signal_statement (name) @label)

; Functions, methods, and members
(function_definition
name: (name) @function)
(constructor_definition "_init" @function)
(lambda (name) @function)
(parameters
[
(identifier) @parameter
(typed_parameter (identifier) @parameter)
(default_parameter (identifier) @parameter)
(typed_default_parameter (identifier) @parameter)
(variadic_parameter (identifier) @parameter)
(variadic_parameter (typed_parameter (identifier) @parameter))
(variadic_parameter (default_parameter (identifier) @parameter))
(variadic_parameter (typed_default_parameter (identifier) @parameter))
])
(call (identifier) @function)
(attribute_call (identifier) @function)
(base_call (identifier) @function)
(attribute
(identifier)
(identifier) @property)

; Annotations and keywords
(annotation (identifier) @keyword)
[
"if"
"else"
"elif"
"match"
"when"
"while"
"for"
"return"
"pass"
"break"
"continue"
"func"
"export"
"in"
"is"
"as"
"and"
"or"
"not"
"var"
"class"
"class_name"
"enum"
"const"
"signal"
"setget"
"onready"
"extends"
"set"
"get"
"await"
(remote_keyword)
(static_keyword)
] @keyword

; Operators and punctuation
[
"+"
"-"
"*"
"/"
"%"
"=="
"!="
">"
"<"
">="
"<="
"="
"+="
"-="
"*="
"/="
"%="
"&"
"|"
"^"
"~"
"<<"
">>"
":="
":"
] @operator
[
"("
")"
"["
"]"
"{"
"}"
","
"."
] @punctuation
Loading
Loading