stan-language-server 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -105,73 +105,25 @@ and add the following to the settings file:
|
|
|
105
105
|
|
|
106
106
|
### Emacs (eglot)
|
|
107
107
|
|
|
108
|
+
For emacs users, we recommend using [mason.el](github.com/mason-org/mason.el)
|
|
109
|
+
to download from the same source as neovim above.
|
|
110
|
+
|
|
108
111
|
Assuming you are using [stan-ts-mode](https://github.com/WardBrian/stan-ts-mode),
|
|
109
112
|
add the following to your `init.el`.
|
|
110
|
-
This will download the latest release the first time you load a Stan file.
|
|
111
113
|
|
|
112
114
|
```elisp
|
|
113
|
-
(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
(
|
|
117
|
-
(
|
|
118
|
-
|
|
119
|
-
;; work around https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69423
|
|
120
|
-
(assq-delete-all 'eglot package--builtins)
|
|
121
|
-
(assq-delete-all 'eglot package--builtin-versions)
|
|
122
|
-
|
|
123
|
-
(defcustom bmw/stan-language-server-location
|
|
124
|
-
(expand-file-name (concat "bin/stan-language-server" (car exec-suffixes)) user-emacs-directory)
|
|
125
|
-
"Location to download the stan-language-server binary to."
|
|
126
|
-
:type 'file
|
|
127
|
-
:group 'stan)
|
|
128
|
-
|
|
129
|
-
(use-package url)
|
|
130
|
-
|
|
131
|
-
(defun bmw/download-stan-language-server (&optional force)
|
|
132
|
-
"Download the latest copy of the stan-language-server.
|
|
133
|
-
The location is determined by stan-ts-mode-language-server-location.
|
|
134
|
-
Argument FORCE will make the download proceed even if the file exists."
|
|
135
|
-
(interactive "P")
|
|
136
|
-
(when (or force (not (file-exists-p bmw/stan-language-server-location)))
|
|
137
|
-
(let*
|
|
138
|
-
((version
|
|
139
|
-
(with-temp-buffer
|
|
140
|
-
(url-insert-file-contents
|
|
141
|
-
"https://api.github.com/repos/tomatitito/stan-language-server/releases/latest")
|
|
142
|
-
(let ((json (json-parse-buffer)))
|
|
143
|
-
(gethash "tag_name" json))))
|
|
144
|
-
(os-tag
|
|
145
|
-
(pcase system-type
|
|
146
|
-
((or 'windows-nt 'cygwin 'ms-dos) "windows-x86_64")
|
|
147
|
-
('darwin (concat "macos-"
|
|
148
|
-
(if (string-match-p "aarch64\\|arm" system-configuration ) "aarch64" "x86_64") ))
|
|
149
|
-
(_ (concat "linux-"
|
|
150
|
-
(if (string-match-p "aarch64\\|arm" system-configuration ) "arm64" "x86_64")))))
|
|
151
|
-
(url
|
|
152
|
-
(concat
|
|
153
|
-
"https://github.com/tomatitito/stan-language-server/releases/download/"
|
|
154
|
-
version
|
|
155
|
-
"/stan-ls-"
|
|
156
|
-
version
|
|
157
|
-
"-"
|
|
158
|
-
os-tag
|
|
159
|
-
(car exec-suffixes)))
|
|
160
|
-
(file bmw/stan-language-server-location))
|
|
161
|
-
(make-empty-file file t)
|
|
162
|
-
(delete-file file)
|
|
163
|
-
(url-copy-file url file)
|
|
164
|
-
(chmod file 500))))
|
|
115
|
+
(use-package mason
|
|
116
|
+
:config
|
|
117
|
+
(mason-setup
|
|
118
|
+
(dolist (pkg '("stan-language-server"))
|
|
119
|
+
(unless (mason-installed-p pkg)
|
|
120
|
+
(ignore-errors (mason-install pkg))))) )
|
|
165
121
|
|
|
166
122
|
(use-package eglot
|
|
167
|
-
:ensure
|
|
168
|
-
:pin gnu-devel
|
|
169
|
-
:hook ((stan-ts-base-mode . bmw/download-stan-language-server)
|
|
170
|
-
(stan-ts-base-mode . eglot-ensure))
|
|
123
|
+
:hook (stan-ts-base-mode . eglot-ensure)
|
|
171
124
|
:config
|
|
172
|
-
(add-to-list
|
|
173
|
-
|
|
174
|
-
`(stan-ts-base-mode . (,bmw/stan-language-server-location "--stdio"))))
|
|
125
|
+
(add-to-list 'eglot-server-programs '(stan-ts-base-mode
|
|
126
|
+
. ("stan-language-server" "--stdio")))
|
|
175
127
|
```
|
|
176
128
|
|
|
177
129
|
## For developers
|