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: completions #289

Merged
merged 11 commits into from
Oct 19, 2023
Merged

feat: completions #289

merged 11 commits into from
Oct 19, 2023

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

@@ -29,6 +29,18 @@ defmodule NextLS.ASTHelpers.Variables do
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 merged commit a7e9bc6 into main Oct 19, 2023
3 checks passed
@mhanberg mhanberg deleted the 2023-09-15-completions branch October 19, 2023 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant