The goal of this PR is to make request handling on the server simpler and easier to understand.
The commits are mostly atomic, so reviewing commit-by-commit may be best. Notes on some of the changes:
Delete Server.Provider.Env, which for a long time has been a struct containing only :project, and instead pass projects directly to handlers. This removes a level of indirection and gets rid of any confusion between it and Ast.Env.
Delete Server.Provider.Queue.Supervisor in favor of starting a Task.Supervisor explicitly and moving the couple helper functions directly into the module in which they're used.
Stop converting request IDs to strings. According to the LSP spec, request IDs can be string | integer, but from everything I found, implementations should not consider 1 == "1". If there's a reason we need to do this conversion (e.g. to handle a badly-behaving client), we can add it back in, but it seemed like an unnecessary complication.
Replace Server.Provider.Queue with Server.TaskQueue, which just operates on IDs and MFAs. This means TaskQueue doesn't have to know or care about handlers. The server now finds the handler for the request before calling TaskQueue.add/2, instead of the queue having to do it. This also means that adding to the queue always succeeds.
The goal of this PR is to make request handling on the server simpler and easier to understand.
The commits are mostly atomic, so reviewing commit-by-commit may be best. Notes on some of the changes:
Server.Provider.Env
, which for a long time has been a struct containing only:project
, and instead pass projects directly to handlers. This removes a level of indirection and gets rid of any confusion between it andAst.Env
.Server.Provider.Queue.Supervisor
in favor of starting aTask.Supervisor
explicitly and moving the couple helper functions directly into the module in which they're used.string | integer
, but from everything I found, implementations should not consider1 == "1"
. If there's a reason we need to do this conversion (e.g. to handle a badly-behaving client), we can add it back in, but it seemed like an unnecessary complication.Server.Provider.Queue
withServer.TaskQueue
, which just operates on IDs and MFAs. This meansTaskQueue
doesn't have to know or care about handlers. The server now finds the handler for the request before callingTaskQueue.add/2
, instead of the queue having to do it. This also means that adding to the queue always succeeds.