Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f3e979b
Initial WIP elixir support
r-tae Sep 3, 2023
74ac7ee
Address comments and format elixir.scm
r-tae Sep 4, 2023
f452edb
Move func def `#match?` predicate for readability
r-tae Sep 4, 2023
2e9ced4
Support maps and map shorthand
r-tae Sep 4, 2023
0502350
Add map tests
r-tae Sep 4, 2023
af5ffb4
Add module support (as "class" scope)
r-tae Sep 4, 2023
9547949
Add more elixir syntax examples in playground
r-tae Sep 4, 2023
fc7d6cc
Fix unfinished comment
r-tae Sep 5, 2023
d5843c4
Keep `end` on its own line for "chuck inside funk"
r-tae Sep 5, 2023
3b8456f
Add negative funk test
r-tae Sep 14, 2023
36ba114
Add elixirls extension dependency
r-tae Sep 14, 2023
437e803
Merge branch 'main' into elixir-support
r-tae Sep 14, 2023
8b74b41
Add defguard query
r-tae Sep 14, 2023
c7fc534
Merge branch 'main' into elixir-support
r-tae Sep 14, 2023
d965ad9
Remove unwanted .gitignore inclusions
r-tae Sep 15, 2023
89955dd
Delete unecessary previous comment test
r-tae Sep 15, 2023
e8f8c11
Make defmodule namedFunction iteration scope
r-tae Sep 15, 2023
5a1d1ab
Add @textFragment to string and comment
r-tae Sep 15, 2023
52fc129
Add comment explaining elixir-ls dependency
r-tae Sep 15, 2023
b5bb32f
Merge branch 'main' into elixir-support
r-tae Sep 15, 2023
9f7ad92
Merge branch 'main' into pr/r-tae/1844
pokey Jan 23, 2024
470a072
Cleanup
pokey Jan 26, 2024
2471282
Some fixes
pokey Jan 26, 2024
8e08213
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Jan 26, 2024
e90e6f9
Merge with main
AndreasArvidsson Sep 6, 2026
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
19 changes: 19 additions & 0 deletions data/playground/elixir/calls.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
defmodule Calls do
a()
b.()
c do
1
end
d() do
end
e() do
1
end
a x do
x
end
f(0) do
1
end
Alias.g()
Comment thread
r-tae marked this conversation as resolved.
end
36 changes: 36 additions & 0 deletions data/playground/elixir/data-structures.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
defmodule DataStructures do
[]
[a]
[A]
[1]
[1, 2]
[[1], 1]
%{}
%{a: 1, b: 2}
%{:a => 1, "b" => 2, c => 3}
%{"a" => 1, b: 2, c: 3}
%{user | name: "Jane", email: "jane@example.com"}
%{user | "name" => "Jane"}
%AStruct{a: 1, b: 2}
%AnotherStruct{:a => 1, "b" => 2, c => 3}
%ThirdStruct{"a" => 1, b: 2, c: 3}
%User{user | name: "Jane", email: "jane@example.com"}
%User{user | "name" => "Jane"}
%{
:a => 1,
"b" => 2,
c => 3
}
%_{}
%name{}
%^name{}
%__MODULE__{}
%__MODULE__.Child{}
%:"Elixir.Mod"{}
%fun(){}
%Mod.fun(){}
%fun.(){}
{}
{1}
{1, 2}
end
62 changes: 62 additions & 0 deletions data/playground/elixir/functions.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
defmodule Funcs do
def no_args() do
end

def no_args_no_parens do
end

def one_arg(x) do
x
end

def one_arg_no_parens(x) do
x
end

def two_args(x, y) do
x + y
end

def two_args_no_parens(x, y) do
x + y
end

def default_args_no_parens(x, y \\ 1) do
x + y
end

def default_args(x, y \\ 1) do
x + y
end

def do_block(), do: 1
def do_block(x), do: x

def pattern_matching([{x, y} | tail]) do
x + y
end

def one_guard(x) when x == 1 do
x
end

def multiple_guard(x) when x > 10 when x < 5 do
x
end

defp private(x) do
x
end

defmacro macro(x) do
quote do
[unquote(x)]
end
end

defguard guard(term) when is_integer(term) and rem(term, 2) == 0

def unquote(name)(unquote_splicing(args)) do
unquote(compiled)
end
end
13 changes: 13 additions & 0 deletions packages/common/src/extensionDependencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const extensionDependencies = [
// Cursorless access to Tree sitter
"pokey.parse-tree",

// Register necessary language-IDs for tests
"jakebecker.elixir-ls", // elixir

Check warning on line 6 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Pre-commit

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:6:27: Unexpected comment inline with code

Check warning on line 6 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Lint

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:6:27: Unexpected comment inline with code
"jrieken.vscode-tree-sitter-query", // scm

Check warning on line 7 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Pre-commit

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:7:39: Unexpected comment inline with code

Check warning on line 7 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Lint

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:7:39: Unexpected comment inline with code
"mrob95.vscode-talonscript", // talon

Check warning on line 8 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Pre-commit

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:8:32: Unexpected comment inline with code

Check warning on line 8 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Lint

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:8:32: Unexpected comment inline with code
"scala-lang.scala", // scala

Check warning on line 9 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Pre-commit

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:9:23: Unexpected comment inline with code

Check warning on line 9 in packages/common/src/extensionDependencies.ts

View workflow job for this annotation

GitHub Actions / Lint

eslint(no-inline-comments)

packages/common/src/extensionDependencies.ts:9:23: Unexpected comment inline with code

// Necessary for the `drink cell` and `pour cell` tests
"ms-toolsai.jupyter",
];
13 changes: 13 additions & 0 deletions packages/common/src/scopeSupportFacets/elixir.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/naming-convention */

import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";

const { supported } = ScopeSupportFacetLevel;

export const elixirScopeSupport: LanguageScopeSupportFacetMap = {
"collectionItem.map": supported,
"collectionItem.map.iteration": supported,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { elixirScopeSupport } from "./elixir";
import { htmlScopeSupport } from "./html";
import { javaScopeSupport } from "./java";
import { javascriptScopeSupport } from "./javascript";
import { jsonScopeSupport } from "./json";
import { pythonScopeSupport } from "./python";
import { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { talonScopeSupport } from "./talon";
import { typescriptScopeSupport } from "./typescript";

export function getLanguageScopeSupport(
languageId: string,
): LanguageScopeSupportFacetMap {
switch (languageId) {
case "html":
return htmlScopeSupport;
case "java":
return javaScopeSupport;
case "javascript":
return javascriptScopeSupport;
case "json":
return jsonScopeSupport;
case "python":
return pythonScopeSupport;
case "talon":
return talonScopeSupport;
case "typescript":
return typescriptScopeSupport;
case "elixir":
return elixirScopeSupport;
}

Check warning on line 31 in packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts

View workflow job for this annotation

GitHub Actions / Pre-commit

eslint(default-case)

packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts:14:3: Require `default` cases in `switch` statements.

Check warning on line 31 in packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts

View workflow job for this annotation

GitHub Actions / Lint

eslint(default-case)

packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts:14:3: Require `default` cases in `switch` statements.
throw Error(`Unsupported language: '${languageId}'`);

Check warning on line 32 in packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts

View workflow job for this annotation

GitHub Actions / Pre-commit

unicorn(new-for-builtins)

packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts:32:9: Use `new Error()` instead of `Error()`

Check warning on line 32 in packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts

View workflow job for this annotation

GitHub Actions / Lint

unicorn(throw-new-error)

packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts:32:9: Require `new` when throwing an error.

Check warning on line 32 in packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts

View workflow job for this annotation

GitHub Actions / Lint

unicorn(new-for-builtins)

packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts:32:9: Use `new Error()` instead of `Error()`
}
Loading
Loading