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 LSP for groovy #4303

Closed
wants to merge 4 commits into from
Closed
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
21 changes: 21 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ indent = { tab-width = 4, unit = " " }
name = "julia"
source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "fc60b7cce87da7a1b7f8cb0f9371c3dc8b684500" }


[[language]]
name = "java"
scope = "source.java"
Expand Down Expand Up @@ -1835,3 +1836,23 @@ roots = []
[[grammar]]
name = "wast"
source = { git = "https://github.com/wasm-lsp/tree-sitter-wasm", rev = "2ca28a9f9d709847bf7a3de0942a84e912f59088", subpath = "wast" }


[[language]]
name = "groovy"
scope = "source.groovy"
injection-regex = "groovy"
file-types = ["groovy", "gvy", "gy", "gsh"]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
language-server = { command = "java", args = ["-jar", "/Users/zephaniahong/Desktop/groovy-language-server/build/libs/groovy-language-server-all.jar"]}
Copy link
Member

Choose a reason for hiding this comment

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

This is hard coded to your setup and shouldn't be upstreamed in this way

Copy link
Author

Choose a reason for hiding this comment

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

Yup! I'm just testing things out to get a better understanding. But the main issue is that, I can't get the syntax highlighting to work

roots = []

[[grammar]]
name = "groovy"
source = { git = "https://github.com/tree-sitter/tree-sitter-java", rev = "bd6186c24d5eb13b4623efac9d944dcc095c0dad" }

Comment on lines +1851 to +1854
Copy link
Member

Choose a reason for hiding this comment

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

You either need to use grammar = "java" in the [[language]] block or use a tree-sitter-groovy parser - this will fail to load because we're expecting the parsing to expose symbols under the name tree_sitter_groovy but this parser uses tree_sitter_java:

let language_fn_name = format!("tree_sitter_{}", name.replace('-', "_"));

Copy link
Member

Choose a reason for hiding this comment

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

We could probably raise this log level so it shows up in the log by default, as long as this doesn't start showing up in test output:

.map_err(|e| log::info!("{}", e))

Copy link
Author

Choose a reason for hiding this comment

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

I see! I think I understand now(: Thanks!
Also, what do you mean by 'as long as this doesn't start showing up in test output'? Would changing it to log::warning!("{}", e) solve what you're saying?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the test suite, it isn't actually a problem. The integration tests will print log lines but there isn't an integration test where this returns Error

#4315

# [[grammar]]
# name = "groovy"
# source = { git = "https://github.com/codieboomboom/tree-sitter-groovy", rev = "de8e0c727a0de8cbc6f4e4884cba2d4e7c740570" }

1 change: 1 addition & 0 deletions runtime/queries/groovy/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: java
1 change: 1 addition & 0 deletions runtime/queries/groovy/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: java