Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP Refactoring #1179

Merged
merged 3 commits into from
Oct 22, 2023
Merged

LSP Refactoring #1179

merged 3 commits into from
Oct 22, 2023

Conversation

TheAngryByrd
Copy link
Member

@TheAngryByrd TheAngryByrd commented Oct 20, 2023

WHAT

🤖 Generated by Copilot at fd807bf

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 type
encapsulates server logic
code 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)

@TheAngryByrd TheAngryByrd changed the title WIP Refactoring LSP Refactoring Oct 21, 2023
@TheAngryByrd TheAngryByrd marked this pull request as ready for review October 21, 2023 19:18
@TheAngryByrd TheAngryByrd requested a review from baronfel October 21, 2023 19:18
Copy link
Contributor

@baronfel baronfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! My scrollbars are very appreciative :D

@baronfel baronfel merged commit 07afb2f into main Oct 22, 2023
9 checks passed
@baronfel baronfel deleted the lsp-refactoring branch October 22, 2023 19:09
nojaf pushed a commit to nojaf/FsAutoComplete that referenced this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants