Skip to content

Commit

Permalink
add support for Kotlin language (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
johan12345 authored Dec 15, 2023
1 parent 6c4e0e4 commit b1d0eb4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
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 crates/llm-ls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ tree-sitter-html = "0.19"
tree-sitter-java = "0.20"
tree-sitter-javascript = "0.20"
tree-sitter-json = "0.20"
tree-sitter-kotlin = "0.3.1"
tree-sitter-lua = "0.0.19"
tree-sitter-md = "0.1"
tree-sitter-objc = "3"
Expand Down
7 changes: 7 additions & 0 deletions crates/llm-ls/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ fn get_parser(language_id: LanguageId) -> Result<Parser> {
.map_err(internal_error)?;
Ok(parser)
}
LanguageId::Kotlin => {
let mut parser = Parser::new();
parser
.set_language(tree_sitter_kotlin::language())
.map_err(internal_error)?;
Ok(parser)
}
LanguageId::Lua => {
let mut parser = Parser::new();
parser
Expand Down
3 changes: 3 additions & 0 deletions crates/llm-ls/src/language_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub(crate) enum LanguageId {
JavaScript,
JavaScriptReact,
Json,
Kotlin,
Lua,
Markdown,
ObjectiveC,
Expand Down Expand Up @@ -44,6 +45,7 @@ impl fmt::Display for LanguageId {
Self::JavaScript => write!(f, "javascript"),
Self::JavaScriptReact => write!(f, "javascriptreact"),
Self::Json => write!(f, "json"),
Self::Kotlin => write!(f, "kotlin"),
Self::Lua => write!(f, "lua"),
Self::Markdown => write!(f, "markdown"),
Self::ObjectiveC => write!(f, "objective-c"),
Expand Down Expand Up @@ -84,6 +86,7 @@ impl From<&str> for LanguageId {
"javascript" => Self::JavaScript,
"javascriptreact" => Self::JavaScriptReact,
"json" => Self::Json,
"kotlin" => Self::Kotlin,
"lua" => Self::Lua,
"markdown" => Self::Markdown,
"objective-c" => Self::ObjectiveC,
Expand Down

0 comments on commit b1d0eb4

Please sign in to comment.