elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
413 stars 31 forks source link

feat(nextls): multi-root workspaces #184

Closed mhanberg closed 10 months ago

mhanberg commented 11 months ago

This patch has a dependency on the https://github.com/mhanberg/workspace-folders.nvim plugin.

To try out the behavior, install that plugin and create a .code-workspace file that describes your multi-root workspace (or mono repo as most call it), in the root of your mono repo.

If your monorepo is called "money-factory-io", with the folders "crypto", "ai-chat-app", and "drop-shipping-cms", your code-workspace would be named money-factory-io.code-workspace and look like:

{
  "folders": [
    {"path": "crypto"},
    {"path": "ai-chat-app"},
    {"path": "drop-shipping-cms"},
  ]
}
mhanberg commented 11 months ago

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

mhanberg commented 11 months ago

@cigrainger would you mind trying this out when you get a chance?

I was able to successfully test it out on the nx mono repo, with the following code-workspace file

{
    "folders": [
        {
            "path": "./nx"
        },
        {
            "path": "./exla"
        },
        {
            "path": "torchx"
        }
    ]
}
cigrainger commented 11 months ago

Yassss! I'll give it a whirl when I get to the office this morning. Thanks @mhanberg!

cigrainger commented 11 months ago

How do I start workspace-folders.nvim without lazy.nvim? I added it to my Nix config and gathered it needs to be run in a VimEnter autocmd, but I'm too ignorant to figure out how to source the thing.

mhanberg commented 11 months ago

You can just install it however you normally install plugins and can ignore the VinEnter thing

cigrainger commented 11 months ago

Ahhhhhh... I'm a goober. Nix happily ignored an invalid hash and just silently didn't install it when I rebuilt the system flake. Cool cool. It's working! Now I need to get the the credo ls working (I think there's a relative path thing going on which Nix doesn't like) and I'm going to be extremely happy. Thanks @mhanberg!

mhanberg commented 11 months ago

if you are using Next LS, you can disable the Credo Language Server, as Next LS has a builtin credo extension link to docs

cigrainger commented 11 months ago

Pfffff stop making it too easy. <3 Also I'll rtfm (you're moving too quick for me over here). Thanks again!

mhanberg commented 11 months ago

I'm going to use this branch today just to make sure there aren't any regressions, but i'll most likely merge and release tonight.

mhanberg commented 11 months ago

Also nix question for you, are you letting the plugin install Next LS for you, or are you using the nix flake?

cigrainger commented 11 months ago

Letting the plugin install Next LS (I'm not pure enough). Better to use the flake?

mhanberg commented 11 months ago

better to use the flake?

No clue, I am a nix newb, so i was just wondering.

NixOS or just nix package manager?

cigrainger commented 11 months ago

nix-darwin. I can't give up macOS (I tried but spent more time tweaking things than doing work). I run NixOS on my linux box but I don't run a desktop environment on it.