Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Conversation

mhanberg
Copy link
Collaborator

@mhanberg mhanberg commented Oct 17, 2023

Description

Implements basic autocompletion.

Current completion candidates supported

  • Global modules
  • Global Structs
  • Struct fields
  • Remote functions (w/ documentation)
  • Special Forms
  • Bitstring modifiers
  • filesystem paths in strings

More features, particularly features that rely on contextual information about the code itself (meaning, which identifiers, aliases, imports are available) will come in subsequent patches.

Partially addresses #45

Experimental

This patch also introduces a new initialization option, experimental.

This feature will be gated as an experimental feature as it's built out. The purpose of this is so that early-early adopters can try it out and report bugs, but folks who would rather wait for something more stable won't have it affect their workflows.

To enable this feature, toggle the completions experiment in your editor.

Nvim (elixir-tools.nvim)

require("elixir").setup({
    nextls = {
        enable = true,
        init_options = {
            experimental = {
                completions = {
                    enable = true
                }
            }
        }
    },
    elixirls = {enable = false}
})

Visual Studio Code (elixir-tools.vscode)

{
  "elixir-tools.nextLS.experimental.completions.enable": true
}

Other editors

Not sure 😅

Demos

TODO: record them my guy

TODO

  • integration tests
  • update elixir-tools.dev with instructions
  • update README with instructions

Acknowedgements

This feature is initially based on IEx.Autocomplete. Huge thanks to the Elixir core team's efforts to help kickstart this feature. More deviations will likely occur as we gain more contextual parsing for things like imports, aliases and variables.

@mhanberg
Copy link
Collaborator Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

Comment on lines 198 to 203
sqlite3 error: #{message}
statement: #{statement}
arguments: #{inspect(args)}
┌─────────────
│sqlite3 error: #{message}
│statement: #{statement}
│arguments: #{inspect(args)}
└─────────────
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

revert

end
end

def collect(ast) do
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

comment out

@mhanberg mhanberg force-pushed the 2023-09-15-completions branch from 407e355 to bc8217d Compare October 17, 2023 20:52
@mhanberg mhanberg force-pushed the 2023-09-15-completions branch from c95eb2f to 9f39fc9 Compare October 19, 2023 01:11
@mhanberg mhanberg merged commit a7e9bc6 into main Oct 19, 2023
@mhanberg mhanberg deleted the 2023-09-15-completions branch October 19, 2023 03:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant