forked from fsprojects/fantomas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format out of process (fsprojects#1845)
* Style guide lambda (fsprojects#1858) * WIP lambda as last argument * Update remaining test according to style proposal. * Add test for multiline non lambda argument. * Print trivia for function keyword from ast range. * multiline non lambda argument, match lambda * WIP Daemon service contract. * Early working daemon prototype. * Take .editorconfig settings into account. * Fix current build. * Add Fantomas locator. * Found globally installed Fantomas version. * Remove unused function. * Add formatSelection. * Refactor FormatDocumentResponse to DU. * Remove unused LspTypes dependency. * Update FCS in Daemon * Refactored public api of FantomasService. * Don't pass full exception in FormatDocumentResponse. * Use separate versioning for Fantomas.Client. * FantomasService manages multiple daemon versions. * Fully implement FantomasService. * Return configuration as json. * Validate if filePath in request is absolute. * Ignore first three 4.6 alphas as compatible tools. * Find ignore file from current file path. * Remove safeFileName from CodeFormatterImpl.fs. Disable daemon tests. * Add daemon unit tests. * Update help text for daemon mode. * Add documentation for Fantomas daemon mode. * Initial attempt at adding source links. * Set DebugType to embedded. * Bump Fantomas.Client to 0.3.0
- Loading branch information
1 parent
47159fd
commit 06f28da
Showing
34 changed files
with
2,635 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Fantomas Daemon mode | ||
|
||
## Introduction | ||
|
||
As part of the `4.6` release, we've introduced a new feature where end-user can control the version of Fantomas that is being used inside an IDE. | ||
In previous iterations, the editor tooling would typically reference the [Fantomas](https://www.nuget.org/packages/Fantomas) or [Fantomas.Extras](https://www.nuget.org/packages/Fantomas.Extras) nuget package and use the [CodeFormatter](../src/Fantomas/CodeFormatter.fsi) api to handle formatting. | ||
The major drawback of this approach is that shared [FCS](https://www.nuget.org/packages/FSharp.Compiler.Service/) dependency needed to be exactly the same. | ||
So the editor is in control of which version of Fantomas is being used. | ||
Each version of Fantomas theoretically can have a different outcome as the style guides may have changed over time. | ||
|
||
## Solution | ||
|
||
To tackle this problem, we introduce two new concepts: `--daemon` mode for the [fantomas-tool](https://www.nuget.org/packages/fantomas-tool) and [Fantomas.Client](https://www.nuget.org/packages/Fantomas.Client). | ||
`--daemon` would launch the commandline application as a sort of [LSP server](https://microsoft.github.io/language-server-protocol/) and `Fantomas.Client` could connect to this and proxy format requests. | ||
Editor tooling would be able to launch your pinned version of `fantomas-tool` as a daemon service and interact with it outside-of-process. | ||
|
||
## End-user impact | ||
|
||
End-users don't have to worry about `Fantomas.Client` or the `--daemon` flag. They only need to install a compatible version of `fantomas-tool`. | ||
Be it locally or globally. The first compatible version is `4.6.0-alpha-004`, all higher version should work as well. | ||
Local versions have precedence over the global version. | ||
|
||
The nice thing about this approach is that you can upgrade Fantomas at your own pace. | ||
When new versions drop, you can dedicate a separate commit in source control and it won't interfere with your other commits. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.