@@ -97,39 +97,23 @@ This is only for development use."
97
97
(format lsp-cobol-download-url-format
98
98
version " linux" arch version " " )))))
99
99
100
- (defvar lsp-cobol--server-download-url (lsp-cobol--server-url)
101
- " The actual url used to download language server." )
102
-
103
- (defvar lsp-cobol--downloaded-file (f-join lsp-cobol-server-store-path " temp.tar" )
104
- " The full file path after downloading the server zipped file." )
105
-
106
- (defun lsp-cobol--extract-compressed-file (callback )
107
- " Install COBOL language service."
108
- (cond ((file-exists-p lsp-cobol--downloaded-file)
109
- ; ; Suprisingly, you can just use `tar' to unzip a zip file on Windows.
110
- ; ; Therefore, just use the same command.
111
- (lsp-cobol--execute " tar" " -xvzf" lsp-cobol--downloaded-file " -C" lsp-cobol-server-store-path)
112
- ; ; Delete the zip file.
113
- (ignore-errors (delete-file lsp-cobol--downloaded-file)))
114
- (t
115
- (error " Can't extract the downloaded file: %s " lsp-cobol--downloaded-file)))
116
- (funcall callback))
117
-
118
100
(defun lsp-cobol--stored-executable ()
119
101
" Return the stored COBOL language service executable."
120
- (executable-find
121
- (f-join lsp-cobol-server-store-path
122
- (concat " extension/server/native/"
123
- (cl-case system-type
124
- ((cygwin windows-nt ms-dos) " engine.exe" )
125
- (darwin " server-mac" )
126
- (gnu/linux " server-linux" ))))))
102
+ (f-join lsp-cobol-server-store-path
103
+ (concat " extension/server/native/"
104
+ (cl-case system-type
105
+ ((cygwin windows-nt ms-dos) " engine.exe" )
106
+ (darwin " server-mac" )
107
+ (gnu/linux " server-linux" )))))
127
108
128
109
(lsp-dependency
129
110
'cobol-ls
130
111
'(:system " cobol-ls" )
131
- `(:download :url , lsp-cobol--server-download-url
132
- :store-path , lsp-cobol--downloaded-file ))
112
+ `(:download :url ,(lsp-cobol--server-url)
113
+ :decompress :zip
114
+ :store-path ,(f-join lsp-cobol-server-store-path " temp" )
115
+ :set-executable? t )
116
+ `(:system ,(lsp-cobol--stored-executable)))
133
117
134
118
; ;
135
119
; ;; Server
@@ -181,9 +165,7 @@ This is only for development use."
181
165
:server-id 'cobol-ls
182
166
:download-server-fn
183
167
(lambda (_client callback error-callback _update? )
184
- (lsp-package-ensure 'cobol-ls
185
- (lambda () (lsp-cobol--extract-compressed-file callback))
186
- error-callback))))
168
+ (lsp-package-ensure 'cobol-ls callback error-callback))))
187
169
188
170
(lsp-consistency-check lsp-cobol)
189
171
0 commit comments