|
87 | 87 | (seq-some (lambda (s) (and (string-match "^fsautocomplete[[:space:]]+\\([0-9\.]*\\)[[:space:]]+" s) (match-string 1 s)))
|
88 | 88 | (process-lines "dotnet" "tool" "list" "--tool-path" (file-name-directory (eglot-fsharp--path-to-server)))))
|
89 | 89 |
|
90 |
| -(defun eglot-fsharp-current-version-p () |
| 90 | +(defun eglot-fsharp-current-version-p (version) |
91 | 91 | "Return t if the installation is not outdated."
|
92 | 92 | (when (file-exists-p (eglot-fsharp--path-to-server))
|
93 |
| - (if (eq eglot-fsharp-server-version 'latest) |
| 93 | + (if (eq version 'latest) |
94 | 94 | (equal (eglot-fsharp--latest-version)
|
95 | 95 | (eglot-fsharp--installed-version))
|
96 | 96 | (equal eglot-fsharp-server-version (eglot-fsharp--installed-version)))))
|
|
108 | 108 | (version<= emacs-version "26.2"))
|
109 | 109 | "NORMAL:-VERS-TLS1.3"
|
110 | 110 | gnutls-algorithm-priority))))
|
111 |
| - (unless (eglot-fsharp-current-version-p) |
| 111 | + (unless (eglot-fsharp-current-version-p version) |
112 | 112 | (url-copy-file url zip t)
|
113 | 113 | ;; FIXME: Windows (unzip preinstalled?)
|
114 | 114 | (let ((default-directory (file-name-directory (eglot-fsharp--path-to-server))))
|
|
133 | 133 | (defun eglot-fsharp--install-core (version)
|
134 | 134 | "Download and install fsautocomplete as a dotnet tool at version VERSION in `eglot-fsharp-server-install-dir'."
|
135 | 135 | (let ((default-directory (file-name-directory (eglot-fsharp--path-to-server))))
|
136 |
| - (unless (eglot-fsharp-current-version-p) |
| 136 | + (unless (eglot-fsharp-current-version-p version) |
137 | 137 | (if (file-exists-p (eglot-fsharp--path-to-server))
|
138 | 138 | (eglot-fsharp--process-tool-action (call-process "dotnet" nil '(nil
|
139 | 139 | "error_output.txt")
|
|
145 | 145 | "--tool-path" default-directory "--version"
|
146 | 146 | version)))))
|
147 | 147 |
|
148 |
| -(defun eglot-fsharp--maybe-install () |
| 148 | +(defun eglot-fsharp--maybe-install (&optional version) |
149 | 149 | "Downloads F# compiler service, and install in `eglot-fsharp-server-install-dir'."
|
150 | 150 | (make-directory (file-name-directory (eglot-fsharp--path-to-server)) t)
|
151 |
| - (let* ((version (if (eq eglot-fsharp-server-version 'latest) |
152 |
| - (eglot-fsharp--latest-version) |
153 |
| - eglot-fsharp-server-version))) |
| 151 | + (let* ((version (or version (if (eq eglot-fsharp-server-version 'latest) |
| 152 | + (eglot-fsharp--latest-version) |
| 153 | + eglot-fsharp-server-version)))) |
154 | 154 | (if (eq eglot-fsharp-server-runtime 'net-core)
|
155 | 155 | (eglot-fsharp--install-core version)
|
156 | 156 | (eglot-fsharp--install-w32 version))))
|
|
0 commit comments