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

feat: add Gleam lang support #3293

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions aider/queries/tree-sitter-languages/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

# Credits

Aider uses modified versions of the tags.scm files from these open source
Aider uses modified versions of the tags.scm files from these open source
tree-sitter language implementations:

* [https://github.com/tree-sitter/tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c) — licensed under the MIT License.
Expand All @@ -10,6 +9,7 @@ tree-sitter language implementations:
* [https://github.com/Wilfred/tree-sitter-elisp](https://github.com/Wilfred/tree-sitter-elisp) — licensed under the MIT License.
* [https://github.com/elixir-lang/tree-sitter-elixir](https://github.com/elixir-lang/tree-sitter-elixir) — licensed under the Apache License, Version 2.0.
* [https://github.com/elm-tooling/tree-sitter-elm](https://github.com/elm-tooling/tree-sitter-elm) — licensed under the MIT License.
* [https://github.com/gleam-lang/tree-sitter-gleam](https://github.com/gleam-lang/tree-sitter-gleam) — licensed under the Apache License, Version 2.0.
* [https://github.com/tree-sitter/tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) — licensed under the MIT License.
* [https://github.com/tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java) — licensed under the MIT License.
* [https://github.com/tree-sitter/tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) — licensed under the MIT License.
Expand Down
41 changes: 41 additions & 0 deletions aider/queries/tree-sitter-languages/gleam-tags.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
; Modules
(module) @name @reference.module
(import alias: (identifier) @name) @reference.module
(remote_type_identifier
module: (identifier) @name) @reference.module
((field_access
record: (identifier) @name)
(#is-not? local)) @reference.module

; Functions
(function
name: (identifier) @name) @definition.function
(external_function
name: (identifier) @name) @definition.function
(unqualified_import (identifier) @name) @reference.function
((function_call
function: (identifier) @name) @reference.function
(#is-not? local))
((field_access
record: (identifier) @ignore
field: (label) @name)
(#is-not? local)) @reference.function
((binary_expression
operator: "|>"
right: (identifier) @name)
(#is-not? local)) @reference.function

; Types
(type_definition
(type_name
name: (type_identifier) @name)) @definition.type
(type_definition
(data_constructors
(data_constructor
name: (constructor_name) @name))) @definition.constructor
(external_type
(type_name
name: (type_identifier) @name)) @definition.type

(type_identifier) @name @reference.type
(constructor_name) @name @reference.constructor
1 change: 1 addition & 0 deletions aider/website/docs/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cog.out(get_supported_languages_md())
| erlang | .erl | | ✓ |
| go | .go | ✓ | ✓ |
| gomod | .gomod | | ✓ |
| gleam | .gleam | ✓ | ✓ |
| hack | .hack | | ✓ |
| haskell | .hs | | ✓ |
| hcl | .hcl | ✓ | ✓ |
Expand Down
1 change: 1 addition & 0 deletions tests/basic/test_repomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def test_get_repo_map_all_languages(self):
"elm": ("elm", "Person"),
"go": ("go", "Greeter"),
"hcl": ("tf", "aws_vpc"),
"gleam": ("gleam", "greeter"),
}

fixtures_dir = Path(__file__).parent.parent / "fixtures" / "languages"
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/languages/gleam/test.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import gleam/io

pub fn greeter(name) {
io.println("Hello, " <> name <> "!")
}