Skip to content
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

Add elixir language support #317

Merged
merged 4 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 10 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 lapce-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tree-sitter-javascript = "0.20.0"
tree-sitter-typescript = "0.20.0"
tree-sitter-python = "0.19.1"
tree-sitter-toml = "0.20.0"
tree-sitter-elixir = { git = "https://github.com/VitorTrin/tree-sitter-elixir.git"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the fork, can you make a PR upstream at https://github.com/VitorTrin/tree-sitter-elixir with your changes?

Also, a version requirement (In this case I think the current release is in the tree-sitter-elixer block couldn't hurt :) Otherwise we may explode the next time main / master gets pushed...

Cheers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

tree-sitter-php = { git = "https://github.com/tree-sitter/tree-sitter-php.git", version = "0.19.1" }
tree-sitter-c = "0.20.1"
tree-sitter-cpp = "0.20.0"
Expand Down
6 changes: 6 additions & 0 deletions lapce-core/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub enum LapceLanguage {
Python,
Toml,
Php,
Elixir,
C,
Cpp,
}
Expand All @@ -61,6 +62,7 @@ impl LapceLanguage {
"py" => LapceLanguage::Python,
"toml" => LapceLanguage::Toml,
"php" => LapceLanguage::Php,
"ex" | "exs" => LapceLanguage::Elixir,
"c" | "h" => LapceLanguage::C,
"cpp" | "cxx" | "cc" | "hpp" | "hxx" => LapceLanguage::Cpp,
_ => return None,
Expand All @@ -78,6 +80,7 @@ impl LapceLanguage {
LapceLanguage::Python => "#",
LapceLanguage::Toml => "#",
LapceLanguage::Php => "//",
LapceLanguage::Elixir => "#",
LapceLanguage::C => "//",
LapceLanguage::Cpp => "//",
}
Expand All @@ -94,6 +97,7 @@ impl LapceLanguage {
LapceLanguage::Python => " ",
LapceLanguage::Toml => " ",
LapceLanguage::Php => " ",
LapceLanguage::Elixir => " ",
LapceLanguage::C => " ",
LapceLanguage::Cpp => " ",
}
Expand All @@ -112,6 +116,7 @@ impl LapceLanguage {
LapceLanguage::Python => tree_sitter_python::language(),
LapceLanguage::Toml => tree_sitter_toml::language(),
LapceLanguage::Php => tree_sitter_php::language(),
LapceLanguage::Elixir => tree_sitter_elixir::language(),
LapceLanguage::C => tree_sitter_c::language(),
LapceLanguage::Cpp => tree_sitter_cpp::language(),
}
Expand All @@ -136,6 +141,7 @@ impl LapceLanguage {
LapceLanguage::Python => tree_sitter_python::HIGHLIGHT_QUERY,
LapceLanguage::Toml => tree_sitter_toml::HIGHLIGHT_QUERY,
LapceLanguage::Php => tree_sitter_php::HIGHLIGHT_QUERY,
LapceLanguage::Elixir => tree_sitter_elixir::HIGHLIGHTS_QUERY,
LapceLanguage::C => tree_sitter_c::HIGHLIGHT_QUERY,
LapceLanguage::Cpp => tree_sitter_cpp::HIGHLIGHT_QUERY,
};
Expand Down