Giter Club home page Giter Club logo

elixir-tools.nvim's Introduction

elixir-tools.nvim

Overview

Discord GitHub Discussions

elixir-tools.nvim provides a nice experience for writing Elixir applications with Neovim.

Note This plugin does not provide autocompletion, I recommend using nvim-cmp.

Note This plugin does not provide syntax highlighting, I recommend using nvim-treesitter.

Features

Install

Requires 0.8

lazy.nvim

{
  "elixir-tools/elixir-tools.nvim",
  version = "*",
  event = { "BufReadPre", "BufNewFile" },
  config = function()
    local elixir = require("elixir")
    local elixirls = require("elixir.elixirls")

    elixir.setup {
      nextls = {enable = true},
      credo = {},
      elixirls = {
        enable = true,
        settings = elixirls.settings {
          dialyzerEnabled = false,
          enableTestLenses = false,
        },
        on_attach = function(client, bufnr)
          vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
          vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
          vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
        end,
      }
    }
  end,
  dependencies = {
    "nvim-lua/plenary.nvim",
  },
}

packer.nvim

use({ "elixir-tools/elixir-tools.nvim", tag = "stable", requires = { "nvim-lua/plenary.nvim" }})

Getting Started

Minimal Setup

The minimal setup will configure both ElixirLS and credo-language-server.

require("elixir").setup()

Next LS, ElixirLS, and Credo Language Server can be enabled/disabled by setting the enable flag in the respective options table.

The defaults are shown below.

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

Advanced Setup

While the plugin works with a minimal setup, it is much more useful if you add some personal configuration.

Note For ElixirLS, not specifying the repo, branch, or tag options will default to the latest release.

local elixir = require("elixir")
local elixirls = require("elixir.elixirls")

elixir.setup {
  nextls = {
    enable = false, -- defaults to false
    port = 9000, -- connect via TCP with the given port. mutually exclusive with `cmd`. defaults to nil
    cmd = "path/to/next-ls", -- path to the executable. mutually exclusive with `port`
    init_options = {
      mix_env = "dev",
      mix_target = "host",
      experimental = {
        completions = {
          enable = false -- control if completions are enabled. defaults to false
        }
      }
    },
    on_attach = function(client, bufnr)
      -- custom keybinds
    end
  },
  credo = {
    enable = true, -- defaults to true
    port = 9000, -- connect via TCP with the given port. mutually exclusive with `cmd`. defaults to nil
    cmd = "path/to/credo-language-server", -- path to the executable. mutually exclusive with `port`
    version = "0.1.0-rc.3", -- version of credo-language-server to install and use. defaults to the latest release
    on_attach = function(client, bufnr)
      -- custom keybinds
    end
  },
  elixirls = {
    -- specify a repository and branch
    repo = "mhanberg/elixir-ls", -- defaults to elixir-lsp/elixir-ls
    branch = "mh/all-workspace-symbols", -- defaults to nil, just checkouts out the default branch, mutually exclusive with the `tag` option
    tag = "v0.14.6", -- defaults to nil, mutually exclusive with the `branch` option

    -- alternatively, point to an existing elixir-ls installation (optional)
    -- not currently supported by elixirls, but can be a table if you wish to pass other args `{"path/to/elixirls", "--foo"}`
    cmd = "/usr/local/bin/elixir-ls.sh",

    -- default settings, use the `settings` function to override settings
    settings = elixirls.settings {
      dialyzerEnabled = true,
      fetchDeps = false,
      enableTestLenses = false,
      suggestSpecs = false,
    },
    on_attach = function(client, bufnr)
      vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
      vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
      vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
    end
  }
}

Features

Commands

:Elixir {command} [{subcommand}]

: The main elixir-tools command

  ```vim
  :Elixir nextls uninstall
  ```

Full List

Command Subcommand Description
nextls alias-refactor Aliases the module under the cursor, refactoring similar calls as well
nextls to-pipe Extracts the first argument to a pipe call
nextls from-pipe Inlines the pipe call to a function call inlining the first argument
nextls uninstall Removes the nextls executable from the default location: ~/.cache/elixir-tools/nextls/bin/nextls

Next LS

Note Next LS is disabled by default. Once it reaches feature parity with ElixirLS, it will switch to enabled by default.

Note Next LS creates a .elixir-tools directory in your project root, but it's automatically ignored by git.

The language server for Elixir that just works. ๐Ÿ˜Ž

You can read more about it at https://www.elixir-tools.dev/next-ls.

Automatic Installation

Next LS is distributed as pre-compiled binaries, which are available from the Next LS GitHub releases page. elixir-tools.nvim will prompt you to install it if it is not found, and then will consequently download it from GitHub.

If you are using a package manager like Mason, you can set the cmd property of the nextls setup table and it will not prompt you to install and use it from there.

Commands

Next LS command are available as subcommands of the :Elixir command

Credo Language Server

Note Credo Language Server integration utilizes Mix.install/2, so you must be running Elixir >= 1.12

Note Credo Language Server creates a .elixir-tools directory in your project root. You'll want to add that to your gitignore.

  • Uses your project's Credo version.
  • Full project diagnostics
  • Code Actions

ElixirLS

Automatic Installation

When a compatible installation of ElixirLS is not found, you will be prompted to install it. The plugin will download the source code to the .elixir_ls directory and compile it using the Elixir and OTP versions used by your current project.

Caveat: This assumes you are developing your project locally (outside of something like Docker) and they will be available.

Caveat: This currently downloads the language server into the .elixir_ls directory in your repository, but it does install it into ~/.cache and will re-use it when needed.

auto-install-elixirls

Root Path Detection

elixir-tools.nvim should be able to properly set the root directory for umbrella and non-umbrella apps. The nvim-lspconfig project's root detection doesn't properly account for umbrella projects.

Run Tests

ElixirLS provides a codelens to identify and run your tests. If you configure enableTestLenses = true in the settings table, you will see the codelens as virtual text in your editor and can run them with vim.lsp.codelens.run().

elixir-test-lens

Commands

:ElixirFromPipe

: Convert pipe operator to nested expressions.

:ElixirToPipe

: Convert nested expressions to the pipe operator.

manipulate_pipes

:[range]ElixirExpandMacro

: For the given [range], expand any macros and display it in a floating window.

expand_macro

:ElixirRestart

: Restart ElixirLS, you must then reconnect your buffer with :edit.

:ElixirOutputPanel

: Open the output panel that displays logs and compiler information from the server.

require("elixir.elixirls").open_output_panel()
require("elixir.elixirls").open_output_panel({ window = "split" })
require("elixir.elixirls").open_output_panel({ window = "vsplit" })
require("elixir.elixirls").open_output_panel({ window = "float" })

Mix

You can run any mix command in your project, complete with... autocomplete!

:Mix {args}

: Run any mix command.

elixir-nvim-mix-demo

Projectionist

vim-projectionist integration!

:Esource {args}

: Create or edit a regular source module.

```vim
Esource my_app/accounts/team
```

:Etest {args}

: Create or edit a regular test module.

```vim
Etest my_app/accounts/team
```

:Etask {args}

: Create or edit a Mix task module.

```vim
Etask server.start
```

:Econtroller {args}

: Create or edit a Phoenix controller module.

```vim
Econtroller my_project_web/users
```

:Eview {args}

: Create or edit a Phoenix view module.

```vim
Eview my_project_web/users
```

:Ehtml {args}

: Create or edit a Phoenix HTML module.

```vim
Ehtml my_project_web/users
```

:Ejson {args}

: Create or edit a Phoenix JSON module.

```vim
Ejson my_project_web/users
```

:Ecomponent {args}

: Create or edit a Phoenix.Component module.

```vim
Ecomponent my_project_web/users
```

:Eliveview {args}

: Create or edit a Phoenix.LiveView module.

```vim
Eliveview my_project_web/users
```

:Elivecomponent {args}

: Create or edit a Phoenix.LiveComponent module.

```vim
Elivecomponent my_project_web/users
```

:Echannel {args}

: Create or edit a Phoenix channel module.

:Efeature {args}

: Create or edit a Wallaby test module.

Contributing

Setup

elixir-tools.nvim uses a combination of Nix and just to provide the development tooling, but you can also install all of this manually.

Nix + just

# enter a nix shell, provides language deps and just
$ nix develop

# install test runner and plugin dependencies
$ just init

# run tests, optionally include the Neovim version to test
$ just test
$ just test 0.8.3

# format the code
$ just format

Manually

Install the following software:

To run the tests, you can reference the commands run in the justfile

elixir-tools.nvim's People

Contributors

andrepaes avatar avillen avatar binarytemple avatar davidelias avatar dependabot[bot] avatar dkarter avatar dvic avatar github-actions[bot] avatar johannesrld avatar jordelver avatar jswanner avatar kianmeng avatar lessthanseventy avatar linusdm avatar mhanberg avatar mikl avatar njichev avatar postsolar avatar st3fan avatar tiberiuc avatar zolrath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir-tools.nvim's Issues

How to start the installation of credo?

I got this error after I updated the plugin to the latest version.

Spawning language server with cmd: `...al/share/nvim/lazy/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server` failed. The language server is either not installed, missing fromโ”‚
 PATH, or not executable

I thought the elixir-tools would install the binary after launching the neovim.
It seems different because of the error above. Do you know if there is anything I
missed here? I've tried deleting the cache folder, but nothing is improved.
Any help would be appreciated.

Error in Terminal on Exiting Vim

I get the following error when exiting Vim after editing an Elixir file.

Error executing vim.schedule lua callback: ...er/start/elixir.nvim/lua/elixir/language_server/init.lua:300: Failed to insert line
stack traceback:
	[C]: in function 'nvim_buf_set_lines'
	...er/start/elixir.nvim/lua/elixir/language_server/init.lua:300: in function 'handler'
	...r/neovim/HEAD-050b0e3/share/nvim/runtime/lua/vim/lsp.lua:1054: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>%

Here's my elixir.nvim config:

local elixir = require("elixir")
local on_attach = require("mike.lsp_handlers").on_attach
local capabilities = require("mike.lsp_handlers").capabilities

elixir.setup({
  cmd = "/Users/mikebowman/.local/share/nvim/mason/bin/elixir-ls",

  settings = elixir.settings({
    dialyzerEnabled = true,
    fetchDeps = false,
    enableTestLenses = false,
    suggestSpecs = false
  }),

  on_attach = function(client, bufnr)
    local map_opts = { buffer = true, noremap = true }
    -- remove the pipe operator
    vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", map_opts)
    -- add the pipe operator
    vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", map_opts)
    vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", map_opts)

    on_attach(client, bufnr)
  end,
  capabilities = capabilities
})

and here's my generic LSP handlers

local M = {
  on_attach = function(client, bufnr)
    -- Mappings.
    -- See `:help vim.lsp.*` for documentation on any of the below functions
    local bufopts = { noremap = true, silent = true, buffer = bufnr }
    vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
    vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
    vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
    vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
    vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
    vim.keymap.set('n', '<leader>gwa', vim.lsp.buf.add_workspace_folder, bufopts)
    vim.keymap.set('n', '<leader>gwr', vim.lsp.buf.remove_workspace_folder, bufopts)
    vim.keymap.set('n', '<leader>gwl', function()
      print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
    end, bufopts)
    vim.keymap.set('n', '<leader>gD', vim.lsp.buf.type_definition, bufopts)
    vim.keymap.set('n', '<leader>grn', vim.lsp.buf.rename, bufopts)
    vim.keymap.set('n', '<leader>gca', vim.lsp.buf.code_action, bufopts)
    vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
    vim.keymap.set('n', '<leader>lf', function() vim.lsp.buf.format() end, bufopts)
  end,

  capabilities = require("cmp_nvim_lsp").default_capabilities()
}

return M

bug(credo-language-server): doesn't work if you open neovim outside of the directory that contains mix.lock

          I see the same error message when opening an umbrella project.

I have credo in mix.exs under project/services/mix.exs. As I'm an nvim newbie, please advise if there's any additional information needed or if I should open another issue.

nvim 0.9.0
elixir-tools `43c2288`
LazyVim 2.11.0

:LspLog

[START][2023-04-24 10:09:22] LSP logging initiated
[ERROR][2023-04-24 10:09:22] .../vim/lsp/rpc.lua:734	"rpc"	"/home/yuri/.local/share/nvim/lazy/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	"** (Code.LoadError) could not load /home/yuri/project/mix.lock. Reason: enoent\n    (elixir 1.14.4) lib/code.ex:1826: Code.find_file!/2\n    (elixir 1.14.4) lib/code.ex:1199: Code.eval_file/2\n    /home/yuri/.local/share/nvim/lazy/elixir-tools.nvim/bin/credo-language-server:5: (file)\n"
[WARN][2023-04-24 10:09:25] ...lsp/handlers.lua:537	'warning: Phoenix now requires you to explicitly list which engine to use\nfor Phoenix JSON encoding. We recommend everyone to upgrade to\nJason by setting in your config/config.exs:\n\n    config :phoenix, :json_library, Jason\n\nAnd then adding {:jason, "~> 1.0"} as a dependency.\n\nIf instead you would rather continue using Poison, then add to\nyour config/config.exs:\n\n    config :phoenix, :json_library, Poison\n\n  (phoenix 1.6.16) lib/phoenix.ex:56: Phoenix.start/2\n  (kernel 8.5.4) application_master.erl:293: :application_master.start_it_old/4\n'

Originally posted by @yuriploc in #67 (comment)

Move ElixirLS installation to ~/.cache

Currently when ElixirLS is downloaded and compiled, it all happens inside of the .elixir_ls directory of your project.

We should move the source code download and the release artifacts to the ~/.cache directory so that all project don't have to redownload and recompile if they don't need to.

Eschema

Description

projection for creating schema files

Output Panel a la VSCode

Description

VSCode has an "Output Panel" that ElixirLS displays certain logs and errors that happen with the language server.

I'd like to have a buffer you can pop open in a float or in a split that shows the same information.

TODO

  • figure out how VSCode gets the info from the language server.
  • figure out what info VSCode is getting from the language server.

Acceptance Criteria

  • A buffer is populated with formatted errors. This should not be an append only log, it should be a nicely formatted list of errors or whatever VSCode would show
  • lua function to open this buffer in a
    • horizontal split
    • vertical split
    • new tab
    • float

Configurable lsp management

Hey, nice plugin! ๐Ÿ’™

Been wondering if you could make the "lsp management" stuff (installing, starting the server, running tests, etc) under a configuration flag? I'm interested in other features from this plugin (e.g. ElixirFromPipe) but I don't want to lose my current lsp setup haha

Error with codelen config: `Invalid buffer id`

Please see this issue I posted in glepnir/lspsaga.nvim.

Copied here:

Describe the bug

Moving down in the window opened by :Lspsaga outline throws errors:

 ๏™™  Error  10:36:25 msg_show.lua_error Error executing vim.schedule lua callback: ...neovim/0.8.2/share/nvim/runtime/lua/vim/lsp/codelens.lua:166: Invalid buffer id: <BUFFER_ID>
stack traceback:
	[C]: in function 'nvim_buf_attach'
	...neovim/0.8.2/share/nvim/runtime/lua/vim/lsp/codelens.lua:166: in function 'save'
	...neovim/0.8.2/share/nvim/runtime/lua/vim/lsp/codelens.lua:229: in function 'handler'
	...w/Cellar/neovim/0.8.2/share/nvim/runtime/lua/vim/lsp.lua:1383: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

Steps to reproduce

Using this init.lua:

require('packer').startup(function(use)
    use {
        'glepnir/lspsaga.nvim',
        event = 'VimEnter',
        requires = { 'nvim-tree/nvim-web-devicons' },
        config = function()
            require('lspsaga').setup {
                lightbulb = {
                    enable_in_insert = false,
                    virtual_text = false,
                },
                symbol_in_winbar = {
                    enable = false,
                },
                ui = {
                    border = 'none',
                },
            }
        end,
    }

    use {
        'mhanberg/elixir.nvim',
        ft = { 'elixir' },
        config = function()
            local ex = require('elixir')
            ex.setup {
                cmd = 'elixir-ls',
                settings = ex.settings {
                    enableTestLenses = true,
                    suggestSpecs = true,
                },
            }
        end
    }
end)

(I suspect that it does not have to be an Elixir LS, but any LS.)

Open up a new Neovim session and :PackerCompile.

Reopen Neovim in a project so that the buffer has LSP attached. It seems that the buffer needs to have functions.

Run :Lspsaga outline.

Press down j for a little while.

See demo video below: demo video

Expected behavior

No error should occur.

Also, the floating window should be above the outline window, but that is another bug.

Neovim version (nvim -v)

NVIM v0.8.2

lspsaga commit

54725e8

Terminal name/version

alacritty 0.11.0 (8dbaa0b)

Lose dependency on lspconfig

I don't think we necessarily need to depend on the lspconfig library and can re-write some things to not have to use it.

nvim-metals does not depend on lspconfig.

Debugger Integration

ElixirLS implements the debugger protocol that is compatible with nvim-dap and the plugin should expose an easy to use integration with lots of documentation.

Run a specific test through the UI

Description

With the command to retrieve tests in a file, we should surface this through vim.ui.select to allow a user to run a specific test.

Similar to the test code lens, but doesn't require you to have your cursor on the line with the virtual text.

Dependent on #45.

No leex or ~L highlighting

Hello!
After replacing my custom Elixir setup using lazy.vim with the instructions in the readme of this repo, I do not have syntax highlighting for the "eelixir" filetype.

ft=eelixir

image

ft=heex

image

Co-located in a LiveView

image

ElixirRestart command not found

I am using the master version. ElixirRestart, ElixirFromPipe... are not found. I think that it is because I have a problem during the "Install ElixirLS" step. How can I rerun the setup again? I tried to reinstall and delete .elixir_ls but it not make the "Install ElixirLS" question apear again.

Vim docs

There needs to be vim docs in edition to the readme.

[Question] Manage LSPs (ElixirLs, Credo) with mason?

Would it be possible to use mason for LSP management but have also the nice integration with elixir-tools?
ElixirLS is available through mason, but is it possible to add Credo LSP also to masen, so it could be managed with this tool?

Expand Macro Command

We should expose a function to run the expandMacro workspace command.

Based on how I think this works in the VSCode plugin, it should probably open a floating window (similar to the hover documentation) that displays the syntax highlighted source code that the language server returns.

Treesitter

I'm not really sure what sort of Elixir specific treesitter integrations we can include, but we'll use this issue to collect them and track them.

Projectionist file create commands don't have a folder for context

One thing I'm noticing as far as Projectionist features are concerned is that running commands to create files such as :Econtroller post creates the file in /lib/controllers/post_controller.ex instead of the intended /lib/blog_web/controllers/post_controller.ex.

The controller itself also lacks the project name and results in:

defmodule .PostController do
  use , :controller
end

When switching between files with :A the plugin has the proper context to know what folder sits in the glob for /lib/**/controllers/post_controller.ex, but the creation commands don't have any context.

I'm unsure if we're able to provide that context to Projectionist.

"Client 2 quit with exit code 1 and signal 0" when elixir file is opened

Environment

Erlang/OTP 24 [erts-12.3.2.10] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Elixir 1.14.1 (compiled with Erlang/OTP 24)
ElixirLS release v0.14.3
Ubuntu 20.04.6 LTS, x86
Language server: Installed automatically. See :LspInfo below.

Current behavior

When an elixir file is opened neovim reports Client 2 quit with exit code 1 and signal 0.

Logs

:LspInfo

Detected filetype:   elixir
 
 1 client(s) attached to this buffer: 
 
 Client: ElixirLS (id: 1, bufnr: [1])
 	filetypes:       
 	autostart:       false
 	root directory:  /home/boschrexroth/wspc/elixir/rest_api
 	cmd:             /home/boschrexroth/.cache/nvim/elixir-tools.nvim/installs/elixir-lsp/elixir-ls/tags_v0.13.0/1.14.1-24/language_server.sh
 
 Configured servers list: gopls, clangd

:LspLog

[START][2023-04-19 18:55:10] LSP logging initiated
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "certifi" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:2:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "cowboy" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:3:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "cowboy_telemetry" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:4:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "cowlib" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:5:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "hackney" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:6:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "httpoison" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:7:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "idna" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:8:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "jason" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:9:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "metrics" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:10:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "mime" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:11:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "mimerl" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:12:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "parse_trans" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:13:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "plug" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:14:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "plug_cowboy" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:15:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "plug_crypto" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:16:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "plug_proxy" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:17:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "plug_static_index_html" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:18:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "ranch" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:19:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "reverse_proxy_plug" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:20:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "ssl_verify_fun" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:21:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "telemetry" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:22:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'warning: found quoted keyword "unicode_util_compat" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of ASCII letters, numbers, and underscores and not beginning with a number do not require quotes\n  mix.lock:23:4\n\n'
[ERROR][2023-04-19 18:55:10] .../vim/lsp/rpc.lua:733	"rpc"	"/home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"	"stderr"	'** (MatchError) no match of right hand side value: {%{certifi: {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, cowboy: {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, cowboy_telemetry: {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, cowlib: {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, hackney: {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, httpoison: {:hex, :httpoison, "2.1.0", "655fd9a7b0b95ee3e9a3b535cf7ac8e08ef5229bab187fa86ac4208b122d934b", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "fc455cb4306b43827def4f57299b2d5ac8ac331cb23f517e734a4b78210a160c"}, idna: {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, jason: {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, metrics: {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, mime: {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, mimerl: {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, parse_trans: {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, plug: {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"}, plug_cowboy: {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"}, plug_crypto: {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"}, plug_proxy: {:hex, :plug_proxy, "0.4.0", "1701be9dc2aa2fea4fc5238974839d3ac227d1e035ef041570e6ad8650b1cd83", [:mix], [{:cowboy, "~> 1.0 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: false]}, {:hackney, "~> 1.10", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d74796aa504c0717fe45e7b49453d6df17e920a5ff52cb7a5aab5af65d5f4ace"}, plug_static_index_html: {:hex, :plug_static_index_html, "1.0.0", "840123d4d3975585133485ea86af73cb2600afd7f2a976f9f5fd8b3808e636a0", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "79fd4fcf34d110605c26560cbae8f23c603ec4158c08298bd4360fdea90bb5cf"}, ranch: {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, reverse_proxy_plug: {:hex, :reverse_proxy_plug, "2.2.0", "3c54f9c8e7c0a9559bc2f215990c03e68074d43f0facfd396930525e2b6a8a19", [:mix], [{:cowboy, "~> 2.4", [hex: :cowboy, repo: "hexpm", optional: false]}, {:httpoison, "~> 1.2 or ~> 2.0", [hex: :httpoison, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: false]}, {:tesla, "~> 1.4", [hex: :tesla, repo: "hexpm", optional: true]}], "hexpm", "391a6307188fef99deed033e2d636e7d42d565576ca4cb1c0b2322e5939b7997"}, ssl_verify_fun: {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, telemetry: {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, unicode_util_compat: {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}}, []}\n    /home/boschrexroth/.local/share/nvim/site/pack/paqs/start/elixir-tools.nvim/bin/credo-language-server:5: (file)\n    (elixir 1.14.1) lib/code.ex:1245: Code.require_file/2\n'

health check

Description

elixir-tools.nvim should have a health check to verify common details that might escape the common user

  • nvim-treesitter
  • parser installations
  • elixir ls installation
  • credo-language-server installation

Example keybinds override common Vim bindings

Hi there,

I was very confused as to why my some of my Vim deletion commands didnโ€™t work, like dtX (delete until the next X character), until I noticed this, which I copied from this repoโ€™s README:

    -- standard lsp keybinds
    vim.keymap.set("n", "df", "<cmd>lua vim.lsp.buf.formatting_seq_sync()<cr>", map_opts)
    vim.keymap.set("n", "gd", "<cmd>lua vim.diagnostic.open_float()<cr>", map_opts)
    vim.keymap.set("n", "dt", "<cmd>lua vim.lsp.buf.definition()<cr>", map_opts)
    vim.keymap.set("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", map_opts)
    vim.keymap.set("n", "gD","<cmd>lua vim.lsp.buf.implementation()<cr>", map_opts)
    vim.keymap.set("n", "1gD","<cmd>lua vim.lsp.buf.type_definition()<cr>", map_opts)
    -- keybinds for fzf-lsp.nvim: https://github.com/gfanto/fzf-lsp.nvim
    -- you could also use telescope.nvim: https://github.com/nvim-telescope/telescope.nvim
    -- there are also core vim.lsp functions that put the same data in the loclist
    vim.keymap.set("n", "gr", ":References<cr>", map_opts)
    vim.keymap.set("n", "g0", ":DocumentSymbols<cr>", map_opts)
    vim.keymap.set("n", "gW", ":WorkspaceSymbols<cr>", map_opts)
    vim.keymap.set("n", "<leader>d", ":Diagnostics<cr>", map_opts)

Not sure what makes these โ€œstandardโ€, but it might be a bit more beginner-friendly having the example code use bindings that do not conflict with core Vim bindings, using <leader>, or at least clearly state that this is whatโ€™s going on.

`Attempt to index field 'fs' (a nil value)` in init.lua:156

Hi there

Thanks for making this plugin.

I was testing it out, and Iโ€™m getting this error whenever i load an .ex(s) file:

Screenshot 2022-07-10 at 12 04 43@2x

I presume this is due to the change in 1128046, for which I guess you have to use the NeoVim nightly build for vim.fs to be available?

This is my nvim --version:

NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.7.2/share/nvim"

Run :checkhealth for more info

Not a big problem, one can just go back to an earlier version for now, but you might want to update the README, since it currently states that you only need NeoVim 0.7.

Error on nvim startup

I get the following error on nvim startup after an upgrade:

Error detected while processing ~/dotfiles/config/nvim/init.vim:
line  192:
E5108: Error executing lua ...share/nvim/plugged/elixir-tools.nvim/lua/elixir/init.lua:16: attempt to index local 'opts' (a nil value)
stack traceback:
        ...share/nvim/plugged/elixir-tools.nvim/lua/elixir/init.lua:16: in function 'setup'
        [string ":lua"]:50: in main chunk

I'm using https://github.com/junegunn/vim-plug as the plugin manager and the only elixir related config I have is

    Plug 'elixir-tools/elixir-tools.nvim'

    require("elixir").setup()

Credo Integration

Thanks a lot for elixir.nvim.
Thanks a lot for your blogposts about how to setup neovim for elixir development. They are massively helpful.
It would be great if Credo can be integrated with this plugin.

No error for test file

Although the LS is working and this test file test/islands_engine_test.exs has been saved, no errors are generated for the missing end and incorrect function call.

Screen Shot 1

Using this minimum init.lua:

require('packer').startup(function (use)
    use {
        'mhanberg/elixir.nvim',
        config = function()
            local ex = require('elixir')
            ex.setup {
                cmd = 'elixir-ls',
                settings = ex.settings {
                    enableTestLenses = true,
                    suggestSpecs = true,
                },
            }
        end
    }
end)

I can confirm that linting does work for files in the lib, e.g. lib/islands_engine/rules.ex.

Not sure if this is a problem with LSP or elixirls. I recall having it work properly with coc-elixir, though.

orphaned credo-language-server process after quitting nvim

Description

Credo doesn't quit when stdin closes, causing orphaned processes

Discussed in https://github.com/elixir-tools/elixir-tools.nvim/discussions/93

Details

Originally posted by kenichi May 11, 2023
Hi and thanks for this plugin! Before opening an issue, I wanted to check:

On macos, using either homebrew or asdf-built elixir/erlang, nvim 0.9, latest elixir-tools.nvim with the config below, I see a lingering credo-language-server process after quitting nvim:

  501 28314     1   0 11:05AM ??         0:03.02 /opt/homebrew/Cellar/erlang/25.3.2/lib/erlang/erts-13.2.2/bin/beam.smp -- -root /opt/homebrew/Cellar/erlang/25.3.2/lib/erlang -bindir /opt/homebrew/Cellar/erlang/25.3.2/lib/erlang/erts-13.2.2/bin -progname erl -- -home [$HOME] -- -kernel shell_history enabled -- -pa /opt/homebrew/Cellar/elixir/1.14.4/bin/../lib/eex/ebin /opt/homebrew/Cellar/elixir/1.14.4/bin/../lib/elixir/ebin /opt/homebrew/Cellar/elixir/1.14.4/bin/../lib/ex_unit/ebin /opt/homebrew/Cellar/elixir/1.14.4/bin/../lib/iex/ebin /opt/homebrew/Cellar/elixir/1.14.4/bin/../lib/logger/ebin /opt/homebrew/Cellar/elixir/1.14.4/bin/../lib/mix/ebin -noshell -s elixir start_cli -- -extra [$HOME]/.local/share/nvim/lazy/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server --stdio

here is ~/.config/nvim/lua/plugins/elixir-tools.lua:

return {
  {
    "elixir-tools/elixir-tools.nvim",
    event = { "BufReadPre", "BufNewFile" },
    config = function()
      local elixir = require("elixir")
      local elixirls = require("elixir.elixirls")

      elixir.setup {
        credo = {},
        elixirls = {
          -- tag = "v0.14.6",
          enabled = true,
          settings = elixirls.settings {
            dialyzerEnabled = true,
            enableTestLenses = false,
          },
          on_attach = function(client, bufnr)
            -- whatever keybinds you want, see below for more suggestions
            -- vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
            -- vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
            -- vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
            local map_opts = { buffer = true, noremap = true}
            vim.keymap.set("n", "<leader>cf", "<cmd>lua vim.lsp.buf.format({async = true})<cr>", map_opts)
            vim.keymap.set("n", "<leader>cd", "<cmd>lua vim.diagnostic.open_float()<cr>", map_opts)
            vim.keymap.set("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", map_opts)
          end,
        }
      }
    end,
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
  }
}

Note that I share my nvim config on a linux host and do not have the problem there. Has this been noticed before, or do you see something wrong in my config?

Getting very slow neovim startup time after using elixir.nvim

Adding elixir.nvim and then installing elixirls once it asked me to made my config load take 2s+.
i.e doing nvim foo.ex --startuptime output does this:

times in msec
 clock   self+sourced   self:  sourced script
 clock   elapsed:              other lines

000.007  000.007: --- NVIM STARTING ---
...(truncated)
1989.936  1916.747: opening buffers.  <---- line in question
2009.648  019.712: BufEnter autocommands
2009.650  000.003: editing files in windows
2009.777  000.126: VimEnter autocommands
2009.801  000.024: UIEnter autocommands
2009.803  000.002: before starting main loop
2119.209  109.407: first screen update
2119.212  000.002: --- NVIM STARTED ---

Now removing elixir.nvim from my config:

...(truncated)
190.560  122.877: opening buffers
190.614  000.054: BufEnter autocommands
190.616  000.002: editing files in windows
190.702  000.086: VimEnter autocommands
190.739  000.037: UIEnter autocommands
190.959  000.100  000.100: sourcing /Users/njichev/.asdf/installs/neovim/0.8.2/share/nvim/runtime/autoload/provider/clipboard.vim
190.964  000.126: before starting main loop
283.900  092.936: first screen update
283.904  000.003: --- NVIM STARTED ---

Note that Lazy's profiling says that elixir.nvim loads quite fast:

    โ— ๏€–  elixir 7.26ms
      โžœ ๏’‡  elixir.nvim 5.96ms
        โ˜… ๏’‡  plenary.nvim 0.35ms
          โ€’ ๎Ÿ…  plenary.nvim/plugin/plenary.vim 0.06ms

I tried switching between neovim versions 0.8.2, 0.8.3 and stable in asdf and I get the same results on each.

I used the default config for the lazy.nvim plugin manager in the readme: https://github.com/mhanberg/elixir.nvim#lazynvim
So what am I doing wrong, I recently started moving my vimscript config to lua so I might be perfectly messing something up ๐Ÿ˜…

Hereโ€™s my nvim config

Edit: I also tried opening a file in a project, i.e nvim lib/page.ex for example and get the same behaviour if that's any information.

Edit2: I am using the following elixir/erlang versions: 1.14.3-otp-25/25.3 on a macbook with M1 Pro

Update ElixirLS

There should be an ergonomic way to update ElixirLS. Something like :ElixirUpdateLanguageServer.

Failed to clone (...lazy/elixir.nvim/lua/elixir/language_server/download.lua:28)

During the first launch, elixir-ls failed to clone, after git cloning the files.
The error was a missing .git file.

On second launch, nvim was burping out a log, after 1 was pressed, with the message mentioned in the issue name.

What can explain this behavior?

I have no issue manually cloning other repo. I got this issue only with elixir-ls.

Error using minimal setup

Error detected while processing /home/joao/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...m/site/pack/packer/start/elixir.nvim/lua/elixir/init.lua:226: attempt to index local 'opts' (a nil value)
stack traceback:
        ...m/site/pack/packer/start/elixir.nvim/lua/elixir/init.lua:226: in function 'setup'
        /home/joao/.config/nvim/init.lua:167: in main chunk
Press ENTER or type command to continue

Error in vim/shared.lua when executing Mix command

When executing :Mix deps.get I get the following error:

Error executing Lua callback: vim/shared.lua:0: s: expected string, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'startswith'
        .../site/pack/packer/start/elixir.nvim/lua/elixir/utils.lua:28: in function 'root_dir'
        ...pack/packer/start/elixir.nvim/lua/elixir/mix/wrapper.lua:36: in function 'run'
        ...te/pack/packer/start/elixir.nvim/lua/elixir/mix/init.lua:23: in function 'run'
        ...te/pack/packer/start/elixir.nvim/lua/elixir/mix/init.lua:42: in function 'load_command'
        ...te/pack/packer/start/elixir.nvim/lua/elixir/mix/init.lua:14: in function <...te/pack/packer/start/elixir.nvim/lua/elixir/mix/init.lua:13>

My configuration is as minimal as it can be:

require("elixir").setup()

Maybe I misunderstood how much configuration this plugin needs? I am happy to spend some time on this issue to debug it with the right starting point.

CI

We have some tests already, but we need to have them running in GitHub Actions.

this will require getting the "minimal config" init.vim file setup I believe.

[Issue] Formatting doesn't work with default keymap configuration

Example configuration in the README has this line:
vim.keymap.set("n", "<space>df", "<cmd>lua vim.lsp.buf.formatting_seq_sync()<cr>", map_opts)
But it returns an error:
E5108: Error executing lua [string ":lua"]:1: attempt to call field 'formatting_seq_sync' (a nil value) stack traceback: [string ":lua"]:1: in main chunk

This function works for me though:
vim.lsp.buf.format()

I don't really know anything about Neovim/LSPs/etc so hopefully I got it right here. Anyways, awesome plugin!

NVIM v0.9.0-dev-701+g34b973b1d Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.