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

lsp-roslyn: fix arm64 detection and use default window/logMessage handler #4614

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions clients/lsp-roslyn.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Unused on other platforms.")
:package-version '(lsp-mode . "8.0.0")
:group 'lsp-roslyn)

(defcustom lsp-roslyn-package-version "4.12.0-3.24470.11"
(defcustom lsp-roslyn-package-version "4.13.0-2.24564.12"
"Version of the Roslyn package to install.
Gotten from https://dev.azure.com/azure-public/vside/_artifacts/feed/vs-impl/NuGet/Microsoft.CodeAnalysis.LanguageServer.win-x64"
:type 'string
Expand Down Expand Up @@ -125,6 +125,7 @@ Gotten from https://dev.azure.com/azure-public/vside/_artifacts/feed/vs-impl/NuG
,lsp-roslyn--stdpipe-path "."
,lsp-roslyn--pipe-name))))
(t (make-network-process
:service "roslyn"
:name process-name
:remote lsp-roslyn--pipe-name
:sentinel sentinel
Expand Down Expand Up @@ -203,15 +204,6 @@ creates another process connecting to the named pipe it specifies."
"Convert PATH to a URI, without hexifying."
(url-unhex-string (lsp--path-to-uri-1 path)))

(lsp-defun lsp-roslyn--log-message (_workspace params)
(let ((type (gethash "type" params))
(mes (gethash "message" params)))
(cl-case type
(1 (lsp--error "%s" mes)) ; Error
(2 (lsp--warn "%s" mes)) ; Warning
(3 (lsp--info "%s" mes)) ; Info
(t (lsp--info "%s" mes))))) ; Log

(lsp-defun lsp-roslyn--on-project-initialization-complete (workspace _params)
(lsp--info "%s: Project initialized successfully."
(lsp--workspace-print workspace)))
Expand Down Expand Up @@ -268,17 +260,17 @@ Assumes it was installed with the server install function."

(defun lsp-roslyn--get-rid ()
"Retrieves the .NET Runtime Identifier (RID) for the current system."
(let* ((is-x64 (string-match-p (rx (or "x86_64" "aarch64")) system-configuration))
(is-x86 (and (string-match-p "x86" system-configuration) (not is-x64)))
(is-arm (string-match-p (rx (or "arm" "aarch")) system-configuration)))
(if-let ((platform-name (cond
(let* ((is-x64 (string-match-p "x86_64" system-configuration))
(is-arm64 (string-match-p "aarch64" system-configuration))
(is-x86 (and (string-match-p "x86" system-configuration) (not is-x64))))
(if-let* ((platform-name (cond
((eq system-type 'gnu/linux) "linux")
((eq system-type 'darwin) "osx")
((eq system-type 'windows-nt) "win")))
(arch-name (cond
(is-x64 "x64")
(is-x86 "x86")
(is-arm "arm64"))))
(is-arm64 "arm64")
(is-x86 "x86"))))
(format "%s-%s" platform-name arch-name)
(error "Unsupported platform: %s (%s)" system-type system-configuration))))

Expand Down Expand Up @@ -345,8 +337,7 @@ FORCED if specified with prefix argument."
:priority 0
:server-id 'csharp-roslyn
:activation-fn (lsp-activate-on "csharp")
:notification-handlers (ht ("window/logMessage" 'lsp-roslyn--log-message)
("workspace/projectInitializationComplete" 'lsp-roslyn--on-project-initialization-complete))
:notification-handlers (ht ("workspace/projectInitializationComplete" 'lsp-roslyn--on-project-initialization-complete))

;; These two functions are the same as lsp-mode's except they do not
;; (un)hexify URIs.
Expand Down
Loading