|
64 | 64 |
|
65 | 65 | (defun eglot-fsharp--latest-version ()
|
66 | 66 | "Return latest fsautocomplete.exe version."
|
67 |
| - (let* ((json (with-temp-buffer (url-insert-file-contents "https://azuresearch-usnc.nuget.org/query?q=fsautocomplete&prerelease=false&packageType=DotnetTool") |
68 |
| - (json-parse-buffer))) |
69 |
| - (versions (gethash "versions" (aref (gethash "data" json) 0)))) |
70 |
| - (gethash "version" (aref versions (1- (length versions)))))) |
| 67 | + (or eglot-fsharp--latest-version |
| 68 | + (let* ((json (with-temp-buffer (url-insert-file-contents "https://azuresearch-usnc.nuget.org/query?q=fsautocomplete&prerelease=false&packageType=DotnetTool") |
| 69 | + (json-parse-buffer))) |
| 70 | + (versions (gethash "versions" (aref (gethash "data" json) 0)))) |
| 71 | + (setq eglot-fsharp--latest-version (gethash "version" (aref versions (1- (length versions)))))))) |
71 | 72 |
|
72 | 73 | (defun eglot-fsharp--installed-version ()
|
73 | 74 | "Return version string of fsautocomplete."
|
|
77 | 78 | (defun eglot-fsharp-current-version-p (version)
|
78 | 79 | "Return t if the installation is not outdated."
|
79 | 80 | (when (file-exists-p (eglot-fsharp--path-to-server))
|
80 |
| - (if (eq version 'latest) |
| 81 | + (if (eq eglot-fsharp-server-version 'latest) |
81 | 82 | (equal (eglot-fsharp--latest-version)
|
82 | 83 | (eglot-fsharp--installed-version))
|
83 |
| - (equal eglot-fsharp-server-version (eglot-fsharp--installed-version))))) |
| 84 | + (equal version (eglot-fsharp--installed-version))))) |
84 | 85 |
|
85 | 86 | (defun eglot-fsharp--install-core (version)
|
86 | 87 | "Download and install fsautocomplete as a dotnet tool at version VERSION in `eglot-fsharp-server-install-dir'."
|
|
96 | 97 | nil "tool" "uninstall"
|
97 | 98 | "fsautocomplete" "--tool-path"
|
98 | 99 | default-directory))
|
99 |
| - (error "'dotnet tool uninstall fsautocomplete --tool-path %s' failed" default-directory)))) |
100 |
| - (unless (zerop (call-process "dotnet" nil `(nil ,stderr-file) nil |
101 |
| - "tool" "install" "fsautocomplete" |
102 |
| - "--tool-path" default-directory "--version" |
103 |
| - version)) |
104 |
| - (error "'dotnet tool install fsautocomplete --tool-path %s --version %s' failed" default-directory version))) |
| 100 | + (error "'dotnet tool uninstall fsautocomplete --tool-path %s' failed" default-directory))) |
| 101 | + (unless (zerop (call-process "dotnet" nil `(nil ,stderr-file) nil |
| 102 | + "tool" "install" "fsautocomplete" |
| 103 | + "--tool-path" default-directory "--version" |
| 104 | + version)) |
| 105 | + (error "'dotnet tool install fsautocomplete --tool-path %s --version %s' failed" default-directory version)))) |
105 | 106 | (error
|
106 | 107 | (let ((stderr (with-temp-buffer
|
107 | 108 | (insert-file-contents stderr-file)
|
|
0 commit comments