feat: add Elixir language support (.ex / .exs) - #1685
Open
derekclair wants to merge 2 commits into
Open
Conversation
Index Elixir modules, functions/macros (with arity identity and multi-clause grouping), structs, types, protocols, and alias/import/require/use. Remote Mod.fun calls resolve through aliases, pipes and &fun/arity captures are followed, and static GenServer.call/cast plus apply/spawn MFA targets link when the module is named in source. Closes colbymchenry#1219.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0062954fcb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Aliases and imports now apply in source order, including inside a function (copied maps, popped per clause). An explicit import only: list emits the qualified target and not the bare name. Local Elixir calls resolve to the caller's enclosing module. Each defimpl is its own module scope so two implementations in one file no longer share callback names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1219.
Indexes Elixir the way the language is written: modules, functions and macros with
name/arityidentity, structs, types, protocols, andalias/import/require/use. RemoteMod.fun(...)calls resolve through aliases,|>pipes and&fun/aritycaptures are followed, and staticGenServer.call/castplusapply/spawnMFA targets link when the module is named in source.This is a from-scratch extractor on current
main(the grammar iscall-shaped, like Ruby, so definitions are dispatched invisitNodeand real calls go throughextractCall). Prior open PRs in this area: #871, #228.What it extracts
defmodule/ nested modules,def/defp/defmacro/defguard/defdelegate(multi-clause merge, arity-qualified names)@specsignatures,@doc/@moduledoc,defpvisibilitydefstructfields,@type/@typep/@opaquedefprotocol/defimpl,@behaviouralias(includingas:andFoo.{A, B}),import/require/usefoo/2and remoteFoo.Bar::baz/1calls,|>arity,&fun/aritycapturesGenServer.call/cast(__MODULE__)→handle_call/3/handle_cast/2apply(Mod, :fun, args)/spawn(Mod, :fun, args)Grammar: vendored elixir-lang/tree-sitter-elixir 0.3.5 (Apache-2.0, ABI 14). Mix
_build/.elixir_lsare default-ignored.Extraction (real repos)
Unit tests: Elixir extraction block in
__tests__/extraction.test.tsplus__tests__/elixir-arity-resolution.test.ts(delegation, remote arity, default-args, alias resolution).Retrieval A/B (n=1, plug only)
Question: How does Plug.Builder compile a plug pipeline so a Conn reaches each plug's call/2?
Both arms reached
lib/plug/builder.ex. The with-arm calledcodegraph_explorethen still Read the file explore had already returned (allocation miss — this answer lives in one file). Not a retrieval win on this small-repo question; extraction quality is the merge bar. Phoenix / BlockScout A/B not run here.Follow-ups (not in this PR)
scope/get/live) andpush_navigate— seedocs/design/framework-coverage.md.heextemplatesWHEN/ branch-guard rules (Elixirif/case/cond/witharecallnodes)Var:callback(...)folds)Re-index Elixir projects after upgrading.