Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)