Decodetalkers / neocmakelsp

Another cmake lsp
MIT License
151 stars 13 forks source link

how to use with emacs #64

Open KeithPiTsui opened 3 weeks ago

KeithPiTsui commented 3 weeks ago

I am new to Emacs, and I wonder how to use neocmakelsp with emacs.

Decodetalkers commented 3 weeks ago

https://github.com/manateelazycat/lsp-bridge/blob/master/langserver/sumneko.json maybe you can use this repo, or make a pr to it, I do not know much about emacs, sorry

maybe you can take this pr as reference https://github.com/manateelazycat/lsp-bridge/pull/313/

yangyingchao commented 3 weeks ago

Here is my configuration for using neocmakelsp with eglot in cmake-ts-mode:

(use-package cmake-ts-mode
  :config
  (add-hook 'cmake-ts-mode-hook
    (defun setup-neocmakelsp ()
      (require 'eglot)
      (add-to-list 'eglot-server-programs `((cmake-ts-mode) . ("neocmakelsp" "--stdio")))
      (eglot-ensure))))

Please change cmake-ts-mode to cmake-mode if you are using cmake-mode.

FYI: if you feel completion is laggy, and you are using Linux, you may try my hacking branch. Download the artifact from: https://github.com/yangyingchao/neocmakelsp/actions/runs/9523861407

I made some breaking changes in this branch to make it work better/faster with emacs, including:

  1. filter candidates at server-side;
  2. do not return documentation when completing.

@Decodetalkers, if you are interested, I can add some command-line options for these changes and send MR.