Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone installation instructions #13

Open
enderger opened this issue Jun 5, 2022 · 6 comments
Open

Standalone installation instructions #13

enderger opened this issue Jun 5, 2022 · 6 comments

Comments

@enderger
Copy link

enderger commented Jun 5, 2022

Currently, there is no information on separating the language server from the VSCode extension. For users of other editors, it might be good to provide instructions for installing the server outside of VSCode to be used in something like Neovim.

@Simerax
Copy link

Simerax commented Feb 9, 2023

> git clone https://github.com/bscan/RakuNavigator
> cd RakuNavigator
> npm install
> npm run compile

Now you should be able to run the server for neovim with node server/out/server.js --stdio

Ps. im trying to solve the same problem as you (using it in neovim) i don't know if this is the "recommended" way to get it up and running but so far it looks promising.

@bscan
Copy link
Owner

bscan commented Feb 9, 2023

Hi @Simerax and @enderger . Yes, that's the recommended method for getting it running. The https://github.com/bscan/PerlNavigator docs have more information about this type of configuration, as the Perl and Raku Navigators both share the same architecture. For the Perl version, it also can be downloaded from NPM, which is something I'd like to add here.

Pull requests would also be more than welcome. The settings will likely vary per editor, so crowdsourcing this would be helpful.

@rcmlz
Copy link

rcmlz commented Feb 9, 2024

Jupyter Lab

I followed the instructions on the PerlNavigator site to install RakuNavigator into /Users/me/.raku/RakuNavigator and configured it for Sublime. That worked fine.

To use RakuNavigator with JupyterLab I created a file raku-language-server-implementation.json

{
  "LanguageServerManager": {
    "language_servers": {
      "raku-language-server": {
        "version": 2,
        "argv": ["node", "/Users/me/.raku/RakuNavigator/server/out/server.js", "--stdio"],
        "languages": ["raku"],
        "mime_types": ["text/raku", "text/x-raku"],
        "display_name": "Raku Language Server"
      }
    }
  }
}

in the directory /Users/me/.virtualenvs/PROJECT/etc/jupyter/jupyter_server_config.d/ following the example here. Use a different path from jupyter --paths if needed.

After tweaking the Raku-Kernel to use "mimetype": "text/x-raku", instead of "mimetype": "text/plain" for new Notebooks (basically search/replace) it worked. Will do a PR, maybe the change gets included.

raku-lsp-jupyter-lab

@7stud
Copy link

7stud commented Feb 23, 2024

@bscan,

I couldn't get the Raku language server to work with emacs 29.1. I did these steps:

git clone https://github.com/bscan/RakuNavigator.git
cd RakuNavigator
npm install
npm run compile

Then I went to the PerlNavigator repo, where there are instructions for emacs and eglot, and I converted the following PerlNavigator configuration:

(setq-default eglot-workspace-configuration
                '((:perlnavigator . (:perlPath
                              "/path/to/perl"
                              :enableWarnings t))))

(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs
               `((cperl-mode perl-mode) . ("/path/to/perlnavigator", "--stdio"))))

(global-company-mode)

(add-hook 'cperl-mode-hook 'eglot-ensure)
(add-hook 'perl-mode-hook 'eglot-ensure)

to this RakuNavigator configuration:

(setq-default eglot-workspace-configuration
    '((:rakunavigator . (:rakuPath
                         "/usr/local/bin/rakudo-moar-2024.01-01-macos-arm64-clang/bin/raku"
                          :enableWarnings t))))

(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs
      `((raku-mode) . ("/Users/7stud/RakuNavigator/server/out/server.js", "--stdio"))))

(global-company-mode)

;;(add-hook 'cperl-mode-hook 'eglot-ensure)
(add-hook 'raku-mode-hook 'eglot-ensure)

I added the RakuNavigator configuration to my .emacs file. Then I did:

~$ cd ./RakuNavigator/server/out
RakuNavigator/server/out$ chmod a+x server.js

to make server.js executable.

Then I installed the company package. In emacs:

M-x list-packages
C-s company (then C-s repeatedly until I found the company package).
I typed an i with the cursor on the company line.
I typed an x, which installed the company package.

Then I restarted emacs, and I opened the file b.raku and the mode line specified (Raku company), then I did:

M-x eglot <Ret>

but I got the error:

Doing vfork: Exec format error

Here's the full output:

Loading /opt/local/share/emacs/site-lisp/subdirs.el (source)...done  
Loading /Users/7stud/.emacs.d/custom.el (source)...done  
For information about GNU Emacs and the GNU system, type C-h C-a.  
b.raku has auto save data; consider M-x recover-this-file  
Error in post-command-hook (#\[0 "\\303\\301!\\205��r\\301q\\210\\304\\305\\300\\242\\306#\\210  
?\\205��\\307\\310\\311 \\")\\207" \[(#0) #<buffer b.raku> eglot--managed-mode buffer-live-p remove-hook post-command-hook t apply eglot--connect eglot--guess-contact\] 4\]): (file-error "Doing vfork" "Exec format error")  
Doing vfork: Exec format error

In the buffer containing my raku file, I don't get any language hints when I put the cursor on a function or anything else that would make me think the language server is working.

C-h v eglot-server-programs yields:

...
...

Value:
(((raku-mode)
  "/Users/7stud/RakuNavigator/server/out/server.js" "--stdio")
 ((rust-ts-mode rust-mode)
  . #f(compiled-function
       (&optional interactive)
       #<bytecode -0x150b7818629c4e00>))
 ((cmake-mode cmake-ts-mode)
  "cmake-language-server")

...
...

Here's some debug output:

Debugger entered--Lisp error: (file-error "Doing vfork" "Exec format error")
  make-process(:name "EGLOT (raku_programs/(raku-mode))" :command ("/Users/7stud/RakuNavigator/server/out/server.js" "--stdio") :connection-type pipe :coding utf-8-emacs-unix :noquery t :stderr #<buffer *EGLOT (raku_programs/(raku-mode)) stderr*> :file-handler t)
  #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)()
  #f(compiled-function (cl--cnm conn slots) #<bytecode 0xafdb99b87c0c1e2>)(#f(compiled-function (&rest args) #<bytecode -0x7451545b80f0461>) #<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  apply(#f(compiled-function (cl--cnm conn slots) #<bytecode 0xafdb99b87c0c1e2>) #f(compiled-function (&rest args) #<bytecode -0x7451545b80f0461>) (#<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>))))
  #f(compiled-function (conn slots) #<bytecode 0x1a118c40b71591b9>)(#<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  apply(#f(compiled-function (conn slots) #<bytecode 0x1a118c40b71591b9>) (#<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>))))
  #f(compiled-function (&rest args) #<bytecode -0x1621c4701db12a08>)(#<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  apply(#f(compiled-function (&rest args) #<bytecode -0x1621c4701db12a08>) #<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  initialize-instance(#<eglot-lsp-server eglot-lsp-server-42f46ca8> (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  #f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode 0x1345cf428cfc9403>)(eglot-lsp-server :name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>))
  apply(#f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode 0x1345cf428cfc9403>) eglot-lsp-server (:name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  make-instance(eglot-lsp-server :name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown :process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>))
  apply(make-instance eglot-lsp-server :name "EGLOT (raku_programs/(raku-mode))" :events-buffer-scrollback-size 2000000 :notification-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccb16b9f61>) :request-dispatcher #f(compiled-function (server method params) #<bytecode -0xa314bccc4eb9f61>) :on-shutdown eglot--on-shutdown (:process #f(compiled-function () #<bytecode 0x9056aa22b2ee02b>)))
  eglot--connect((raku-mode) (transient . "/Users/7stud/raku_programs/") eglot-lsp-server ("/Users/7stud/RakuNavigator/server/out/server.js" "--stdio") "raku")
  eglot((raku-mode) (transient . "/Users/7stud/raku_programs/") eglot-lsp-server ("/Users/7stud/RakuNavigator/server/out/server.js" "--stdio") "raku" t)
  funcall-interactively(eglot (raku-mode) (transient . "/Users/7stud/raku_programs/") eglot-lsp-server ("/Users/7stud/RakuNavigator/server/out/server.js" "--stdio") "raku" t)
  command-execute(eglot record)
  execute-extended-command(nil "eglot" "eglot")
  funcall-interactively(execute-extended-command nil "eglot" "eglot")
  command-execute(execute-extended-command)

@bscan
Copy link
Owner

bscan commented Feb 28, 2024

Hi @7stud, I believe the issue is that server.js is not an executable. For perlnavigator, I provide an executable that is installed in /usr/local/bin automatically when you npm install perlnavigator-server (see here: https://github.com/bscan/PerlNavigator/blob/main/server/bin/perlnavigator )

For the Raku version, I have not yet uploaded this to npm or added the executable. In the meantime, you can preface the command with "node" and it should work. See the comment from @rcmlz as well where they used this as a command:

"argv": ["node", "/Users/me/.raku/RakuNavigator/server/out/server.js", "--stdio"],

@luolong
Copy link

luolong commented Apr 20, 2024

There's lots of good information here, but could I sugest adding installation instructions to README documentation per editor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants