未验证 提交 1ddfdc78 编写于 作者: K Kevin Ransom (msft) 提交者: GitHub

Merge branch 'release/dev17.3' into merges/main-to-release/dev17.3

......@@ -530,8 +530,8 @@ stages:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng/release/insert-into-vs.yml
parameters:
componentBranchName: refs/heads/release/dev17.0
insertTargetBranch: rel/d17.0
componentBranchName: refs/heads/release/dev17.3
insertTargetBranch: main
insertTeamEmail: fsharpteam@microsoft.com
insertTeamName: 'F#'
completeInsertion: 'auto'
......@@ -15,7 +15,7 @@
<!-- F# Version components -->
<FSMajorVersion>6</FSMajorVersion>
<FSMinorVersion>0</FSMinorVersion>
<FSBuildVersion>1</FSBuildVersion>
<FSBuildVersion>4</FSBuildVersion>
<FSRevisionVersion>0</FSRevisionVersion>
<!-- -->
<!-- F# Language version -->
......@@ -32,14 +32,14 @@
<!-- FSharp.Compiler.Service version -->
<FCSMajorVersion>41</FCSMajorVersion>
<FCSMinorVersion>0</FCSMinorVersion>
<FCSBuildVersion>1</FCSBuildVersion>
<FCSBuildVersion>4</FCSBuildVersion>
<FCSRevisionVersion>$(FSRevisionVersion)</FCSRevisionVersion>
<FSharpCompilerServicePackageVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion)</FSharpCompilerServicePackageVersion>
<FSharpCompilerServiceVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion)</FSharpCompilerServiceVersion>
<FSharpCompilerServiceReleaseNotesVersion>$(FCSMajorVersion)$(FCSMinorVersion)$(FCSBuildVersion)</FSharpCompilerServiceReleaseNotesVersion>
<!-- -->
<!-- The current published nuget package -->
<FSharpCoreShippedPackageVersionValue>6.0.1</FSharpCoreShippedPackageVersionValue>
<FSharpCoreShippedPackageVersionValue>6.0.3</FSharpCoreShippedPackageVersionValue>
<!-- -->
<!-- The pattern for specifying the preview package -->
<FSharpCorePreviewPackageVersionValue>$(FSCorePackageVersionValue)-$(PreReleaseVersionLabel).*</FSharpCorePreviewPackageVersionValue>
......@@ -47,7 +47,7 @@
<!-- FSharp tools for Visual Studio version number -->
<FSToolsMajorVersion>12</FSToolsMajorVersion>
<FSToolsMinorVersion>0</FSToolsMinorVersion>
<FSToolsBuildVersion>0</FSToolsBuildVersion>
<FSToolsBuildVersion>3</FSToolsBuildVersion>
<FSToolsRevisionVersion>$(FSRevisionVersion)</FSToolsRevisionVersion>
<FSProductVersionPrefix>$(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion)</FSProductVersionPrefix>
<FSProductVersionReleaseNotesVersion>$(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion)</FSProductVersionReleaseNotesVersion>
......@@ -55,7 +55,7 @@
</PropertyGroup>
<PropertyGroup>
<VSMajorVersion>17</VSMajorVersion>
<VSMinorVersion>0</VSMinorVersion>
<VSMinorVersion>1</VSMinorVersion>
<VSGeneralVersion>$(VSMajorVersion).0</VSGeneralVersion>
<VSAssemblyVersionPrefix>$(VSMajorVersion).$(VSMinorVersion).0</VSAssemblyVersionPrefix>
<VSAssemblyVersion>$(VSAssemblyVersionPrefix).0</VSAssemblyVersion>
......@@ -113,8 +113,8 @@
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
<!-- VisualStudio package versions -->
<VisualStudioImplementationPackagesVersion>17.0.391-preview-g5e248c9073</VisualStudioImplementationPackagesVersion>
<VisualStudioContractPackagesVersion>17.0.0-previews-4-31709-430</VisualStudioContractPackagesVersion>
<VisualStudioImplementationPackagesVersion>17.0.487</VisualStudioImplementationPackagesVersion>
<VisualStudioContractPackagesVersion>17.0.31723.112</VisualStudioContractPackagesVersion>
<VisualStudioProjectSystemPackagesVersion>17.0.77-pre-g62a6cb5699</VisualStudioProjectSystemPackagesVersion>
<MicrosoftVisualStudioInteropVersion>$(VisualStudioContractPackagesVersion)</MicrosoftVisualStudioInteropVersion>
<MicrosoftInternalVisualStudioInteropVersion>$(VisualStudioContractPackagesVersion)</MicrosoftInternalVisualStudioInteropVersion>
......@@ -135,7 +135,7 @@
<EnvDTEVersion>$(VisualStudioContractPackagesVersion)</EnvDTEVersion>
<EnvDTE80Version>$(VisualStudioContractPackagesVersion)</EnvDTE80Version>
<!-- Roslyn packages -->
<RoslynVersion>4.1.0-1.21511.14</RoslynVersion>
<RoslynVersion>4.2.0-3.22154.1</RoslynVersion>
<MicrosoftCodeAnalysisEditorFeaturesVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesTextVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesWpfVersion>
......@@ -169,7 +169,7 @@
<MicrosoftVisualStudioShellFrameworkVersion>$(VisualStudioContractPackagesVersion)</MicrosoftVisualStudioShellFrameworkVersion>
<MicrosoftVisualStudioPackageLanguageService150Version>$(VisualStudioContractPackagesVersion)</MicrosoftVisualStudioPackageLanguageService150Version>
<!-- Misc. Visual Studio packages -->
<MicrosoftVisualStudioRpcContractsVersion>17.0.50-preview-0002-0025</MicrosoftVisualStudioRpcContractsVersion>
<MicrosoftVisualStudioRpcContractsVersion>17.0.51</MicrosoftVisualStudioRpcContractsVersion>
<MicrosoftVisualStudioComponentModelHostVersion>$(VisualStudioImplementationPackagesVersion)</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualFSharpMicrosoftVisualStudioShellUIInternalVersion>17.0.0</MicrosoftVisualFSharpMicrosoftVisualStudioShellUIInternalVersion>
<MicrosoftVisualStudioDesignerInterfacesVersion>$(VisualStudioContractPackagesVersion)</MicrosoftVisualStudioDesignerInterfacesVersion>
......@@ -185,9 +185,9 @@
<MicrosoftVisualStudioShellImmutable150Version>15.0.25123-Dev15Preview</MicrosoftVisualStudioShellImmutable150Version>
<MicrosoftVisualStudioShellInterop160DesignTimeVersion>16.0.1</MicrosoftVisualStudioShellInterop160DesignTimeVersion>
<MicrosoftVisualStudioShellInterop16DesignTimeVersion>16.0.28924.11111</MicrosoftVisualStudioShellInterop16DesignTimeVersion>
<MicrosoftVisualStudioThreadingVersion>17.0.46-alpha</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioThreadingVersion>17.0.64</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioUtilitiesVersion>$(VisualStudioContractPackagesVersion)</MicrosoftVisualStudioUtilitiesVersion>
<MicrosoftVisualStudioValidationVersion>17.0.23-alpha</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioValidationVersion>17.0.28</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioWCFReferenceInteropVersion>9.0.30729</MicrosoftVisualStudioWCFReferenceInteropVersion>
<VSSDKDebuggerVisualizersVersion>12.0.4</VSSDKDebuggerVisualizersVersion>
<VSSDKVSLangProjVersion>7.0.4</VSSDKVSLangProjVersion>
......@@ -212,10 +212,11 @@
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
<NUnitVersion>3.13.2</NUnitVersion>
<NUnit3TestAdapterVersion>4.1.0</NUnit3TestAdapterVersion>
<NUnitLiteVersion>3.11.0</NUnitLiteVersion>
<NunitXmlTestLoggerVersion>2.1.80</NunitXmlTestLoggerVersion>
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
<StreamJsonRpcVersion>2.8.21</StreamJsonRpcVersion>
<NerdbankStreamsVersion>2.7.74</NerdbankStreamsVersion>
<StreamJsonRpcVersion>2.11.14-alpha</StreamJsonRpcVersion>
<NerdbankStreamsVersion>2.8.57</NerdbankStreamsVersion>
<XUnitVersion>2.4.1</XUnitVersion>
<XUnitRunnerVersion>2.4.2</XUnitRunnerVersion>
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
......
......@@ -23,6 +23,12 @@
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
<!-- 3390: xmlDocBadlyFormed -->
<OtherFlags>$(OtherFlags) --warnon:3390</OtherFlags>
<!-- 1182: Unused variables -->
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
<!-- 3390: xmlDocBadlyFormed -->
<OtherFlags>$(OtherFlags) --warnon:3390</OtherFlags>
<!-- 3520: invalidXmlDocPosition -->
<OtherFlags>$(OtherFlags) --warnon:3520</OtherFlags>
<!-- Turn off 57: Use of construct with Experimental attribute -->
<OtherFlags>$(OtherFlags) --nowarn:57</OtherFlags>
<!-- Turn off 3511: state machine not compilable - expected for inlined functions defining state machine generators -->
......
......@@ -1007,7 +1007,6 @@ namespace Microsoft.FSharp.Core
/// <see cref="T:System.IntPtr"/>.</summary>
///
/// <category>Basic Types with Units of Measure</category>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
[<MeasureAnnotatedAbbreviation>]
type nativeint<[<Measure>] 'Measure> = nativeint
......@@ -1017,7 +1016,6 @@ namespace Microsoft.FSharp.Core
/// <see cref="T:System.UInt32"/>.</summary>
///
/// <category>Basic Types with Units of Measure</category>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
[<MeasureAnnotatedAbbreviation>]
type uint<[<Measure>] 'Measure> = uint
......@@ -1027,40 +1025,36 @@ namespace Microsoft.FSharp.Core
/// <see cref="T:System.Byte"/>.</summary>
///
/// <category>Basic Types with Units of Measure</category>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
[<MeasureAnnotatedAbbreviation>]
type byte<[<Measure>] 'Measure> = byte
/// <summary>The type of 16-bit unsigned integer numbers, annotated with a unit of measure.
/// The unit of measure is erased in compiled code and when values of this type
/// are analyzed using reflection. The type is representationally equivalent to
/// <see cref="T:System.UInt16"/>.</summary>
///
/// <category>Basic Types with Units of Measure</category>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
[<MeasureAnnotatedAbbreviation>]
type uint16<[<Measure>] 'Measure> = uint16
/// <summary>The type of 64-bit unsigned integer numbers, annotated with a unit of measure.
/// The unit of measure is erased in compiled code and when values of this type
/// are analyzed using reflection. The type is representationally equivalent to
/// <see cref="T:System.UInt64"/>.</summary>
///
/// <category>Basic Types with Units of Measure</category>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
[<MeasureAnnotatedAbbreviation>]
type uint64<[<Measure>] 'Measure> = uint64
/// <summary>The type of machine-sized unsigned integer numbers, annotated with a unit of measure.
/// The unit of measure is erased in compiled code and when values of this type
/// are analyzed using reflection. The type is representationally equivalent to
/// <see cref="T:System.UIntPtr"/>.</summary>
///
/// <category>Basic Types with Units of Measure</category>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
[<MeasureAnnotatedAbbreviation>]
type unativeint<[<Measure>] 'Measure> = unativeint
/// <summary>The type of double-precision floating point numbers, annotated with a unit of measure.
/// The unit of measure is erased in compiled code and when values of this type
/// are analyzed using reflection. The type is representationally equivalent to
......
......@@ -35,8 +35,10 @@ type PrintfFormat<'Printer,'State,'Residue,'Result> =
/// <summary>The raw text of the format string.</summary>
member Value : string
/// <summary>The captures associated with an interpolated string.</summary>
member Captures: obj[]
/// <summary>The capture types associated with an interpolated string.</summary>
member CaptureTypes: System.Type[]
/// <summary>Type of a formatting expression.</summary>
......
......@@ -22,7 +22,6 @@
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" />
......
......@@ -167,14 +167,17 @@ type internal FSharpEditorFormattingService
return textChanges |> Option.defaultValue Seq.empty |> toIList
}
interface IFSharpEditorFormattingService with
interface IFSharpEditorFormattingServiceWithOptions with
member val SupportsFormatDocument = false
member val SupportsFormatSelection = false
member val SupportsFormatOnPaste = true
member val SupportsFormatOnReturn = true
override _.SupportsFormattingOnTypedCharacter (document, ch) =
if FSharpIndentationService.IsSmartIndentEnabled document.Project.Solution.Workspace.Options then
override _.SupportsFormattingOnTypedCharacter (_document, _ch) =
false
override _.SupportsFormattingOnTypedCharacter (_document, options, ch) =
if options.IndentStyle = FormattingOptions.IndentStyle.Smart then
match ch with
| ')' | ']' | '}' -> true
| _ -> false
......
......@@ -23,9 +23,6 @@ type internal FSharpIndentationService
[<ImportingConstructor>]
() =
static member IsSmartIndentEnabled (options: Microsoft.CodeAnalysis.Options.OptionSet) =
options.GetOption(FormattingOptions.SmartIndent, FSharpConstants.FSharpLanguageName) = FormattingOptions.IndentStyle.Smart
static member IndentShouldFollow (documentId: DocumentId, sourceText: SourceText, filePath: string, position: int, parsingOptions: FSharpParsingOptions) =
let lastTokenOpt =
let defines = CompilerEnvironment.GetConditionalDefinesForEditing parsingOptions
......
......@@ -3,6 +3,8 @@
namespace Microsoft.VisualStudio.FSharp.Editor
open System
open System.Collections.Generic
open System.Collections.Immutable
open System.Composition
open System.Linq
open System.Threading
......@@ -20,54 +22,42 @@ open FSharp.Compiler.Text
open FSharp.Compiler.Tokenization
open Symbols
type internal FailureInlineRenameInfo private () =
interface IFSharpInlineRenameInfo with
member _.CanRename = false
member _.LocalizedErrorMessage = FSharpEditorFeaturesResources.You_cannot_rename_this_element
member _.TriggerSpan = Unchecked.defaultof<_>
member _.HasOverloads = false
member _.ForceRenameOverloads = true
member _.DisplayName = ""
member _.FullDisplayName = ""
member _.Glyph = Glyph.MethodPublic
member _.GetFinalSymbolName _ = ""
member _.GetReferenceEditSpan(_, _) = Unchecked.defaultof<_>
member _.GetConflictEditSpan(_, _, _) = Nullable()
member _.FindRenameLocationsAsync(_, _) = Task<IFSharpInlineRenameLocationSet>.FromResult null
member _.TryOnBeforeGlobalSymbolRenamed(_, _, _) = false
member _.TryOnAfterGlobalSymbolRenamed(_, _, _) = false
static member Instance = FailureInlineRenameInfo() :> IFSharpInlineRenameInfo
type internal InlineRenameReplacementInfo(newSolution: Solution, replacementTextValid: bool, documentIds: IEnumerable<DocumentId>) =
inherit FSharpInlineRenameReplacementInfo()
override _.NewSolution = newSolution
override _.ReplacementTextValid = replacementTextValid
override _.DocumentIds = documentIds
override _.GetReplacements _ = Seq.empty
type internal InlineRenameLocationSet(locations: FSharpInlineRenameLocation [], originalSolution: Solution, symbolKind: LexerSymbolKind, symbol: FSharpSymbol) =
interface IFSharpInlineRenameLocationSet with
member _.Locations = upcast locations.ToList()
member _.GetReplacementsAsync(replacementText, _optionSet, cancellationToken) : Task<IFSharpInlineRenameReplacementInfo> =
let rec applyChanges (solution: Solution) (locationsByDocument: (Document * FSharpInlineRenameLocation list) list) =
async {
match locationsByDocument with
| [] -> return solution
| (document, locations) :: rest ->
let! oldSource = document.GetTextAsync(cancellationToken) |> Async.AwaitTask
let newSource = oldSource.WithChanges(locations |> List.map (fun l -> TextChange(l.TextSpan, replacementText)))
return! applyChanges (solution.WithDocumentText(document.Id, newSource)) rest
}
inherit FSharpInlineRenameLocationSet()
override _.Locations = upcast locations.ToList()
override _.GetReplacementsAsync(replacementText, cancellationToken) : Task<FSharpInlineRenameReplacementInfo> =
let rec applyChanges (solution: Solution) (locationsByDocument: (Document * FSharpInlineRenameLocation list) list) =
async {
let! newSolution = applyChanges originalSolution (locations |> Array.toList |> List.groupBy (fun x -> x.Document))
let replacementText =
match symbolKind with
| LexerSymbolKind.GenericTypeParameter
| LexerSymbolKind.StaticallyResolvedTypeParameter -> replacementText
| _ -> FSharpKeywords.NormalizeIdentifierBackticks replacementText
return
{ new IFSharpInlineRenameReplacementInfo with
member _.NewSolution = newSolution
member _.ReplacementTextValid = Tokenizer.isValidNameForSymbol(symbolKind, symbol, replacementText)
member _.DocumentIds = locations |> Seq.map (fun doc -> doc.Document.Id) |> Seq.distinct
member _.GetReplacements _ = Seq.empty }
match locationsByDocument with
| [] -> return solution
| (document, locations) :: rest ->
let! oldSource = document.GetTextAsync(cancellationToken) |> Async.AwaitTask
let newSource = oldSource.WithChanges(locations |> List.map (fun l -> TextChange(l.TextSpan, replacementText)))
return! applyChanges (solution.WithDocumentText(document.Id, newSource)) rest
}
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)
async {
let! newSolution = applyChanges originalSolution (locations |> Array.toList |> List.groupBy (fun x -> x.Document))
let replacementText =
match symbolKind with
| LexerSymbolKind.GenericTypeParameter
| LexerSymbolKind.StaticallyResolvedTypeParameter -> replacementText
| _ -> FSharpKeywords.NormalizeIdentifierBackticks replacementText
let replacementTextValid = Tokenizer.isValidNameForSymbol(symbolKind, symbol, replacementText)
let documentIds = locations |> Seq.map (fun doc -> doc.Document.Id) |> Seq.distinct
return new InlineRenameReplacementInfo(newSolution, replacementTextValid, documentIds) :> FSharpInlineRenameReplacementInfo
}
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)
type internal InlineRenameInfo
(
......@@ -79,6 +69,8 @@ type internal InlineRenameInfo
checkFileResults: FSharpCheckFileResults
) =
inherit FSharpInlineRenameInfo()
let getDocumentText (document: Document) cancellationToken =
match document.TryGetText() with
| true, text -> text
......@@ -88,61 +80,60 @@ type internal InlineRenameInfo
SymbolHelpers.getSymbolUsesInSolution(symbolUse.Symbol, declLoc, checkFileResults, document.Project.Solution)
|> Async.cache
interface IFSharpInlineRenameInfo with
member _.CanRename = true
member _.LocalizedErrorMessage = null
member _.TriggerSpan = triggerSpan
member _.HasOverloads = false
member _.ForceRenameOverloads = false
member _.DisplayName = symbolUse.Symbol.DisplayName
member _.FullDisplayName = try symbolUse.Symbol.FullName with _ -> symbolUse.Symbol.DisplayName
member _.Glyph = Glyph.MethodPublic
member _.GetFinalSymbolName replacementText = replacementText
member _.GetReferenceEditSpan(location, cancellationToken) =
let text = getDocumentText location.Document cancellationToken
Tokenizer.fixupSpan(text, location.TextSpan)
override _.CanRename = true
override _.LocalizedErrorMessage = null
override _.TriggerSpan = triggerSpan
override _.HasOverloads = false
override _.ForceRenameOverloads = false
override _.DisplayName = symbolUse.Symbol.DisplayName
override _.FullDisplayName = try symbolUse.Symbol.FullName with _ -> symbolUse.Symbol.DisplayName
override _.Glyph = Glyph.MethodPublic
override _.GetFinalSymbolName replacementText = replacementText
override _.DefinitionLocations = ImmutableArray.Create(new FSharpInlineRenameLocation(document, triggerSpan))
override _.GetReferenceEditSpan(location, cancellationToken) =
let text = getDocumentText location.Document cancellationToken
Tokenizer.fixupSpan(text, location.TextSpan)
member _.GetConflictEditSpan(location, replacementText, cancellationToken) =
let text = getDocumentText location.Document cancellationToken
let spanText = text.ToString(location.TextSpan)
let position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal)
if position < 0 then Nullable()
else Nullable(TextSpan(location.TextSpan.Start + position, replacementText.Length))
override _.GetConflictEditSpan(location, replacementText, cancellationToken) =
let text = getDocumentText location.Document cancellationToken
let spanText = text.ToString(location.TextSpan)
let position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal)
if position < 0 then Nullable()
else Nullable(TextSpan(location.TextSpan.Start + position, replacementText.Length))
member _.FindRenameLocationsAsync(_optionSet, cancellationToken) =
async {
let! symbolUsesByDocumentId = symbolUses
let! locations =
symbolUsesByDocumentId
|> Seq.map (fun (KeyValue(documentId, symbolUses)) ->
async {
let document = document.Project.Solution.GetDocument(documentId)
let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask
return
[| for symbolUse in symbolUses do
match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse) with
| Some span ->
let textSpan = Tokenizer.fixupSpan(sourceText, span)
yield FSharpInlineRenameLocation(document, textSpan)
| None -> () |]
})
|> Async.Parallel
|> Async.map Array.concat
return InlineRenameLocationSet(locations, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> IFSharpInlineRenameLocationSet
} |> RoslynHelpers.StartAsyncAsTask(cancellationToken)
member _.TryOnBeforeGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = true
member _.TryOnAfterGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = true
[<Export(typeof<IFSharpEditorInlineRenameService>); Shared>]
override _.FindRenameLocationsAsync(_, _, cancellationToken) =
async {
let! symbolUsesByDocumentId = symbolUses
let! locations =
symbolUsesByDocumentId
|> Seq.map (fun (KeyValue(documentId, symbolUses)) ->
async {
let document = document.Project.Solution.GetDocument(documentId)
let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask
return
[| for symbolUse in symbolUses do
match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse) with
| Some span ->
let textSpan = Tokenizer.fixupSpan(sourceText, span)
yield FSharpInlineRenameLocation(document, textSpan)
| None -> () |]
})
|> Async.Parallel
|> Async.map Array.concat
return InlineRenameLocationSet(locations, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> FSharpInlineRenameLocationSet
} |> RoslynHelpers.StartAsyncAsTask(cancellationToken)
[<Export(typeof<FSharpInlineRenameServiceImplementation>); Shared>]
type internal InlineRenameService
[<ImportingConstructor>]
(
) =
static member GetInlineRenameInfo(document: Document, position: int) : Async<IFSharpInlineRenameInfo option> =
inherit FSharpInlineRenameServiceImplementation()
static member GetInlineRenameInfo(document: Document, position: int) : Async<FSharpInlineRenameInfo option> =
asyncMaybe {
let! ct = Async.CancellationToken |> liftAsync
let! sourceText = document.GetTextAsync(ct)
......@@ -158,13 +149,12 @@ type internal InlineRenameService
let! span = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.Range)
let triggerSpan = Tokenizer.fixupSpan(sourceText, span)
return InlineRenameInfo(document, triggerSpan, symbol, symbolUse, declLoc, checkFileResults) :> IFSharpInlineRenameInfo
return InlineRenameInfo(document, triggerSpan, symbol, symbolUse, declLoc, checkFileResults) :> FSharpInlineRenameInfo
}
interface IFSharpEditorInlineRenameService with
member _.GetRenameInfoAsync(document: Document, position: int, cancellationToken: CancellationToken) : Task<IFSharpInlineRenameInfo> =
asyncMaybe {
return! InlineRenameService.GetInlineRenameInfo(document, position)
}
|> Async.map (Option.defaultValue FailureInlineRenameInfo.Instance)
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)
override _.GetRenameInfoAsync(document: Document, position: int, cancellationToken: CancellationToken) : Task<FSharpInlineRenameInfo> =
asyncMaybe {
return! InlineRenameService.GetInlineRenameInfo(document, position)
}
|> Async.map (Option.defaultValue null)
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)
......@@ -300,7 +300,9 @@ type internal FSharpLanguageService(package : FSharpPackage) =
override this.Initialize() =
base.Initialize()
this.Workspace.Options <- this.Workspace.Options.WithChangedOption(Shared.Options.FSharpServiceFeatureOnOffOptions.ClosedFileDiagnostic, FSharpConstants.FSharpLanguageName, Nullable false)
let globalOptions = package.ComponentModel.DefaultExportProvider.GetExport<FSharpGlobalOptions>().Value
globalOptions.BlockForCompletionItems <- false
globalOptions.SetBackgroundAnalysisScope(openFilesOnly=true)
let globalOptions = package.ComponentModel.DefaultExportProvider.GetExport<FSharpGlobalOptions>().Value
globalOptions.BlockForCompletionItems <- false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册