Skip to content

Commit

Permalink
Add warning about ASTContext and section on Rider. (#1891)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored Sep 28, 2021
1 parent ce78b0d commit be6b897
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ Often this kind of bug is because Fantomas has added a newline due to some forma

Use a helper function like `sepNlnConsideringTriviaContentBeforeForMainNode` instead of `sepNln` in `CodePrinter.fs` to solve this.

### ASTContext

In [CodePrinter.fs](https://github.com/fsprojects/fantomas/blob/master/src/Fantomas/CodePrinter.fs) the ASTContext record is used to indicate context aware information. This usually is an escape hatch and should be avoided at all times.
The key issue is that flags of the ASTContext are usually not cleaned up after they served their purpose.
Leading to very strange situations and unexpected behavior.

## Rider

The core contributors of this project are using JetBrains Rider. Running and debugging unit tests works out of the box and no additional plugins are needed.

## Ionide

When you want to contribute to this project in VSCode with Ionide, there is a trick you need to know to debug Unit tests.
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ open Fantomas.TriviaContext
open Fantomas.AstExtensions

/// This type consists of contextual information which is important for formatting
/// Please avoid using this record as it can be the cause of unexpected behavior when used incorrectly
type ASTContext =
{ /// Current node is the first child of its parent
IsFirstChild: bool
Expand Down

0 comments on commit be6b897

Please sign in to comment.