Refactor the adaptive F# language server code by introducing a new AdaptiveState type and using it in the AdaptiveFSharpLspServer type. This makes the code more readable, modular, and maintainable.
π€ Generated by Copilot at fd807bf
AdaptiveState typeencapsulates server logiccode is simpler now
ππ§Ήπ
WHY
Because that file was way too big.
HOW
π€ Generated by Copilot at fd807bf
Introduce a new type AdaptiveState to encapsulate the state and logic of the adaptive F# language server (link)
Move some fields and methods from the AdaptiveFSharpLspServer type to the AdaptiveState type, such as selectProject, selectFSharpProject, rootPath, handleSemanticTokens, and getFilePathAndPosition (link, link, link, link)
Add a new field configChanges to the AdaptiveState type to track the changes in the configuration, checker, and root path of the server (link)
Remove unused and unnecessary fields and code from the AdaptiveFSharpLspServer type, such as fantomasLogger, fantomasService, and (|Cancelled|_|) (link, link)
Replace the Async.withCancellationSafe function with the Async.withCancellation function in some methods of the AdaptiveFSharpLspServer type, as the former is not needed and the latter simplifies the code (link, link, link)
Replace the async computation expression with the cancellableTask computation expression in the forgetDocument method of the AdaptiveFSharpLspServer type, to make the code more consistent and ensure proper cancellation and disposal of resources (link)
Replace the direct access to the state fields with the corresponding properties or methods of the AdaptiveState type in some methods of the AdaptiveFSharpLspServer type, to improve the encapsulation and consistency of the code and avoid direct manipulation of the state (link, link, link, link, link, link, link, link, link)
Add a blank line to separate the fields and methods of the AdaptiveState type, to improve the formatting and readability of the code (link)
WHAT
π€ Generated by Copilot at fd807bf
Refactor the adaptive F# language server code by introducing a new
AdaptiveState
type and using it in theAdaptiveFSharpLspServer
type. This makes the code more readable, modular, and maintainable.π€ Generated by Copilot at fd807bf
ππ§Ήπ
WHY
Because that file was way too big.
HOW
π€ Generated by Copilot at fd807bf
AdaptiveState
to encapsulate the state and logic of the adaptive F# language server (link)AdaptiveFSharpLspServer
type to theAdaptiveState
type, such asselectProject
,selectFSharpProject
,rootPath
,handleSemanticTokens
, andgetFilePathAndPosition
(link, link, link, link)configChanges
to theAdaptiveState
type to track the changes in the configuration, checker, and root path of the server (link)AdaptiveFSharpLspServer
type, such asfantomasLogger
,fantomasService
, and(|Cancelled|_|)
(link, link)Async.withCancellationSafe
function with theAsync.withCancellation
function in some methods of theAdaptiveFSharpLspServer
type, as the former is not needed and the latter simplifies the code (link, link, link)async
computation expression with thecancellableTask
computation expression in theforgetDocument
method of theAdaptiveFSharpLspServer
type, to make the code more consistent and ensure proper cancellation and disposal of resources (link)AdaptiveState
type in some methods of theAdaptiveFSharpLspServer
type, to improve the encapsulation and consistency of the code and avoid direct manipulation of the state (link, link, link, link, link, link, link, link, link)AdaptiveState
type, to improve the formatting and readability of the code (link)