Skip to content

Add elixir support #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
11 changes: 11 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tree-sitter = "<0.26.0"
tree-sitter-bash = "<0.24.0"
tree-sitter-c = "<0.25.0"
tree-sitter-css = "<0.25.0"
tree-sitter-elixir = "0.3.4"
tree-sitter-go = "<0.25.0"
tree-sitter-html = "<0.25.0"
tree-sitter-javascript = "<0.25.0"
Expand Down
1 change: 1 addition & 0 deletions crates/codebook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ spellbook.workspace = true
tree-sitter-bash.workspace = true
tree-sitter-c.workspace = true
tree-sitter-css.workspace = true
tree-sitter-elixir.workspace = true
tree-sitter-go.workspace = true
tree-sitter-html.workspace = true
tree-sitter-javascript.workspace = true
Expand Down
9 changes: 9 additions & 0 deletions crates/codebook/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub enum LanguageType {
Bash,
C,
Css,
Elixir,
Go,
HTML,
Javascript,
Expand Down Expand Up @@ -144,6 +145,13 @@ pub static LANGUAGE_SETTINGS: &[LanguageSetting] = &[
query: include_str!("queries/r.scm"),
extensions: &["r", "R"],
},
LanguageSetting {
type_: LanguageType::Elixir,
ids: &["elixir"],
dictionary_ids: &["elixir"],
query: include_str!("queries/elixir.scm"),
extensions: &["ex", "exs"],
},
];

#[derive(Debug)]
Expand Down Expand Up @@ -173,6 +181,7 @@ impl LanguageSetting {
LanguageType::TOML => Some(tree_sitter_toml_ng::LANGUAGE.into()),
LanguageType::Text => None,
LanguageType::Typescript => Some(tree_sitter_typescript::LANGUAGE_TYPESCRIPT.into()),
LanguageType::Elixir => Some(tree_sitter_elixir::LANGUAGE.into()),
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions crates/codebook/src/queries/elixir.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
(string)
(charlist)
] @string
[
(atom)
(quoted_atom)
(keyword)
(quoted_keyword)
] @string.special.symbol
(comment) @comment