-
Notifications
You must be signed in to change notification settings - Fork 55
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
Split function annotation into argument and return type annotations #202
Open
mcon
wants to merge
8
commits into
JetBrains:net211
Choose a base branch
from
mcon:split-function-annotation
base: net211
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cbd9769
Add project icon (#155)
kirillgla 1a7a906
Merge branch 'net203' of https://github.com/JetBrains/fsharp-support …
mcon fb0e016
Merge branch 'net203' of https://github.com/JetBrains/fsharp-support …
mcon 55802db
Split function annotation into argument annotation and return type an…
mcon 373b3d6
Prevent DotSettings.user files from being accidentally committed.
mcon a52b629
Merge remote-tracking branch 'origin/net211' into split-function-anno…
mcon fc91573
Oops, missed bracket
mcon 2c5813d
Help string change
mcon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/.DS_Store | ||
NuGet.Config | ||
.gradle/ | ||
.gradle/ | ||
ReSharper.Fsharp.sln.DotSettings.user |
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
21 changes: 21 additions & 0 deletions
21
...er.FSharp/src/FSharp.Psi.Features/src/Intentions/FunctionArgumentTypesAnnotationAction.fs
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,21 @@ | ||
namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Intentions | ||
|
||
open JetBrains.ReSharper.Feature.Services.ContextActions | ||
open JetBrains.ReSharper.Plugins.FSharp.Psi.Impl | ||
open JetBrains.ReSharper.Plugins.FSharp.Psi.Tree | ||
|
||
[<ContextAction(Name = "AnnotateFunctionArgumentTypes", Group = "F#", | ||
Description = "Annotate function with argument types")>] | ||
type FunctionArgumentTypesAnnotationAction(dataProvider: FSharpContextActionDataProvider) = | ||
inherit SpecifyTypes.FunctionAnnotationActionBase(dataProvider) | ||
|
||
override this.IsAnnotated (binding: IBinding) = | ||
match binding.HeadPattern with | ||
| :? IParametersOwnerPat as parametersOwner -> | ||
parametersOwner.ParametersEnumerable |> Seq.forall (fun pat -> pat.IgnoreInnerParens() :? ITypedPat) | ||
| _ -> true | ||
|
||
override this.Text = "Add argument type annotations" | ||
override this.ApplyFunctionAnnotation parametersOwner binding mfv displayContext = | ||
if isNotNull parametersOwner then | ||
SpecifyTypes.specifyArgumentTypes parametersOwner binding mfv displayContext |
16 changes: 16 additions & 0 deletions
16
...arper.FSharp/src/FSharp.Psi.Features/src/Intentions/FunctionReturnTypeAnnotationAction.fs
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,16 @@ | ||
namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Intentions | ||
|
||
open JetBrains.ReSharper.Feature.Services.ContextActions | ||
open JetBrains.ReSharper.Plugins.FSharp.Psi.Tree | ||
|
||
[<ContextAction(Name = "AnnotateFunctionReturnType", Group = "F#", | ||
Description = "Annotate function with return type")>] | ||
type FunctionReturnTypeAnnotationAction(dataProvider: FSharpContextActionDataProvider) = | ||
inherit SpecifyTypes.FunctionAnnotationActionBase(dataProvider) | ||
|
||
override this.IsAnnotated (binding: IBinding) = isNotNull binding.ReturnTypeInfo | ||
|
||
override x.Text = "Add return type annotation" | ||
override this.ApplyFunctionAnnotation _parametersOwner binding mfv displayContext = | ||
if isNull binding.ReturnTypeInfo then | ||
SpecifyTypes.specifyBindingReturnType binding mfv displayContext |
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
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...t/data/features/intentions/specifyArgumentTypes/Function - Formatting - Add space.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let f{caret} (a : string) (b : int) = sprintf "%s %d" a b |
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...per.FSharp/test/data/features/intentions/specifyArgumentTypes/Function - Local 01.fs.gold
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,5 @@ | ||
module Module | ||
|
||
do | ||
let f{caret} (a: string) (b: int) = sprintf "%s %d" a b | ||
() |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...atures/intentions/specifyArgumentTypes/Function - Parameters - Pattern 01 - Tuple.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} ((a, b): int * int) = | ||
a + b |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...eatures/intentions/specifyArgumentTypes/Function - Parameters - Pattern 02 - Wild.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} (_: 'a) = | ||
() |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...eatures/intentions/specifyArgumentTypes/Function - Parameters - Pattern 03 - List.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} ([]: 'a list) = | ||
() |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
.../features/intentions/specifyArgumentTypes/Function - Parameters - Pattern 04 - As.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} (a as b: int) = | ||
a + b |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
.../intentions/specifyArgumentTypes/Function - Parameters - Pattern 05 - Param owner.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} (Some 123: int option) = | ||
() |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...t/data/features/intentions/specifyArgumentTypes/Function - Parameters 01 - Parens.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let f{caret} (a: string) (b: int) = sprintf "%s %d" a b |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...on - Parameters 04 - Nested tuple.fs.gold → ...on - Parameters 04 - Nested tuple.fs.gold
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Module | ||
|
||
let f{caret} (a: string) (b: int * ('a * string)): string = | ||
let f{caret} (a: string) (b: int * ('a * string)) = | ||
let b1, (_, b3) = b | ||
sprintf "%s %d %s" a b1 b3 |
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...FSharp/test/data/features/intentions/specifyArgumentTypes/Function 01 - Recursive.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let rec f{caret} (a: string) = a + "" |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...rp/test/data/features/intentions/specifyArgumentTypes/Function 02 - Generic types.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} (a: seq<string>) = | ||
String.concat ", " a |
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...harp/test/data/features/intentions/specifyArgumentTypes/Function 04 - Generalized.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let f{caret} (a: 'a) (b: 'b) = a, b |
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
...test/data/features/intentions/specifyArgumentTypes/availability/Let bindings - Expr 01.fs
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,12 @@ | ||
do | ||
{off} | ||
|
||
let x{off} = 1 | ||
let{off} x{off}: int = 1 | ||
|
||
let{off} (x{off}: int): int = 1 | ||
let{off} ((x{off}: int)): int = 1 | ||
let{off} ((x{off}: string)): int = 1 | ||
|
||
let{on} foo{on} {off}x {off}= {off}() | ||
(){off} |
12 changes: 12 additions & 0 deletions
12
...st/data/features/intentions/specifyArgumentTypes/availability/Let bindings - Module 01.fs
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,12 @@ | ||
module Module | ||
|
||
{off} | ||
|
||
let x1{off} = 1 | ||
let{off} x2{off}: int = 1 | ||
|
||
let{off} (x3{off}: int): int = 1 | ||
let{off} ((x4{off}: int)): int = 1 | ||
|
||
{off}[<CompiledName{off}("Foo")>]{off} | ||
let{on} foo{on} {off}x {off}= {off}() |
3 changes: 3 additions & 0 deletions
3
...arp/test/data/features/intentions/specifyReturnTypes/Function - Formatting - Add space.fs
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,3 @@ | ||
module Module | ||
|
||
let f{caret} (a) b = sprintf "%s %d" a b |
3 changes: 3 additions & 0 deletions
3
...est/data/features/intentions/specifyReturnTypes/Function - Formatting - Add space.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let f{caret} (a) b : string = sprintf "%s %d" a b |
5 changes: 5 additions & 0 deletions
5
ReSharper.FSharp/test/data/features/intentions/specifyReturnTypes/Function - Local 01.fs
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,5 @@ | ||
module Module | ||
|
||
do | ||
let f{caret} (a: string) b = sprintf "%s %d" a b | ||
() |
5 changes: 5 additions & 0 deletions
5
...arper.FSharp/test/data/features/intentions/specifyReturnTypes/Function - Local 01.fs.gold
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,5 @@ | ||
module Module | ||
|
||
do | ||
let f{caret} (a: string) b: string = sprintf "%s %d" a b | ||
() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
ReSharper.FSharp/test/data/features/intentions/specifyReturnTypes/Function 02 - Recursive.fs
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,3 @@ | ||
module Module | ||
|
||
let rec f{caret} a = a + "" |
3 changes: 3 additions & 0 deletions
3
...r.FSharp/test/data/features/intentions/specifyReturnTypes/Function 02 - Recursive.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let rec f{caret} a: string = a + "" |
4 changes: 4 additions & 0 deletions
4
...er.FSharp/test/data/features/intentions/specifyReturnTypes/Function 03 - Generic types.fs
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,4 @@ | ||
module Module | ||
|
||
let f{caret} a = | ||
String.concat ", " a |
2 changes: 1 addition & 1 deletion
2
...Types/Function 03 - Generic types.fs.gold → ...Types/Function 03 - Generic types.fs.gold
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Module | ||
|
||
let f{caret} (a: seq<string>): string = | ||
let f{caret} a: string = | ||
String.concat ", " a |
3 changes: 3 additions & 0 deletions
3
...rper.FSharp/test/data/features/intentions/specifyReturnTypes/Function 04 - Generalized.fs
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,3 @@ | ||
module Module | ||
|
||
let f{caret} a b = a, b |
3 changes: 3 additions & 0 deletions
3
...FSharp/test/data/features/intentions/specifyReturnTypes/Function 04 - Generalized.fs.gold
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,3 @@ | ||
module Module | ||
|
||
let f{caret} a b: 'a * 'b = a, b |
4 changes: 4 additions & 0 deletions
4
...arper.FSharp/test/data/features/intentions/specifyReturnTypes/Function 04 - Tuple.fs.gold
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,4 @@ | ||
module Module | ||
|
||
let f{caret} (a: string * seq<string>): string = | ||
a ||> String.concat |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...harp/test/data/features/intentions/specifyReturnTypes/availability/Class - member - 01.fs
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,5 @@ | ||
module Module | ||
|
||
type NumberPrinter(num) = | ||
// Class members aren't supported yet | ||
member x.print{off}() = sprintf{off} "%d" num |
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions
3
...harp/test/data/features/intentions/specifyTypes/Function - Formatting - Add space.fs.gold
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
ReSharper.FSharp/test/data/features/intentions/specifyTypes/Function - Local 01.fs.gold
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
.../data/features/intentions/specifyTypes/Function - Parameters - Pattern 01 - Tuple.fs.gold
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters.