lspcontainers / dockerfiles Goto Github PK
View Code? Open in Web Editor NEWDockerfiles for all LSPs used with lspcontainers.
License: Apache License 2.0
Dockerfiles for all LSPs used with lspcontainers.
License: Apache License 2.0
I want to re-write lspcontainers
from scratch considering all of the challenges we have faced over the past year working on the project.
Some languages support multiple versions (stable, lts, etc) that users may work with when developing applications. It would be good to support those variants for the given languages. Referenced #60
This issue provides context to language servers we may be missing and or need to add to LSPContainers. Below is an periodically updated list for language servers we plan to implement in the near future.
Please add a comment to this issue if you don't see a language server you'd like to see implemented.
Current Proposed:
This will add the docker-langserver
and lua-language-server
dockerfiles.
Formatting terraform/hcl code does not work. It needs the terraform binary install in the image. See the error message below.
How should we keep track of the two different versions(terraformls, terraform)?
Error message in the lsp.log
[ ERROR ] 2021-05-17T16:10:10+0200 ] ...im/HEAD-e0a01bd_2/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "docker" "stderr" '2021/05/17 14:10:10 rpc_logger.go:45: Error for "textDocument/formatting" (ID 2): [-32098] Terraform (CLI) is required. Please install Terraform or make it available in $PATH\n2021/05/17 14:10:10 server.go:247: Completed 1 requests [196.468µs elapsed]\n'
Now that we have accumulated a decent amount of LSPs it would be great to find a way to automate the process of updating the images in sync with their latest versions.
We have started using jsonnet
more at Hippo and it would be great to use the LSP for it with lspcontainers
.
lspconfig: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#jsonnet_ls
lsp server: https://github.com/jdbaldry/jsonnet-language-server
Need to improve the README around what requirements must be completed before being able to merge a new language server to the project.
Requirements:
Some of hadolint
current settings make sense: https://github.com/lspcontainers/dockerfiles/runs/3526915321#step:3:14
Others do not: https://github.com/lspcontainers/dockerfiles/runs/3526915321#step:3:13
This issue will resolve that.
Also going to do some minor clean up of code, etc.
As shown in the error here https://github.com/lspcontainers/dockerfiles/runs/2562902350 we are not providing build-args
to jobs in Github Actions.
This will set up a basic pipeline for one language server to test out Github Actions. If successful, I will create another PR with the changes for the rest of the LSPs.
Now that we use latest
for everything - we want to start building our LSPs nightly to provide our users with the latest and greatest.
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
rust-analyzer attempts to access crates for the current project, which are usually stored in ~/.cache/cargo
. This should be mounted as a volume.
Without this directory:
This isn't the first LSP to require an additional volume for this kind of usage. I'm thinking of maybe adding an extra item to objects in the supported_languages table (e.g.: extra_volumes
), with paths to additional volumes that they each require.
This provides a base onto which individual LSPs can specify extra volumes (and, probably, whether these volumes should be :ro
or :rw
).
The goal here is simple - make the smallest images possible without spending a lot of time on each one.
We need to add prisma
language server for some work I will be doing with the ORM.
The idea here is I'd like to try and see if we can build all LSP images with Nix so that they are as lightweight as possible and contain all requirements only without other dependencies.
bashls
crashes after a short while.
I noticed the Dockerfile doesn't install bash
, so I tried adding that:
diff --git a/servers/bashls/Dockerfile b/servers/bashls/Dockerfile
index 4a528f1..89f44f8 100644
--- a/servers/bashls/Dockerfile
+++ b/servers/bashls/Dockerfile
@@ -2,7 +2,8 @@ FROM alpine:3.13.5
RUN apk add --no-cache \
nodejs \
- npm
+ npm \
+ bash
ARG VERSION
I also tried updating to the latest version, but that didn't fix it either:
Here's my very simple test.bash
:
#!/usr/bin/bash
echo $*
All I can see is that it exits 1. The container's logs don't yield any clues either.
gopls
uses a custom user inside the container. This user will never match the uid of the user running the container on the host (the uid of the containerised users is mapped to an uid in the host in the range definedin /etc/subuid
).
Since my projects are in my $HOME
, the user inside gopls
can't access it, and fails with Permission denied
. It's only really possible to work on project that are world readable.
I'm looking at #63, and I don't think this change really makes sense; it you use root
inside the container, that root user will have the uid
of the user running docker / podman on the host. #63 would only make sense if you're running docker/podman as root, but that doesn't seem like a very sensible thing to do, especially for LSPs. I think if you do so, it'd be possible for the LSP to read-write files on the host that are only readable by root.
I think it's probably best to revert #63, and discourage users from running the LSP containers as root in the first place.
Hey 👏
I get Client 2 quit with exit code 1 and signal 0
when using GOPLS lsp. Did LSP log and go this:
Also get a error with rust analyzer:
I think it has something to do with my machine. I have Macbook Pro M1.
I've tried to fix the problem myself but it's out of my knowledge. Let me know if I can provide with anything.
Any idea what might be wrong? :D
I feel that a monolithic Dockerfile might not fit this project like it would a mono-repo with services that depend on each other or share a common build paths. This couples languages very early on even if their build paths have nothing similar and (in my opinion) hurts readability. This will also cause an increasing amount of merge conflicts as people submit new languages at the same time and as the file grows. This is a very common problem with dotnet's solution file early on in a project when everyone is modifying it to make new projects in the solution. I don't think it does anything to optimize the actual image sizes as they are still larger than when we had first started, at least the images based on vscode-languageserver-node
. We had also removed the .env
and node_base images to reduce coupling in the past.
To summarize:
vscode-languageserver-node
it might still be a good idea not to couple the languages for ease maintainability.(A secondary concern is this file grows so large with so many languages that the project require Git LFS as I have seen this happen with regularly text file, but this would happen very far down the line.)
This will contain the rest of the existing LSPs Github Actions setup.
Was doing some front-end work the other day and noticed this fun error:
Spawning language server with cmd: `graphql-lsp` failed. The language server is either not in
stalled, missing from PATH, or not executable.
Looking up the lspconfig: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#graphql
It seems to be like most NodeJS based LSPs and pretty easy to add.
Since my dev environment runs into a docker container, my LSP is unable to find the project packages and had to install the LSP locally. This nvim package solves the second issue, but still misses a solution for getting project packages.
I have done a temporal solution at my config (#46 (comment)).
I think this issue affects all the languages that use packages. I would like to start a discussion if these issue has to be solved at the package.
With the current docker image formatting does not work for me. But in the docs of the svelte-language-server it says that it supports formatting via prettier. I tried installing prettier and prettier-plugin-svelte in the container as well but still no success. Would it be possible to make formatting work with the lspcontainers or do I have to make that work another way?
Hi! Thank you for an awesome repo. But I didn't get how to practically use these containers.
For example, lspcontainers/typescript-language-server
immediately closes after run. How to interact with it?
We have found that some users rely on M1 and other incompatible processors for running lspcontainers
. As mentioned in #86 there are other possible work around - however we would much rather natively support the arch.
Do we want to run hadolint as part of the CI?
Here is the current output:
servers/bashls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/dockerls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/gopls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/pyls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/pyls/Dockerfile:4 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
servers/pyls/Dockerfile:7 SC2102 info: Ranges can only match single chars (mentioned due to duplicates).
servers/pyright/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/rust_analyzer/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/rust_analyzer/Dockerfile:10 DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check
servers/rust_analyzer/Dockerfile:10 SC2086 info: Double quote to prevent globbing and word splitting.
servers/sumneko_lua/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/sumneko_lua/Dockerfile:14 DL3003 warning: Use WORKDIR to switch to a directory
servers/sumneko_lua/Dockerfile:18 DL3003 warning: Use WORKDIR to switch to a directory
servers/sumneko_lua/Dockerfile:18 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
servers/svelteserver/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/terraformls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/terraformls/Dockerfile:9 SC2005 style: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
servers/tsserver/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/tsserver/Dockerfile:9 DL3016 warning: Pin versions in npm. Instead of `npm install <package>` use `npm install <package>@<version>`
servers/yamlls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
It seems like the container for Solargraph it's not working by default. I'll try to fix it and make a PR later.
[ERROR][2021-11-16 19:59:22] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "Unable to find image 'lspcontainers/solargraph:0.43.0' locally\n"
[ERROR][2021-11-16 19:59:25] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "0.43.0: Pulling from lspcontainers/solargraph\n"
[ERROR][2021-11-16 19:59:25] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "540db60ca938: Already exists\n"
[ERROR][2021-11-16 19:59:25] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "fe842b3d4a63: Pulling fs layer\n2e6f35e90723: Pulling fs layer\n"
[ERROR][2021-11-16 19:59:31] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "2e6f35e90723: Verifying Checksum\n2e6f35e90723: Download complete\n"
[ERROR][2021-11-16 19:59:35] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "fe842b3d4a63: Verifying Checksum\nfe842b3d4a63: Download complete\n"
[ERROR][2021-11-16 19:59:39] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "fe842b3d4a63: Pull complete\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "2e6f35e90723: Pull complete\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "Digest: sha256:b58682589047f5f07af774126c84a871122ba5d76f4ec5b052a82d259788b1f5\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" "Status: Downloaded newer image for lspcontainers/solargraph:0.43.0\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412 "rpc" "docker" "stderr" 'docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/usr/local/bundle/bin/solargraph": stat /usr/local/bundle/bin/solargraph: no such file or directory: unknown.\n'
We need to include all other code utilities such as gofmt
and others.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.