Giter Site home page Giter Site logo

Comments (6)

yyoncho avatar yyoncho commented on June 13, 2024 1

The proper :server-id is iph

from lsp-docker.

yyoncho avatar yyoncho commented on June 13, 2024
(require 'lsp-docker)

(defvar lsp-docker-client-packages '(lsp-php))

(defvar lsp-docker-client-configs
  (list
   (list :server-id '<server-id> :docker-server-id '<server-id>-docker :server-command "<command to start the language server with>")))

(require 'lsp-docker)
(lsp-docker-init-clients
 :docker-image-id "<your image-id>"
 :path-mappings '(("<path-to-projects-you-want-to-use>" . "/projects"))
 :client-packages lsp-docker-client-packages
 :client-configs lsp-docker-client-configs)

something like that should do. Populate the <>.

from lsp-docker.

minikN avatar minikN commented on June 13, 2024

@yyoncho Thank you.

I actually had trouble understanding how to use my own container even after your example.
However. I finally figured it out looking at the source:

(cl-defun lsp-docker-init-clients (&key
					path-mappings
					(docker-image-id "emacslsp/lsp-docker-langservers")
					(docker-container-name "lsp-container")
					(priority 10)
					(client-packages lsp-docker-default-client-packages)
					(client-configs lsp-docker-default-client-configs))
  "Loads the required client packages and registers the required clients to run with docker."
  (seq-do (lambda (package) (require package nil t)) client-packages)
  (seq-do (-lambda ((&plist :server-id :docker-server-id :server-command))
	    (lsp-docker-register-client
	     :server-id server-id
	     :priority priority
	     :docker-server-id docker-server-id
	     :docker-image-id docker-image-id
	     :docker-container-name docker-container-name
	     :server-command server-command
	     :path-mappings path-mappings
	     :launch-server-cmd-fn #'lsp-docker-launch-new-container))
	  client-configs))

You seem to hardcode the container name. Is it possible to change this? In my opinion it would be nice to be able to define one container for each language and start them individually when opening a file for such language.

from lsp-docker.

yyoncho avatar yyoncho commented on June 13, 2024

You seem to hardcode the container name.

No. This is the elisp syntax for providing a default value.

from lsp-docker.

minikN avatar minikN commented on June 13, 2024

You seem to hardcode the container name.

No. This is the elisp syntax for providing a default value.

Sorry for the confusion. I adapted my config like such:

;; Docker
(defvar lsp-docker-client-packages
    '(lsp-php))

(defvar lsp-docker-client-configs
   (list
   (list :server-id 'php-ls :docker-server-id 'phpls-docker :server-command "intelephense --stdio")))

(require 'lsp-docker)
(lsp-docker-init-clients
  :docker-image-id "lsp-docker-php"
  :docker-container-name "lsp-docker-php"
  :path-mappings '(("/path/to/project" . "/projects"))
  :client-packages lsp-docker-client-packages
  :client-configs lsp-docker-client-configs)

where /path/to/project is actually a valid path.

I created a Dockerfile:

FROM php:7.4-fpm-alpine

RUN apk add --update npm
RUN npm i intelephense -g

I also named the image lsp-docker-php.

When opening a php file from the project it starts the container but then messages:

LSP :: Error from the Language Server: Request initialize failed with mesage: Cannot read proprty 'dataPaths' of null (Internal Error)

I wasn't able to find anything releated on Intelephense's issue tracker. I don't know if this is related to lsp-docker or not.

Thanks in advance.

from lsp-docker.

minikN avatar minikN commented on June 13, 2024

Thank you, it works now.

from lsp-docker.

Related Issues (20)

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.