Jump to page: 1 2
Thread overview
serve-d and emacs
Apr 26, 2021
Christian Köstlin
Apr 26, 2021
WebFreak001
Apr 28, 2021
Christian Köstlin
Apr 19, 2023
Per Nordlöw
Apr 19, 2023
Per Nordlöw
Apr 19, 2023
Per Nordlöw
Apr 19, 2023
Per Nordlöw
Apr 19, 2023
Per Nordlöw
Apr 20, 2023
Christian Köstlin
Dec 19
Renato
Apr 30, 2021
Christian Köstlin
May 01, 2021
Imperatorn
April 26, 2021
Does anybody use serve-d with emacs (lsp-mode or eglot)?
I would love to see the configuration!

Kind regards,
Christian
April 26, 2021
On Monday, 26 April 2021 at 18:45:08 UTC, Christian Köstlin wrote:
> Does anybody use serve-d with emacs (lsp-mode or eglot)?
> I would love to see the configuration!
>
> Kind regards,
> Christian

if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo.

Basic setup should be quite easy, see vim for reference: https://github.com/Pure-D/serve-d/blob/master/editor-vim.md
April 29, 2021
On 26.04.21 21:13, WebFreak001 wrote:
> On Monday, 26 April 2021 at 18:45:08 UTC, Christian Köstlin wrote:
>> Does anybody use serve-d with emacs (lsp-mode or eglot)?
>> I would love to see the configuration!
>>
>> Kind regards,
>> Christian
> 
> if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo.
> 
> Basic setup should be quite easy, see vim for reference: https://github.com/Pure-D/serve-d/blob/master/editor-vim.md
I finally got it working for me.
Its a little tricky, because the basic setup works e.g. with emacs 27.2 or newer, but not with 27.1.
All that is needed (if you have the right emacs version and use straight for installing packages) is:

    (use-package d-mode
      :straight t)

    (use-package eglot
      :straight t
      :init (progn
              (add-hook 'd-mode-hook 'eglot-ensure)
              ))
    (add-to-list
       'eglot-server-programs
       '(d-mode . ("PATH_TO_SERVE_D/serve-d")))


With a plain emacs installation the following should work:

    (require 'package)
    (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'project)
    (package-install 'd-mode)
    (package-install 'eglot)
    (require 'project)
    (require 'd-mode)
    (require 'eglot)

    (add-to-list
       'eglot-server-programs
       '(d-mode . ("FULL_PATH_TO_SERVE_D")))
    (add-hook 'd-mode-hook 'eglot-ensure)

(One emacs restart might be necessary, as there is a conflict of version for the dependency "project".

Kind regards,
Christian

April 30, 2021
On 26.04.21 21:13, WebFreak001 wrote:
> On Monday, 26 April 2021 at 18:45:08 UTC, Christian Köstlin wrote:
>> Does anybody use serve-d with emacs (lsp-mode or eglot)?
>> I would love to see the configuration!
>>
>> Kind regards,
>> Christian
> 
> if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo.
> 
> Basic setup should be quite easy, see vim for reference: https://github.com/Pure-D/serve-d/blob/master/editor-vim.md
I threw together a "minimal" emacs configuration that can be used
if you have just a plain emacs and dlang installation.
See https://github.com/gizmomogwai/demacs

Kind regards,
Christian
May 01, 2021
On Friday, 30 April 2021 at 21:24:35 UTC, Christian Köstlin wrote:
> On 26.04.21 21:13, WebFreak001 wrote:
>> On Monday, 26 April 2021 at 18:45:08 UTC, Christian Köstlin wrote:
>>> Does anybody use serve-d with emacs (lsp-mode or eglot)?
>>> I would love to see the configuration!
>>>
>>> Kind regards,
>>> Christian
>> 
>> if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo.
>> 
>> Basic setup should be quite easy, see vim for reference: https://github.com/Pure-D/serve-d/blob/master/editor-vim.md
> I threw together a "minimal" emacs configuration that can be used
> if you have just a plain emacs and dlang installation.
> See https://github.com/gizmomogwai/demacs
>
> Kind regards,
> Christian

👍
April 19, 2023

On Wednesday, 28 April 2021 at 23:04:27 UTC, Christian Köstlin wrote:

> >

if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo.
Its a little tricky, because the basic setup works e.g. with emacs 27.2 or newer, but not with 27.1.
All that is needed (if you have the right emacs version and use straight for installing packages) is:

I'm having problems with serve-d + eglot in Emacs. All calls to

eglot-find-declaration
eglot-find-implementation
eglot-find-typeDefinition

answers as

eglot--error: [eglot] Sorry, this server doesn't do :textDocument/declaration

Are neither of

:textDocument/declaration

supported? If so what lsp request type should I use to lookup/navigate to definitions? Without such functionality I see no use of eglot.

. I'm currently using

(use-package eglot
  ;; :straight t
  :ensure t
  :defer t
  :hook (d-mode . eglot-ensure)
  :config
  (progn
    ;; (add-hook 'd-mode-hook 'eglot-ensure)
	(let ((cmd '("dub" "run" "--vquiet" "serve-d")))
      (add-to-list 'eglot-server-programs ;https://forum.dlang.org/post/s6cpls$pg3$1@digitalmars.com
                   `(d-mode . ,cmd))
	  (add-to-list 'eglot-server-programs ;https://forum.dlang.org/post/s6cpls$pg3$1@digitalmars.com
                   `(d-ts-mode . ,cmd))))
  ;; (remove-hook 'd-mode-hook 'eglot-ensure)
  )

. Has anybody gotten these things to work?

April 19, 2023

On Wednesday, 19 April 2023 at 09:37:56 UTC, Per Nordlöw wrote:

>

. Has anybody gotten these things to work?

I'm gonna try lsp-mode instead of eglot.

April 19, 2023

On Wednesday, 19 April 2023 at 09:39:19 UTC, Per Nordlöw wrote:

>

On Wednesday, 19 April 2023 at 09:37:56 UTC, Per Nordlöw wrote:

>

. Has anybody gotten these things to work?

I'm gonna try lsp-mode instead of eglot.

I believe this should work

(defun serve-d-command ()
  "Shell command to start serve-d."
  '("dub" "run" "--vquiet" "serve-d"))

(when (require 'lsp nil t)
  (dolist (mode '(d-mode d-ts-mode))
	(add-hook mode #'lsp)
	(add-to-list 'lsp-language-id-configuration `(,mode . "d")))
  (lsp-register-client
   (make-lsp-client
    :new-connection (lsp-stdio-connection #'serve-d-command)
    :major-modes '(d-mode d-ts-mode)
    :server-id 'serve-d)))

but unfortunately I get status disconncted in the mode-line and the call to dub run shuts down. Clues anyone?

April 19, 2023

On Wednesday, 19 April 2023 at 10:35:31 UTC, Per Nordlöw wrote:

>

I believe this should work

(defun serve-d-command ()
  "Shell command to start serve-d."
  '("dub" "run" "--vquiet" "serve-d"))

(when (require 'lsp nil t)
  (dolist (mode '(d-mode d-ts-mode))
	(add-hook mode #'lsp)
	(add-to-list 'lsp-language-id-configuration `(,mode . "d")))
  (lsp-register-client
   (make-lsp-client
    :new-connection (lsp-stdio-connection #'serve-d-command)
    :major-modes '(d-mode d-ts-mode)
    :server-id 'serve-d)))

but unfortunately I get status disconncted in the mode-line and the call to dub run shuts down. Clues anyone?

How do I most easily get the debug output from

'("dub" "run" "--vquiet" "serve-d")

?

April 19, 2023

On Wednesday, 19 April 2023 at 10:35:31 UTC, Per Nordlöw wrote:

>

On Wednesday, 19 April 2023 at 09:39:19 UTC, Per Nordlöw wrote:

>

On Wednesday, 19 April 2023 at 09:37:56 UTC, Per Nordlöw wrote:

>

. Has anybody gotten these things to work?

I'm gonna try lsp-mode instead of eglot.

I believe this should work

(defun serve-d-command ()
  "Shell command to start serve-d."
  '("dub" "run" "--vquiet" "serve-d"))

(when (require 'lsp nil t)
  (dolist (mode '(d-mode d-ts-mode))
	(add-hook mode #'lsp)
	(add-to-list 'lsp-language-id-configuration `(,mode . "d")))
  (lsp-register-client
   (make-lsp-client
    :new-connection (lsp-stdio-connection #'serve-d-command)
    :major-modes '(d-mode d-ts-mode)
    :server-id 'serve-d)))

but unfortunately I get status disconncted in the mode-line and the call to dub run shuts down. Clues anyone?

Hmm, it turns out that using this a call to lsp-mode with this never triggers a call to the elisp function serve-d-command

. I don't see what's wrong.

« First   ‹ Prev
1 2