-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix installing fsautocomplete process #323
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,10 +64,11 @@ | |
|
||
(defun eglot-fsharp--latest-version () | ||
"Return latest fsautocomplete.exe version." | ||
(let* ((json (with-temp-buffer (url-insert-file-contents "https://azuresearch-usnc.nuget.org/query?q=fsautocomplete&prerelease=false&packageType=DotnetTool") | ||
(json-parse-buffer))) | ||
(versions (gethash "versions" (aref (gethash "data" json) 0)))) | ||
(gethash "version" (aref versions (1- (length versions)))))) | ||
(or eglot-fsharp--latest-version | ||
(let* ((json (with-temp-buffer (url-insert-file-contents "https://azuresearch-usnc.nuget.org/query?q=fsautocomplete&prerelease=false&packageType=DotnetTool") | ||
(json-parse-buffer))) | ||
(versions (gethash "versions" (aref (gethash "data" json) 0)))) | ||
(setq eglot-fsharp--latest-version (gethash "version" (aref versions (1- (length versions)))))))) | ||
|
||
(defun eglot-fsharp--installed-version () | ||
"Return version string of fsautocomplete." | ||
|
@@ -77,10 +78,10 @@ | |
(defun eglot-fsharp-current-version-p (version) | ||
"Return t if the installation is not outdated." | ||
(when (file-exists-p (eglot-fsharp--path-to-server)) | ||
(if (eq version 'latest) | ||
(if (eq eglot-fsharp-server-version 'latest) | ||
Comment on lines
-80
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(equal (eglot-fsharp--latest-version) | ||
(eglot-fsharp--installed-version)) | ||
(equal eglot-fsharp-server-version (eglot-fsharp--installed-version))))) | ||
(equal version (eglot-fsharp--installed-version))))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
(defun eglot-fsharp--install-core (version) | ||
"Download and install fsautocomplete as a dotnet tool at version VERSION in `eglot-fsharp-server-install-dir'." | ||
|
@@ -96,12 +97,12 @@ | |
nil "tool" "uninstall" | ||
"fsautocomplete" "--tool-path" | ||
default-directory)) | ||
(error "'dotnet tool uninstall fsautocomplete --tool-path %s' failed" default-directory)))) | ||
(unless (zerop (call-process "dotnet" nil `(nil ,stderr-file) nil | ||
"tool" "install" "fsautocomplete" | ||
"--tool-path" default-directory "--version" | ||
version)) | ||
(error "'dotnet tool install fsautocomplete --tool-path %s --version %s' failed" default-directory version))) | ||
Comment on lines
-100
to
-104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code block is always evaluated even if desired version is installed. I suppose if this expression should be evaluated if |
||
(error "'dotnet tool uninstall fsautocomplete --tool-path %s' failed" default-directory))) | ||
(unless (zerop (call-process "dotnet" nil `(nil ,stderr-file) nil | ||
"tool" "install" "fsautocomplete" | ||
"--tool-path" default-directory "--version" | ||
version)) | ||
(error "'dotnet tool install fsautocomplete --tool-path %s --version %s' failed" default-directory version)))) | ||
(error | ||
(let ((stderr (with-temp-buffer | ||
(insert-file-contents stderr-file) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use cache.
emacs-fsharp-mode/eglot-fsharp.el
Line 63 in 962f215
The cache variable is declared but it is never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of
(eglot-fsharp--latest-version)
is to ALWAYS return the exact version string, so we can compare the version string of the locally installed version string and prevent downloading the nuget artefact.Maybe I should document this better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juergenhoetzel Should I remove cache variable ? Comparison is already implemented. Sorry I didn't catch what you mean.
emacs-fsharp-mode/eglot-fsharp.el
Lines 77 to 83 in f887309