All Projects → emacs-lsp → lsp-docker

emacs-lsp / lsp-docker

Licence: GPL-3.0 license
Scripts and configurations to leverage lsp-mode in docker environment

Programming Languages

emacs lisp
2029 projects
Dockerfile
14818 projects
shell
77523 projects
CSS
56736 projects
Makefile
30231 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to lsp-docker

python-flask-app
Start building your next Python Flask app on IBM Cloud.
Stars: ✭ 48 (-73.48%)
Mutual labels:  starter-kit
tdesign-vue-starter
A starter-kit for TDesign Vue UI components.
Stars: ✭ 199 (+9.94%)
Mutual labels:  starter-kit
react-starter
An opinionated simple react boilerplate
Stars: ✭ 22 (-87.85%)
Mutual labels:  starter-kit
php-base-project
A Composer ready package to start a new PHP 7 project
Stars: ✭ 17 (-90.61%)
Mutual labels:  starter-kit
electron-vue-typescript-starter
Starter project for an Electron app with Vue in TypeScript.
Stars: ✭ 36 (-80.11%)
Mutual labels:  starter-kit
init-typescript-app
Initialize clean TypeScript setup by running single command. Optional package publication to npm.
Stars: ✭ 20 (-88.95%)
Mutual labels:  starter-kit
example-typescript-package
Example TypeScript Package ready to be published on npm & Tutorial / Instruction / Workflow for 2021
Stars: ✭ 71 (-60.77%)
Mutual labels:  starter-kit
react-redux-starter-kit
Get started with React, Redux, Webpack and eslint
Stars: ✭ 29 (-83.98%)
Mutual labels:  starter-kit
enlite-starter
Enlite Starter - React Dashboard Starter Template with Firebase Auth
Stars: ✭ 28 (-84.53%)
Mutual labels:  starter-kit
noise-php
A starter-kit for your PHP project.
Stars: ✭ 52 (-71.27%)
Mutual labels:  starter-kit
ultimate-backend-dashboard
ultimate react ssr starter kit is a boilerplate strapped with Apollo graphql support and alot of goodies based on FusionJS
Stars: ✭ 19 (-89.5%)
Mutual labels:  starter-kit
symfony-lts-docker-starter
🐳 Dockerized your Symfony project using a complete stack (Makefile, Docker-Compose, CI, bunch of quality insurance tools, tests ...) with a base according to up-to-date components and best practices.
Stars: ✭ 39 (-78.45%)
Mutual labels:  starter-kit
nodejs-express-app
Start building your next Node.js Express app on IBM Cloud.
Stars: ✭ 42 (-76.8%)
Mutual labels:  starter-kit
lsp-metals
lsp-mode ❤️ metals
Stars: ✭ 49 (-72.93%)
Mutual labels:  lsp-mode
nebuchadnezzar
on the way to cleanest react architechture
Stars: ✭ 15 (-91.71%)
Mutual labels:  starter-kit
weex-vue-starter-kit
weex starter kit in vue to use weexpack & weex both.(support hot-reload)
Stars: ✭ 24 (-86.74%)
Mutual labels:  starter-kit
cosmic
🌱🌌 Seed for a universal (native iOS, native Android, web, desktop) app based on react native web, redux and Typescript
Stars: ✭ 32 (-82.32%)
Mutual labels:  starter-kit
lsp-volar
Language support for Vue3
Stars: ✭ 20 (-88.95%)
Mutual labels:  lsp-mode
lskjs
Lego Starter Kit — Node.js & React isomorphic app creator (Node.js, Express, React.js, Babel, PostCSS, Webpack)
Stars: ✭ 38 (-79.01%)
Mutual labels:  starter-kit
pevn-starter
A basic example of how to use VueJS, Express and PostgreSQL in conjunction.
Stars: ✭ 53 (-70.72%)
Mutual labels:  starter-kit

lsp-mode uses lsp-docker to run language servers using in containers

./images/logo.png

Table of Contents

Preconfigured language servers

emacslsp/lsp-docker-langservers has the following content:

Usage

There are two ways of working with containerized language servers:

emacslsp/lsp-docker-langservers

This container is used by lsp-docker to run Language Servers for lsp-mode over local sources. You must pull the container before lsp-docker can use it

Configuration

  • Clone the repo
    git clone https://github.com/emacs-lsp/lsp-docker
        
  • Pull the container
    docker pull emacslsp/lsp-docker-langservers
        
  • Add repo to load path and register the docker clients in your ~/.emacs file
    ;; Uncomment the next line if you are using this from source
    ;; (add-to-list 'load-path "<path-to-lsp-docker-dir>")
    (require 'lsp-docker)
    
    (defvar lsp-docker-client-packages
        '(lsp-css lsp-clients lsp-bash lsp-go lsp-pyls lsp-html lsp-typescript
          lsp-terraform lsp-clangd))
    
    (setq lsp-docker-client-configs
        '((:server-id bash-ls :docker-server-id bashls-docker :server-command "bash-language-server start")
          (:server-id clangd :docker-server-id clangd-docker :server-command "clangd")
          (:server-id css-ls :docker-server-id cssls-docker :server-command "css-languageserver --stdio")
          (:server-id dockerfile-ls :docker-server-id dockerfilels-docker :server-command "docker-langserver --stdio")
          (:server-id gopls :docker-server-id gopls-docker :server-command "gopls")
          (:server-id html-ls :docker-server-id htmls-docker :server-command "html-languageserver --stdio")
          (:server-id pyls :docker-server-id pyls-docker :server-command "pyls")
          (:server-id ts-ls :docker-server-id tsls-docker :server-command "typescript-language-server --stdio")))
    
    (require 'lsp-docker)
    (lsp-docker-init-clients
      :path-mappings '(("path-to-projects-you-want-to-use" . "/projects"))
      :client-packages lsp-docker-client-packages
      :client-configs lsp-docker-client-configs)
        

How it works

lsp-mode starts the image passed as :docker-image-id and mounts :path-mappings in the container. Then when the process is started lsp-mode translates the local paths to docker path and vice versa using the :path-mappings specified when calling lsp-docker-init-default-clients. You may use lsp-enabled-clients and lsp-disabled-clients to control what language server will be used to run for a particular project(refer to lsp-mode FAQ on how to configure .dir-locals).

emacslsp/lsp-docker-full

The container emacslsp/lsp-docker-full contains:

  • The above language servers
  • Emacs28 compiled with native JSON support for better performance.

Flags

FlagPurposeDefault
EMACS_D_VOLUMEEmacs folder to use for /root/.emacsEmacs: $(pwd)/emacs.d Spacemacs: $(pwd)/spacemacs
PROJECTS_VOLUMEDirectory to mount at /Projects$(pwd)/demo-projects/
TZTimezone to user in containerEurope/Minsk
DOCKER_FLAGSAny additional docker flagsN/A

Emacs

  • Clone lsp-docker.
    git clone https://github.com/emacs-lsp/lsp-docker
    cd lsp-docker
        
  • Run
    bash start-emacs.sh
        

Spacemacs

  • Clone lsp-docker.
    git clone https://github.com/emacs-lsp/lsp-docker
    cd lsp-docker
        
  • Clone spacemacs repo
    # Clone spacemacs develop
    git clone -b develop https://github.com/syl20bnr/spacemacs spacemacs
        
  • Run
    EMACS_D_VOLUME=/path/to/spacemacs bash start-spacemacs.sh
        

Custom language server containers

You can use manually built language containers or images hosting language server(s), just follow a few simple rules (shown below).

Building a container (or an image):

You have 2 constraints:

  • A language server must be launched in stdio mode (other types of communication are yet to be supported)
  • A docker container (only container subtype, see the configuration below) must have your language server as an entrypoint (basically you have to be able to launch it with docker start -i <container_name> as it is launched this way with lsp-docker)

When you have sucessfully built a language server, you have to register it with either a configuration file or a .dir-locals file.

Registering a language server using a persistent configuration file:

A configuration file is a yaml file that is named .lsp-docker.yml or .lsp-docker.yaml and looks generally like this:

lsp:
  server:
    type: docker
    subtype: container # Or image. container subtype means launching an existing container
    # image subtype means creating a new container each time from a specified image
    name: not-significant-but-unique-name # Must be unique across all language servers
    server: server-id-of-the-base-server # Server id of a registered server (by lsp-mode) 
    launch_command: "launch command with arguments" # Launch command of the language server
    # (selected by a server id specified above) in stdio mode
    # Note: launch_command is not used with container subtype servers
    # as a command is embedded in a container itself and serves as an entrypoint
  mappings:
    - source: "/your/host/source/path"
      destination: "/your/local/path/inside/a/container"

Registering a language server using a .dir-locals file:

Just refer to the source code and general conventions of using .dir-locals. The variable you need is lsp-docker-persistent-default-config, its content is merged with the lsp section from a configuration file (if present).

Docker over TRAMP (TBD)

Docker running the language servers and hosting the sources, Emacs running on the desktop machine and connecting to docker instance over TRAMP.

See also

  • docker - package for managing docker images/containers.

Maintainers

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].