diff --git a/.gitignore b/.gitignore index f542344247..149cc340d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ **/.DS_Store NuGet.Config -.gradle/ \ No newline at end of file +.gradle/ +.idea diff --git a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug_Offline__Unix_.xml b/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug_Offline__Unix_.xml deleted file mode 100644 index 64b7463d12..0000000000 --- a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug_Offline__Unix_.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - \ No newline at end of file diff --git a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug_Offline__Win_.xml b/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug_Offline__Win_.xml deleted file mode 100644 index 4a55da7e01..0000000000 --- a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug_Offline__Win_.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - \ No newline at end of file diff --git a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug__Unix_.xml b/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug__Unix_.xml deleted file mode 100644 index f0a9fad1a8..0000000000 --- a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug__Unix_.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - diff --git a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug__Win_.xml b/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug__Win_.xml deleted file mode 100644 index 91568b7160..0000000000 --- a/ReSharper.FSharp/.idea/.idea.ReSharper.FSharp/.idea/runConfigurations/Rider_Debug__Win_.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - \ No newline at end of file diff --git a/ReSharper.FSharp/ReSharper.FSharp.sln.DotSettings b/ReSharper.FSharp/ReSharper.FSharp.sln.DotSettings index fee42e7a0a..e9eecfceca 100644 --- a/ReSharper.FSharp/ReSharper.FSharp.sln.DotSettings +++ b/ReSharper.FSharp/ReSharper.FSharp.sln.DotSettings @@ -1,6 +1,9 @@  <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy> <Policy Inspect="True" Prefix="my" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="my" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy></Policy> + True False 2 diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/FcsErrorsStageProcessBase.fs b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/FcsErrorsStageProcessBase.fs index 0204e17f33..39a1ff2066 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/FcsErrorsStageProcessBase.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/FcsErrorsStageProcessBase.fs @@ -98,6 +98,8 @@ module FSharpErrors = let [] SingleQuoteInSingleQuote = 3373 let [] XmlDocSignatureCheckFailed = 3390 let [] InvalidXmlDocPosition = 3520 + let [] ConstructDeprecatedSequenceExpressionsInvalidForm = 3873 + let [] InvalidRecordSequenceOrComputationExpression = 740 let isDirectiveSyntaxError number = number >= 232 && number <= 235 @@ -526,6 +528,12 @@ type FcsErrorsStageProcessBase(fsFile, daemonProcess) = | UnionCaseDoesNotTakeArguments -> createHighlightingFromNode UnionCaseDoesNotTakeArgumentsError range + | InvalidRecordSequenceOrComputationExpression -> + createHighlightingFromNode InvalidRecordSequenceOrComputationExpressionError range + + | ConstructDeprecatedSequenceExpressionsInvalidForm -> + createHighlightingFromNode ConstructDeprecatedSequenceExpressionsInvalidFormError range + | UnionCaseExpectsTupledArguments -> createHighlightingFromNodeWithMessage UnionCaseExpectsTupledArgumentsError range error diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/FSharp.Psi.Intentions.fsproj b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/FSharp.Psi.Intentions.fsproj index bcce22fda4..ebdcc0230e 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/FSharp.Psi.Intentions.fsproj +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/FSharp.Psi.Intentions.fsproj @@ -119,6 +119,7 @@ + diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/src/QuickFixes/AddMissingSeqFix.fs b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/src/QuickFixes/AddMissingSeqFix.fs new file mode 100644 index 0000000000..406094ec82 --- /dev/null +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/src/QuickFixes/AddMissingSeqFix.fs @@ -0,0 +1,34 @@ +namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.QuickFixes + +open JetBrains.ReSharper.Plugins.FSharp.Psi +open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.Highlightings +open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.QuickFixes +open JetBrains.ReSharper.Plugins.FSharp.Psi.Tree +open JetBrains.ReSharper.Psi.ExtensionsAPI +open JetBrains.ReSharper.Resources.Shell +open JetBrains.ReSharper.Psi.ExtensionsAPI.Tree + +type AddMissingSeqFix(expr: IComputationExpr) = + inherit FSharpQuickFixBase() + + new(error: ConstructDeprecatedSequenceExpressionsInvalidFormError) = + AddMissingSeqFix(error.ComputationExpr) + + new(error: InvalidRecordSequenceOrComputationExpressionError) = + AddMissingSeqFix(error.ComputationExpr) + + override x.Text = "Add missing 'seq'" + + override x.IsAvailable _ = + isValid expr + + override x.ExecutePsiTransaction _ = + use writeCookie = WriteLockCookie.Create(expr.IsPhysical()) + use disableFormatter = new DisableCodeFormatter() + + let factory = expr.Expression.CreateElementFactory() + let seqExpr = factory.CreateExpr("seq") + let newAppExpr = factory.CreateAppExpr(seqExpr, expr, true) + + ModificationUtil.ReplaceChild(expr, newAppExpr) |> ignore + diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.Designer.fs b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.Designer.fs index 8c9b0e6d07..3f47d81383 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.Designer.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.Designer.fs @@ -123,6 +123,8 @@ type public Strings() = static member ThisLiteralPatternDoesNotTakeArgumentsMessage = Strings.ResourceManager.GetString("ThisLiteralPatternDoesNotTakeArgumentsMessage") static member ThisRuleWillNeverBeMatchedMessage = Strings.ResourceManager.GetString("ThisRuleWillNeverBeMatchedMessage") static member ThisUnionCaseDoesNotTakeArgumentsMessage = Strings.ResourceManager.GetString("ThisUnionCaseDoesNotTakeArgumentsMessage") + static member InvalidRecordSequenceOrComputationExpressionMessage = Strings.ResourceManager.GetString("InvalidRecordSequenceOrComputationExpressionMessage") + static member ConstructDeprecatedSequenceExpressionInvalidFormMessage = Strings.ResourceManager.GetString("ConstructDeprecatedSequenceExpressionInvalidFormMessage") static member TypeAbbreviationsCannotHaveAugmentationsMessage = Strings.ResourceManager.GetString("TypeAbbreviationsCannotHaveAugmentationsMessage") static member UnknownParameterNameMessage = Strings.ResourceManager.GetString("UnknownParameterNameMessage") static member UpcastIsUnnecessaryMessage = Strings.ResourceManager.GetString("UpcastIsUnnecessaryMessage") diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.resx b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.resx index 6cd5664657..a204125f04 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.resx +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/Resources/Strings.resx @@ -271,6 +271,12 @@ This union case does not take arguments + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }' + + + This construct is deprecated. Sequence expressions should be of the form 'seq { ... }' + Type abbreviations cannot have augmentations diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/src/Daemon/Highlightings/FcsErrors.xml b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/src/Daemon/Highlightings/FcsErrors.xml index fc02e7950e..bad32b8c61 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/src/Daemon/Highlightings/FcsErrors.xml +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Services/src/Daemon/Highlightings/FcsErrors.xml @@ -748,6 +748,22 @@ RemovePatternArgumentFix + + + + computationExpr.GetHighlightingRange() + + AddMissingSeqFix + + + + + + computationExpr.GetHighlightingRange() + + AddMissingSeqFix + + diff --git "a/ReSharper.FSharp/test/data/features/quickFixes/addMissingSeqFix/FS0740 \342\200\224 Adds missing seq before { x; y }.fs" "b/ReSharper.FSharp/test/data/features/quickFixes/addMissingSeqFix/FS0740 \342\200\224 Adds missing seq before { x; y }.fs" new file mode 100644 index 0000000000..94c2cda3a3 --- /dev/null +++ "b/ReSharper.FSharp/test/data/features/quickFixes/addMissingSeqFix/FS0740 \342\200\224 Adds missing seq before { x; y }.fs" @@ -0,0 +1 @@ +{caret}{ 1;10 } diff --git a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/FSharp.Intentions.Tests.fsproj b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/FSharp.Intentions.Tests.fsproj index 7572bfe6e7..abb4415c2b 100644 --- a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/FSharp.Intentions.Tests.fsproj +++ b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/FSharp.Intentions.Tests.fsproj @@ -129,6 +129,7 @@ + diff --git a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/QuickFixes/AddMissingSeqFixTest.fs b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/QuickFixes/AddMissingSeqFixTest.fs new file mode 100644 index 0000000000..5b9f068b62 --- /dev/null +++ b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/QuickFixes/AddMissingSeqFixTest.fs @@ -0,0 +1,13 @@ +namespace JetBrains.ReSharper.Plugins.FSharp.Tests.Intentions.QuickFixes + +open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.QuickFixes +open JetBrains.ReSharper.Plugins.FSharp.Tests +open NUnit.Framework + +[] +type AddMissingSeqFixTest() = + inherit FSharpQuickFixTestBase() + + override x.RelativeTestDataPath = "features/quickFixes/addMissingSeqFix" + + [] member x.``FS0740 — Adds missing seq before { x; y }`` () = x.DoNamedTest() diff --git a/rider-fsharp/.idea/dictionaries/Mikhail_Filippov.xml b/rider-fsharp/.idea/dictionaries/Mikhail_Filippov.xml deleted file mode 100644 index f81e2f413a..0000000000 --- a/rider-fsharp/.idea/dictionaries/Mikhail_Filippov.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - drider - fantomas - filippov - netcoreapp - pashchenko - rdgen - runtimeconfig - shakhov - tploader - - - \ No newline at end of file diff --git a/rider-fsharp/.idea/dictionaries/mfilippov.xml b/rider-fsharp/.idea/dictionaries/mfilippov.xml deleted file mode 100644 index 077d11bc41..0000000000 --- a/rider-fsharp/.idea/dictionaries/mfilippov.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - pregenerated - - - \ No newline at end of file diff --git a/rider-fsharp/.idea/icon.png b/rider-fsharp/.idea/icon.png deleted file mode 100644 index b27e0b125a..0000000000 Binary files a/rider-fsharp/.idea/icon.png and /dev/null differ diff --git a/rider-fsharp/.idea/icon_dark.png b/rider-fsharp/.idea/icon_dark.png deleted file mode 100644 index b27e0b125a..0000000000 Binary files a/rider-fsharp/.idea/icon_dark.png and /dev/null differ