-
-
Notifications
You must be signed in to change notification settings - Fork 93
Elixir support #1844
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Elixir support #1844
Changes from all commits
f3e979b
74ac7ee
f452edb
2e9ced4
0502350
af5ffb4
9547949
fc7d6cc
d5843c4
3b8456f
36ba114
437e803
8b74b41
c7fc534
d965ad9
89955dd
e8f8c11
5a1d1ab
52fc129
b5bb32f
9f7ad92
470a072
2471282
8e08213
e90e6f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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() | ||
| end | ||
| 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 |
| 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 |
| 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
|
||
| "jrieken.vscode-tree-sitter-query", // scm | ||
|
Check warning on line 7 in packages/common/src/extensionDependencies.ts
|
||
| "mrob95.vscode-talonscript", // talon | ||
|
Check warning on line 8 in packages/common/src/extensionDependencies.ts
|
||
| "scala-lang.scala", // scala | ||
|
Check warning on line 9 in packages/common/src/extensionDependencies.ts
|
||
|
|
||
| // Necessary for the `drink cell` and `pour cell` tests | ||
| "ms-toolsai.jupyter", | ||
| ]; | ||
| 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
|
||
| throw Error(`Unsupported language: '${languageId}'`); | ||
|
Check warning on line 32 in packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.