lsp-mode icon indicating copy to clipboard operation
lsp-mode copied to clipboard

lsp-show-workspace-symbol doesn't work on omnisharp-roslyn if lsp uses plists instead of hashmap

Open Arnob90 opened this issue 1 year ago • 1 comments

Thank you for the bug report

  • [X] I am using the latest version of lsp-mode related packages.
  • [X] I checked FAQ and Troubleshooting sections
  • [ ] You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

If LSP_USE_PLISTS is set to true, then when trying to use helm-lsp-workspace-symbol, I get the following error. custom-initialize-reset: In ‘Workspace symbol’ source: ‘(closure ((workspaces #s(lsp--workspace nil nil nil /home/arnob/Programming/Areno-Server #s(lsp--client nil nil (:connect (closure ((command closure (t) nil (append (list (lsp-csharp--language-server-path) -lsp) (if lsp-csharp-solution-file (progn (list -s (expand-file-name lsp-csharp-solution-file)))))) tramp-ssh-controlmaster-options tramp-use-ssh-controlmaster-options) (filter sentinel name environment-fn workspace) (if (and (functionp 'json-rpc-connection) (not (file-remote-p default-directory))) (lsp-json-rpc-connection workspace (lsp-resolve-final-command command)) (let ((final-command (lsp-resolve-final-command command)) (process-name (generate-new-buffer-name name)) (process-environment (lsp--compute-process-environment environment-fn))) (let* ((stderr-buf (get-buffer-create (format *%s::stderr* process-name))) (default-directory (lsp--default-directory-for-connection)) (tramp-use-ssh-controlmaster-options 'suppress) (tramp-ssh-controlmaster-options -o ControlMaster=no -o ControlPath=none) (proc (make-process :name process-name :connection-type 'pipe :buffer (format *%s* process-name) :coding 'no-conversion :command final-command :filter filter :sentinel sentinel :stderr stderr-buf :noquery t :file-handler t))) (set-process-query-on-exit-flag proc nil) (set-process-query-on-exit-flag (get-buffer-process stderr-buf) nil) (save-current-buffer (set-buffer (get-buffer stderr-buf)) (special-mode)) (cons proc proc))))) :test? (closure (t) nil (let* ((binary (and t (lsp-csharp--language-server-path)))) (if binary (f-exists? binary) nil)))) nil nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (o#/projectadded ignore o#/projectchanged ignore o#/projectremoved ignore o#/packagerestorestarted ignore o#/msbuildprojectdiagnostics ignore o#/packagerestorefinished ignore o#/unresolveddependencies ignore o#/error lsp-csharp--handle-os-error o#/testmessage lsp-csharp--handle-os-testmessage o#/testcompleted lsp-csharp--handle-os-testcompleted o#/projectconfiguration ignore o#/projectdiagnosticstatus ignore o#/backgrounddiagnosticstatus ignore)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (1 ((closure ((callback closure ((errors) (results) (workspaces #3) (no-merge) (method . initialize) (callback closure ((initialized-fn) (server-id . omnisharp) (workspace . #3)) (input0) (let* ((capabilities (plist-get input0 :capabilities))) (if (equal 'rust-analyzer server-id) (progn (lsp:set-text-document-sync-options-save? (lsp:server-capabilities-text-document-sync? capabilities) t))) (progn (let ((cl-x workspace)) (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (let* ((v cl-x)) (aset v 2 capabilities))) (let ((cl-x workspace)) (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (let* ((v cl-x)) (aset v 13 'initialized)))) (let ((lsp--cur-workspace workspace)) (lsp-notify initialized lsp--empty-ht)) (if initialized-fn (progn (funcall initialized-fn workspace))) (let ((cl-x workspace)) (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (let* ((v cl-x)) (aset v 9 (-filter #'lsp-buffer-live-p (let ((cl-x workspace)) (progn (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (aref cl-x 9))))))) (mapc #'(lambda (buffer) (let* ((wcb (and t (plist-get buffer :with-current-buffer)))) (if wcb (let ((lsp--buffer-workspaces (plist-get buffer :workspaces))) (funcall wcb #'(lambda nil (lsp--open-in-workspace workspace)))) (save-current-buffer (set-buffer buffer) (lsp--open-in-workspace workspace))))) (let ((cl-x workspace)) (progn (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (aref cl-x 9)))) (let ((lsp--cur-workspace workspace)) (run-hooks 'lsp-after-initialize-hook)) (lsp--info %s initialized successfully in folders: %s (lsp--workspace-print workspace) (lsp-workspace-folders workspace))))) (result) (let* ((x (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons x errors)) (setq results (cons x results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (id . 1)) (result) (lsp--request-cleanup-hooks id) (funcall callback result)) (closure ((error-callback closure ((errors) (results) (workspaces #3) (no-merge) (method . initialize) (callback closure ((method . initialize)) (error) (lsp--warn %s (or (lsp--error-string error) (format %s Request has failed method))))) (result) (let* ((x (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons x errors)) (setq results (cons x results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback closure ((callback closure ((errors) (results) (workspaces #3) (no-merge) (method . initialize) (callback closure ((initialized-fn) (server-id . omnisharp) (workspace . #3)) (input0) (let* ((capabilities (plist-get input0 :capabilities))) (if (equal 'rust-analyzer server-id) (progn (lsp:set-text-document-sync-options-save? (lsp:server-capabilities-text-document-sync? capabilities) t))) (progn (let ((cl-x workspace)) (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (let* ((v cl-x)) (aset v 2 capabilities))) (let ((cl-x workspace)) (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (let* ((v cl-x)) (aset v 13 'initialized)))) (let ((lsp--cur-workspace workspace)) (lsp-notify initialized lsp--empty-ht)) (if initialized-fn (progn (funcall initialized-fn workspace))) (let ((cl-x workspace)) (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (let* ((v cl-x)) (aset v 9 (-filter #'lsp-buffer-live-p (let ((cl-x workspace)) (progn (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (aref cl-x 9))))))) (mapc #'(lambda (buffer) (let* ((wcb (and t (plist-get buffer :with-current-buffer)))) (if wcb (let ((lsp--buffer-workspaces (plist-get buffer :workspaces))) (funcall wcb #'(lambda nil (lsp--open-in-workspace workspace)))) (save-current-buffer (set-buffer buffer) (lsp--open-in-workspace workspace))))) (let ((cl-x workspace)) (progn (or (let ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-lsp--workspace-tags) t))) (signal 'wrong-type-argument (list 'lsp--workspace cl-x))) (aref cl-x 9)))) (let ((lsp--cur-workspace workspace)) (run-hooks 'lsp-after-initialize-hook)) (lsp--info %s initialized successfully in folders: %s (lsp--workspace-print workspace) (lsp-workspace-folders workspace))))) (result) (let* ((x (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons x errors)) (setq results (cons x results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (id . 1)) (result) (lsp--request-cleanup-hooks id) (funcall callback result)) (id . 1)) (error) (funcall callback :error) (lsp--request-cleanup-hooks id) (funcall error-callback error)) initialize (26290 1226 846167 324000) (26290 1226 846441 592000)))) nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (omnisharp/client/findReferences lsp-csharp--action-client-find-references)) nil nil (closure ((languages csharp)) (_file-name _mode) (-contains? languages (lsp-buffer-language))) -1 omnisharp nil nil nil nil nil nil nil nil nil nil lsp-csharp--omnisharp-uri->path-fn lsp-csharp--omnisharp-environment-fn nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) lsp-csharp--omnisharp-download-server nil nil nil) nil omnisharp omnisharp (GameManager.cs) nil nil nil starting #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) nil 0 nil nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ())))) nil (if helm-lsp-symbols-result-p helm-lsp-symbols-result (let ((lsp--buffer-workspaces workspaces)) (let ((input0 nil)) (let* ((request input0) (request-id (plist-get request :id))) (setq helm-lsp-symbols-request-id request-id) (lsp-request-async workspace/symbol (list :query helm-pattern) #'(lambda (candidates) (setq helm-lsp-symbols-request-id nil) (and helm-alive-p (let ((helm-lsp-symbols-result-p t)) (setq helm-lsp-symbols-result candidates) (helm-update)))) :mode 'detached :cancel-token :workspace-symbols) helm-lsp-symbols-result)))))’ However, if lsp doesn't use plists, then it works as intended.

Steps to reproduce

Just use (setenv "LSP_USE_PLISTS" "true"), build lsp-mode, and run a csharp file with omnisharp.

Expected behavior

It should show a list of all symbols defined in the code.

Which Language Server did you use?

omnisharp-roslyn

OS

Linux

Error callstack

No response

Anything else?

Emacs version: 30.0.50 Operating System: Arch Linux

Arnob90 avatar Aug 06 '24 11:08 Arnob90

I have same issue...

AugustoDeveloper avatar Jul 13 '25 15:07 AugustoDeveloper