vscode-neovim icon indicating copy to clipboard operation
vscode-neovim copied to clipboard

Allow installation on Github Codespaces

Open ryan-allen opened this issue 5 years ago • 13 comments

Hello!

I'd like to try this plugin on Github Codespaces, but the extension says it cannot be installed on the server.

I'm guessing (hoping) maybe it could work like how it works with WSL?

Pretty please with a cherry on top! <3

ryan-allen avatar May 12 '20 00:05 ryan-allen

Github codespaces should support installing neovim binaries to communicate locally within same container. I guess that's not the case currently. Unfortunately there are no other ways here.

asvetliakov avatar Sep 08 '20 00:09 asvetliakov

Yesterday I got this plugin to work inside codespaces, inside the browser! Codespaces are basically a docker image environment, so it is totally possible to install nvim on the server. You can open the integrated terminal and install from there, or you can install neovim as part of the codespace creation configuration.

However, as per OP, the extension says it cannot be installed in codespaces. This is because for some reason codespaces does not support ui-only extensions. All I had to do was change the extension type in package.json to something other than ui and it let me install it!

theol0403 avatar Sep 08 '20 01:09 theol0403

@theol0403 That's awesome! Mind to write guide how to do it ? I think we can add "workspace" to extension kind then to support this scenario

asvetliakov avatar Sep 08 '20 01:09 asvetliakov

Even better, this plugin could do like some others do (tabnine, clangd, rust-analyser, etc) and automatically bundle/install the required binaries. Tabnine bundles the binary, and the other two directly download and update from github releases.

theol0403 avatar Sep 08 '20 01:09 theol0403

and the other two directly download and update from github releases.

We can't do it till stable 0.5 release: downloading nightly every time is no-way and keeping single nightly version is no-way too

asvetliakov avatar Sep 08 '20 01:09 asvetliakov

or you can install neovim as part of the codespace creation configuration.

Never tried codespaces. Does it support github codeactions? If so it can use https://github.com/rhysd/action-setup-vim then

asvetliakov avatar Sep 08 '20 01:09 asvetliakov

Mind to write guide how to do it ?

Sure. I don't really know much about codespaces, and their documentation is pretty vast, but this is what I understand.

When you create a codespace, it launches a docker environment. The image and configuration for the environment is determined from the first of these it can find:

  • .devcontainer/devcontainer.json in the repo being opened in the codespace. This can point to a Dockerfile in the repo.
  • a devcontainer.json in the user's dotfiles repo

If it can't find any of those, it uses a default debian image.

So, to install neovim, you can install using apt in the command line in the integrated terminal, or you can add it a step in the Dockerfile in the repo being opened or the user's dotfiles.

I found it was easier to install neovim in ubuntu than debian, so really all you need in the dockerfile is FROM ubuntu:20.04 and the neovim install steps.

Does it support github codeactions?

Not sure, I don't know much about codeactions either. It looks like the action you linked installs vim into the environment which was launched from an image. At a quick look I didn't see a way to use a github action to setup a docker image. I think you might just need to have the manual steps to install neovim in the image.

Edit: Just to be clear, it's the user that has to set up their codespace and install neovim in it. If you wanted this plugin to work in a codespace by only installing this plugin, you need to do what I suggested above. Honestly, I don't think updating neovim from github releases would be that bad, the user could opt into automatic updates, or choose to use the neovim from their machine. I have quite a few plugins like I listed above that ever so often ask me if I want to update the binaries, I know the release rate of neovim nightly is fast, but it's showing up in apt every week anyways. You could also make it so users can choose a monthly/weekly update.

theol0403 avatar Sep 08 '20 01:09 theol0403

Any chance this could be addressed? I've got a working codespaces container with neovim installed, and the only thing preventing me from using this extension on codespaces is this issue 😄

solnic avatar Nov 14 '20 13:11 solnic

@asvetliakov I'm really sorry to bother you, but could you do a release so that this gets published?

NormalGaussian avatar Sep 15 '21 13:09 NormalGaussian

@NormalGaussian sure. i'll get it published soon

asvetliakov avatar Sep 15 '21 13:09 asvetliakov

I can confirm that removing "UI" from package.json and only leaving "Workspace" made the extension able to run in the remote container and access it's binaries so i no longer need to install Neovim locally.

Update: A better solution that doesn't require editing package.json is overriding the default extensionKind value in settings.json.

My current config is:

.devcontainer.json

"features": {
    "homebrew": {
      "version": "latest",
      "shallow": false
    }
},
"postCreateCommand": "yarn global add @devcontainers/cli && brew install neovim",

settings.json

"remote.containers.defaultExtensions": [ "asvetliakov.vscode-neovim"],
"remote.extensionKind": {
    "asvetliakov.vscode-neovim": ["workspace"]
},
"vscode-neovim.neovimExecutablePaths.linux": "/home/linuxbrew/.linuxbrew/bin/nvim",

Make sure to reload VSCode after rebuilding the container.

exil0867 avatar Aug 08 '22 12:08 exil0867

@exilvm can you make PR?

theol0403 avatar Aug 09 '22 16:08 theol0403

Sure thing!

exil0867 avatar Aug 09 '22 23:08 exil0867