Skip to content
Open
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
2 changes: 2 additions & 0 deletions docs/release-notes/.VisualStudio/18.vNext.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### Added

* **Extract to let binding** and **Extract to literal** refactorings for a selected expression. The value is bound in front of the statement that uses it, so it is computed before the code that preceded the selection in that statement; a constant in a module-level declaration becomes a `[<Literal>]` in front of that declaration, also with just the caret inside the constant. ([PR #20537](https://github.com/dotnet/fsharp/pull/20537))
* Code-fixes for FS3888 (compiler-semantic attribute on the `.fs` but not the `.fsi`): copy the attribute into the `.fsi`, or remove it from the `.fs`. ([Issue #19560](https://github.com/dotnet/fsharp/issues/19560), [PR #19880](https://github.com/dotnet/fsharp/pull/19880))
* **Extract to local function**, **Extract to module function** and **Extract to private member** refactorings for a selected expression. Values the selection reads from the enclosing function, member or lambda become parameters in the order they are first used, typed as the new **Parameter types in Extract to function** option under **Code Fixes** asks. A selection that assigns to a captured mutable local, or reads a byref or byref-like value from outside, is not offered. ([Issue #14449](https://github.com/dotnet/fsharp/issues/14449), [PR #20538](https://github.com/dotnet/fsharp/pull/20538))
* Expand `<inheritdoc/>` in IDE tooltips, completion, and signature help, inheriting XML documentation from base classes, interfaces, overridden members, and constructors. ([Issue #19175](https://github.com/dotnet/fsharp/issues/19175), [PR #19188](https://github.com/dotnet/fsharp/pull/19188))

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@
<Compile Include="Commands\HelpContextService.fs" />
<Compile Include="Commands\FsiCommandService.fs" />
<Compile Include="Commands\XmlDocCommandService.fs" />
<Compile Include="Refactor\RefactoringHelpers.fs" />
<Compile Include="Refactor\AddReturnType.fs" />
<Compile Include="Refactor\ChangeTypeofWithNameToNameofExpression.fs" />
<Compile Include="Refactor\AddExplicitTypeToParameter.fs" />
<Compile Include="Refactor\ChangeDerefToValueRefactoring.fs" />
<Compile Include="Refactor\ExtractLetBinding.fs" />
<Compile Include="Refactor\ExtractFunction.fs" />
<Compile Include="CodeFixes\IFSharpCodeFix.fs" />
<Compile Include="CodeFixes\CodeFixHelpers.fs" />
<Compile Include="CodeFixes\ChangeEqualsInFieldTypeToColon.fs" />
Expand Down
15 changes: 15 additions & 0 deletions vsintegration/src/FSharp.Editor/FSharp.Editor.resx
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,19 @@ Use live (unsaved) buffers for analysis</value>
<data name="ReturnsHeader" xml:space="preserve">
<value>Returns:</value>
</data>
<data name="ExtractToLetBinding" xml:space="preserve">
<value>Extract to let binding</value>
</data>
<data name="ExtractToLiteral" xml:space="preserve">
<value>Extract to literal</value>
</data>
<data name="ExtractToLocalFunction" xml:space="preserve">
<value>Extract to local function</value>
</data>
<data name="ExtractToModuleFunction" xml:space="preserve">
<value>Extract to module function</value>
</data>
<data name="ExtractToPrivateMember" xml:space="preserve">
<value>Extract to private member</value>
</data>
</root>
20 changes: 19 additions & 1 deletion vsintegration/src/FSharp.Editor/Options/EditorOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ type EnterKeySetting =
| NewlineOnCompleteWord
| AlwaysNewline

[<RequireQualifiedAccess>]
type ParameterAnnotationSetting =
| Always
| WhenNeeded
| Never

// CLIMutable to make the record work also as a view model
[<CLIMutable>]
type IntelliSenseOptions =
Expand Down Expand Up @@ -68,6 +74,7 @@ type CodeFixesOptions =
UnusedDeclarations: bool
SuggestNamesForErrors: bool
RemoveParens: bool
ExtractFunctionParameterAnnotations: ParameterAnnotationSetting
}

static member Default =
Expand All @@ -79,6 +86,7 @@ type CodeFixesOptions =
UnusedDeclarations = true
SuggestNamesForErrors = true
RemoveParens = false
ExtractFunctionParameterAnnotations = ParameterAnnotationSetting.Always
}

[<CLIMutable>]
Expand Down Expand Up @@ -213,7 +221,14 @@ module internal OptionsUI =
[<Guid(Guids.codeFixesOptionPageIdString)>]
type internal CodeFixesOptionPage() =
inherit AbstractOptionPage<CodeFixesOptions>()
override this.CreateView() = upcast CodeFixesOptionControl()

override this.CreateView() =
let view = CodeFixesOptionControl()
let path = nameof CodeFixesOptions.Default.ExtractFunctionParameterAnnotations
bindRadioButton view.annotateAlways path ParameterAnnotationSetting.Always
bindRadioButton view.annotateWhenNeeded path ParameterAnnotationSetting.WhenNeeded
bindRadioButton view.annotateNever path ParameterAnnotationSetting.Never
upcast view

[<Guid(Guids.languageServicePerformanceOptionPageIdString)>]
type internal LanguageServicePerformanceOptionPage() =
Expand Down Expand Up @@ -263,6 +278,9 @@ module EditorOptionsExtensions =

member this.IsFsharpRemoveParensEnabled = this.EditorOptions.CodeFixes.RemoveParens

member this.FSharpExtractFunctionParameterAnnotations =
this.EditorOptions.CodeFixes.ExtractFunctionParameterAnnotations

member this.IsFSharpCodeFixesSuggestNamesForErrorsEnabled =
this.EditorOptions.CodeFixes.SuggestNamesForErrors

Expand Down
Loading
Loading