DanielGavin / ols

Language server for Odin
MIT License
417 stars 62 forks source link

Please, can anyone explain how can I install this plugin for Doom Emacs on openSuse Linux? #239

Closed joaocarvalhoopen closed 1 year ago

joaocarvalhoopen commented 1 year ago

Hello,

Please, can anyone explain how can I install this plugin for Doom Emacs on openSuse Linux?

My current configuration in ``~/.doom.d/config.el``` that is giving error at the beginning of Doom Emacs is this:


;; Add Support to the "ols" Odin LSP, made in Odin.

(add-to-list 'load-path "~/odin/ols/editors/emacs/odin-mode")
(require 'odin-mode)

;; With odin-mode (https://github.com/mattt-b/odin-mode) and lsp-mode already added to your init.el of course!.
(setq-default lsp-auto-guess-root t) ;; if you work with Projectile/project.el this will help find the ols.json file.
(defvar lsp-language-id-configuration '((odin-mode . "odin")))
(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection "/home/joaocarvalho/odin/ols/")
                  :major-modes '(odin-mode)
                  :server-id 'ols
                  :multi-root t)) ;; This is just so lsp-mode sends the "workspaceFolders" param to the server.
(add-hook 'odin-mode-hook #'lsp)

This configuration doesn't work .

Thank you.

Best regards, João Carvalho

DanielGavin commented 1 year ago

Not sure about emacs, but the path looks wrong:

:new-connection (lsp-stdio-connection "/home/joaocarvalho/odin/ols/") should be :new-connection (lsp-stdio-connection "/home/joaocarvalho/odin/ols/ols")

Before you were pointing to a directory and not an exectutable

joaocarvalhoopen commented 1 year ago

Hello DanielGavin, thank you for your fast reply,

I made the change you have written, but it still doesn't work, I have doom emacs and each time after modifing the ~/.doom.d/bin/config.el I do a doom sync and then I start emacs again and it gives me the error while starting.

The error that it gives me with emacs --debug-init is:

Debugger entered--Lisp error: (void-function lsp-register-client)
  (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection "/home/joaocarvalho/odin/ols/ols") :major-modes '(odin-mode) :server-id 'ols :multi-root t))
  eval-buffer(#<buffer  *load*> nil "/home/joaocarvalho/.doom.d/config.el" nil t)  ; Reading at buffer position 7931
  load-with-code-conversion("/home/joaocarvalho/.doom.d/config.el" "/home/joaocarvalho/.doom.d/config.el" nil t)
  load("~/.doom.d/config" nil nomessage)
  (condition-case e (load path noerror 'nomessage) ((debug doom-error) (signal (car e) (cdr e))) ((debug error) (setq path (locate-file path load-path (get-load-suffixes))) (signal (cond ((not (and path (featurep ...))) 'error) ((file-in-directory-p path (expand-file-name "cli" doom-core-dir)) 'doom-cli-error) ((file-in-directory-p path doom-core-dir) 'doom-core-error) ((file-in-directory-p path doom-user-dir) 'doom-user-error) ((file-in-directory-p path doom-profile-dir) 'doom-profile-error) ((file-in-directory-p path doom-modules-dir) 'doom-module-error) ('doom-error)) (list path e))))
  doom-load("~/.doom.d/config")
  byte-code("\305\306!\204\f\0\305\307!\203)\2\10\30\310\311!\211\203\"\0\211@\312\1!\210\1A\266\202\202\21\0\210\313\21\314\22\315\316\317\"\210\315\320\321\"\210\315..." [doom-context doom-modules doom-disabled-packages custom-file doom-module-context doom-context-p init reload ensure-list modules doom-context-push #<hash-table equal 42/65 0x15855ec0b92b> nil setplist :core (nil [0 -110 -110 :core nil nil nil]) :user (nil [1 105 -105 :user nil nil nil]) :completion (company [3 0 0 :completion company (+childframe) nil] vertico [4 0 0 :completion vertico nil nil]) :ui (doom [5 0 0 :ui doom nil nil] doom-dashboard [6 0 0 :ui doom-dashboard nil nil] emoji [7 0 0 :ui emoji (+unicode) nil] hl-todo [8 0 0 :ui hl-todo nil nil] modeline [9 0 0 :ui modeline nil nil] ophints [10 0 0 :ui ophints nil nil] popup [11 0 0 :ui popup (+defaults) nil] treemacs [12 0 0 :ui treemacs nil nil] vc-gutter [13 0 0 :ui vc-gutter (+pretty) nil] vi-tilde-fringe [14 0 0 :ui vi-tilde-fringe nil nil] workspaces [15 0 0 :ui workspaces nil nil] zen [16 0 0 :ui zen nil nil]) :editor (evil [17 0 0 :editor evil (+everywhere) nil] file-templates [18 0 0 :editor file-templates nil nil] fold [19 0 0 :editor fold nil nil] snippets [20 0 0 :editor snippets nil nil]) :emacs (dired [21 0 0 :emacs dired nil nil] electric [22 0 0 :emacs electric nil nil] undo [23 0 0 :emacs undo nil nil] vc [24 0 0 :emacs vc nil nil]) :term (vterm [25 0 0 :term vterm nil nil]) :checkers (syntax [26 0 0 :checkers syntax nil nil] spell [27 0 0 :checkers spell (+flyspell) nil]) :tools (eval [28 0 0 :tools eval (+overlay) nil] lookup [29 0 0 :tools lookup nil nil] lsp [30 0 0 :tools lsp nil nil] magit [31 0 0 :tools magit nil nil] pdf [32 0 0 :tools pdf nil nil]) :lang (cc [33 0 0 :lang cc (+lsp) nil] emacs-lisp [34 0 0 :lang emacs-lisp nil nil] markdown [35 0 0 :lang markdown nil nil] org [36 0 0 :lang org nil nil] rust [37 0 0 :lang rust (+lsp) nil] sh [38 0 0 :lang sh nil nil]) :app (calendar [39 0 0 :app calendar nil nil] emms [40 0 0 :app emms nil nil]) :config (use-package [2 -111 -111 :config use-package nil nil] default [41 0 0 :config default (+bindings +smartparens) nil]) [2 -111 -111 :config use-package nil nil] doom-load "~/.emacs.d/modules/config/use-package/init" [0 -110 -110 :core nil nil nil] "~/.emacs.d/lisp/init" doom-run-hooks doom-before-modules-init-hook [17 0 0 :editor evil (+everywhere) nil] "~/.emacs.d/modules/editor/evil/init" doom-after-modules-init-hook doom-before-modules-config-hook [3 0 0 :completion company (+childframe) nil] ...] 4)
  load("/home/joaocarvalho/.emacs.d/.local/etc/@/init.28.e..." noerror nomessage nosuffix)
  (progn (load init-file-name 'noerror 'nomessage 'nosuffix))
  (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix)))
  (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el")))
  (progn (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el"))))
  (if init-file-user (progn (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el")))))
  (condition-case error (if init-file-user (progn (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el"))))) ((debug error) (display-warning 'initialization (format-message "An error occurred while loading `%s':\n\n%s%s%s\n\nTo ..." user-init-file (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'(lambda (s) (prin1-to-string s t)) (cdr error) ", ")) :warning) (setq init-file-had-error t)))
  (let ((debug-on-error debug-on-error-initial)) (condition-case error (if init-file-user (progn (let ((init-file-name (file-name-concat doom-profile-dir ...))) (setq user-init-file t) (if init-file-name (progn (load init-file-name ... ... ...))) (if (eq user-init-file t) (progn (signal ... ...))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el"))))) ((debug error) (display-warning 'initialization (format-message "An error occurred while loading `%s':\n\n%s%s%s\n\nTo ..." user-init-file (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'(lambda ... ...) (cdr error) ", ")) :warning) (setq init-file-had-error t))) (or (eq debug-on-error debug-on-error-initial) (setq debug-on-error-should-be-set t debug-on-error-from-init-file debug-on-error)))
  (let ((debug-on-error-from-init-file nil) (debug-on-error-should-be-set nil) (debug-on-error-initial (if (eq init-file-debug t) 'startup init-file-debug)) (inhibit-null-byte-detection t)) (let ((debug-on-error debug-on-error-initial)) (condition-case error (if init-file-user (progn (let ((init-file-name ...)) (setq user-init-file t) (if init-file-name (progn ...)) (if (eq user-init-file t) (progn ...)) (setq user-init-file (concat ... ".el"))))) ((debug error) (display-warning 'initialization (format-message "An error occurred while loading `%s':\n\n%s%s%s\n\nTo ..." user-init-file (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'... (cdr error) ", ")) :warning) (setq init-file-had-error t))) (or (eq debug-on-error debug-on-error-initial) (setq debug-on-error-should-be-set t debug-on-error-from-init-file debug-on-error))) (if debug-on-error-should-be-set (progn (setq debug-on-error debug-on-error-from-init-file))))
  startup--load-user-init-file@init-doom(#f(compiled-function () #<bytecode 0x9077d9e084fd876>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t)
  apply(startup--load-user-init-file@init-doom (#f(compiled-function () #<bytecode 0x9077d9e084fd876>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t))
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x9077d9e084fd876>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t)
  command-line()
  normal-top-level()

Thank you very much,

The very best regards, João Carvalho

DanielGavin commented 1 year ago

You can try this instead: #237

I probably can't help you with emacs, so hopefully someone else can.

joaocarvalhoopen commented 1 year ago

Hello, I can't make it work on Doom Emacs, so I changed to VScode so I can continue to learn Odin, but the Odin Language plugin for VScode doesn't work on my Linux (by Daniel Gavin, I think that I have the correct one), I have already configured the ols.server.path and it finds it correctly, I have all things working, the syntax highlighting is correct, the library modules are found, the documentation appears from comments, but it doesn't do procedural completion doesn't show the possible procedures for a package and there signature.

Can you please help me?

Thank you very much,

Best regards, João Carvalho

joaocarvalhoopen commented 1 year ago

Thank you, but know is working correctly on VSCode. I was writtings in the ols.json first and wronglly:

~/odin/Odin.....

Then I tried this but forgotten the first slash

home/joaocarvalho/odin/Odin....

then I placed the first slash and it all worked, Than you very much for this great plugin!

I have to see how I can toggle the help adjacent to the code completion box.

Best regards, João Carvalho