Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
We prefer the latest F# 9 features over the old syntax

Prefer `voption` over `option`

Prefer `task` CE over `async` CE
Copy link
Collaborator

Choose a reason for hiding this comment

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

@xperiandri let's put this line backwards, async is idomatic F#


This is how you define a non-default F# class constructor:
```fsharp
type DerivedClass =
inherit BaseClass

new (``arguments here``) as ``created object``
=
// create any objects used in the base class constructor
let fieldValue = ""
{
inherit
BaseClass (``arguments here``)
}
then
``created object``.otherField <- fieldValue

[<DefaultValue>]
val mutable otherField : FieldType
Copy link
Collaborator

Choose a reason for hiding this comment

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

@xperiandri let's not encourage Copilot to use the mutable keyword

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The mutable keyword can be mentioned separately to bring its attention to the preference of not using it.

```

Always prefer F# class initializers over property assignment! **You absolutely must use F# class initializers instead of property assignment**!

Class declaration:
``` F#
type MyClass (someConstructorParam : string) =
member ReadOnlyProperty = someConstructorParam

member val MutableProperty1 = "" with get, set
member val MutableProperty2 = "" with get, set
```

Wrong:
``` F#
let myClass = MyClass("some value")
myClass.MutableProperty1 <- "new value"
myClass.MutableProperty2 <- "new value"
```

Right:
``` F#
let myClass =
MyClass(
// constructor parameters go first without names
"some value",
// then mutable properties go next with names
MutableProperty1 = "new value",
MutableProperty2 =
// operations must be placed into parentheses
(5 |> string)
)
```
19 changes: 19 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"servers": {
"GitHub": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${input:github_pat}"
}
}
},
"inputs": [
{
"id": "github_pat",
"description": "GitHub personal access token",
"type": "promptString",
"password": true
}
]
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove `Newtonsoft.Json` NuGet dependency #725 [@xperiandri]
- Add missing rule checks for FL0079-FL0081 #713 [@BennieCopeland]
- Modify `.gitignore` to the Visual Studio standard one #735 [@xperiandri]
- Add basic Copilot instructions and GitHub MCP #726 [@xperiandri]

## [0.24.2] - 2024-02-29

Expand Down
Loading