@@ -12,8 +12,8 @@ local Logger = require("eca.logger")
1212--- @field on_start ? function Callback when the server process starts
1313--- @field on_stop function Callback when the server stops
1414--- Called when a notification is received(message without an ID)
15- --- @field on_notification fun ( server : eca.Server , method : string , params : table )
16- --- @field capabilities table Server capabilities
15+ --- @field on_notification fun ( server : eca.Server , message : table )
16+ --- @field capabilities eca.ServerCapabilities Server capabilities
1717--- @field private path_finder eca.PathFinder Server path finder
1818--- @field pending_requests { id : fun ( err , data )} -- outgoing requests with callbacks
1919local M = {}
@@ -31,10 +31,11 @@ function M.new(opts)
3131 on_stop = function ()
3232 require (" eca.logger" ).notify (" Server stopped" , vim .log .levels .INFO )
3333 end ,
34- --- @param server eca.Server
35- on_notification = function (server , method , params )
34+ --- @param _ eca.Server
35+ --- @param message table
36+ on_notification = function (_ , message )
3637 return vim .schedule (function ()
37- server : handle_content ( method , params )
38+ require ( " eca.observer " ). notify ( message )
3839 end )
3940 end ,
4041 path_finder = PathFinder :new (),
@@ -207,16 +208,6 @@ function M:stop()
207208 self .initialized = false
208209end
209210
210- function M :handle_content (method , params )
211- if method == " chat/contentReceived" then
212- local eca = require (" eca" )
213- local sidebar = eca .get (false )
214- if sidebar and params then
215- sidebar :handle_chat_content_received (params )
216- end
217- end
218- end
219-
220211--- @return boolean
221212function M :is_running ()
222213 return self .process and not self .process :is_closing ()
@@ -235,7 +226,7 @@ function M:handle_message(message)
235226 end
236227 elseif message .method and not message .id then
237228 if self .on_notification then
238- self . on_notification (self , message . method , message . params )
229+ self : on_notification (message )
239230 end
240231 end
241232end
0 commit comments