File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 3.1.3] - 2024-01-11
9+
10+ ### Fixed
11+
12+ - LSP: Add safety to ` :HlsRestart ` command,
13+ to prevent it from retrying indefinitely.
14+
815## [ 3.1.2] - 2024-01-10
916
1017### Fixed
Original file line number Diff line number Diff line change @@ -196,14 +196,26 @@ HlsTools.restart = function(bufnr)
196196 log .error { ' Could not create timer' , err_name , err_msg }
197197 return
198198 end
199- timer :start (500 , 500 , function ()
199+ local attempts_to_live = 50
200+ local stopped_client_count = 0
201+ timer :start (200 , 100 , function ()
200202 for _ , client in ipairs (clients ) do
201203 if client :is_stopped () then
204+ stopped_client_count = stopped_client_count + 1
202205 vim .schedule (function ()
203206 lsp .start (bufnr )
204207 end )
205208 end
206209 end
210+ if stopped_client_count >= # clients then
211+ timer :stop ()
212+ attempts_to_live = 0
213+ elseif attempts_to_live <= 0 then
214+ vim .notify (' haslell-tools.lsp: Could not restart all LSP clients.' , vim .log .levels .ERROR )
215+ timer :stop ()
216+ attempts_to_live = 0
217+ end
218+ attempts_to_live = attempts_to_live - 1
207219 end )
208220end
209221
You can’t perform that action at this time.
0 commit comments