Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
539de850
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
539de850
编写于
6月 17, 2022
作者:
K
Kevin Ransom (msft)
提交者:
GitHub
6月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13314 from dotnet/merges/release/dev17.2-to-main
Merge release/dev17.2 to main
上级
f99d8510
812d8453
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
119 addition
and
126 deletion
+119
-126
azure-pipelines.yml
azure-pipelines.yml
+2
-2
eng/Versions.props
eng/Versions.props
+8
-6
src/Compiler/Driver/OptimizeInputs.fs
src/Compiler/Driver/OptimizeInputs.fs
+1
-1
src/FSharp.Core/FSharp.Core.fsproj
src/FSharp.Core/FSharp.Core.fsproj
+4
-7
src/FSharp.Core/prim-types.fsi
src/FSharp.Core/prim-types.fsi
+4
-4
src/FSharp.Core/printf.fsi
src/FSharp.Core/printf.fsi
+2
-0
vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs
...n/src/FSharp.Editor/Formatting/EditorFormattingService.fs
+6
-3
vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs
...ration/src/FSharp.Editor/Formatting/IndentationService.fs
+0
-3
vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs
...ion/src/FSharp.Editor/InlineRename/InlineRenameService.fs
+89
-99
vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
...tion/src/FSharp.Editor/LanguageService/LanguageService.fs
+3
-1
未找到文件。
azure-pipelines.yml
浏览文件 @
539de850
...
...
@@ -571,8 +571,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.
2
insertTargetBranch
:
rel/d17.
2
insertTeamEmail
:
fsharpteam@microsoft.com
insertTeamName
:
'
F#'
completeInsertion
:
'
auto'
eng/Versions.props
浏览文件 @
539de850
...
...
@@ -15,7 +15,7 @@
<!-- F# Version components -->
<FSMajorVersion>6</FSMajorVersion>
<FSMinorVersion>0</FSMinorVersion>
<FSBuildVersion>
1
</FSBuildVersion>
<FSBuildVersion>
5
</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>
5
</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>
4
</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>
...
...
@@ -135,7 +135,7 @@
<EnvDTEVersion>$(VisualStudioContractPackagesVersion)</EnvDTEVersion>
<EnvDTE80Version>$(VisualStudioContractPackagesVersion)</EnvDTE80Version>
<!-- Roslyn packages -->
<RoslynVersion>4.2.0-
2.22103.1
1</RoslynVersion>
<RoslynVersion>4.2.0-
3.22154.
1</RoslynVersion>
<MicrosoftCodeAnalysisEditorFeaturesVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesTextVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesWpfVersion>
...
...
@@ -189,6 +189,7 @@
<MicrosoftVisualStudioUtilitiesVersion>$(VisualStudioContractPackagesVersion)</MicrosoftVisualStudioUtilitiesVersion>
<MicrosoftVisualStudioValidationVersion>17.0.46</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioWCFReferenceInteropVersion>9.0.30729</MicrosoftVisualStudioWCFReferenceInteropVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<VSSDKDebuggerVisualizersVersion>12.0.4</VSSDKDebuggerVisualizersVersion>
<VSSDKVSLangProjVersion>7.0.4</VSSDKVSLangProjVersion>
<VSSDKVSLangProj8Version>8.0.4</VSSDKVSLangProj8Version>
...
...
@@ -212,6 +213,7 @@
<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.11.34</StreamJsonRpcVersion>
...
...
src/Compiler/Driver/OptimizeInputs.fs
浏览文件 @
539de850
...
...
@@ -245,7 +245,7 @@ let GenerateIlxCode
generateFilterBlocks
=
tcConfig
.
generateFilterBlocks
emitConstantArraysUsingStaticDataBlobs
=
not
isInteractiveOnMono
workAroundReflectionEmitBugs
=
tcConfig
.
isInteractive
generateDebugSymbols
=
tcConfig
.
debuginfo
generateDebugSymbols
=
tcConfig
.
debuginfo
// REVIEW: is this still required?
fragName
=
fragName
localOptimizationsEnabled
=
tcConfig
.
optSettings
.
LocalOptimizationsEnabled
testFlagEmitFeeFeeAs100001
=
tcConfig
.
testFlagEmitFeeFeeAs100001
...
...
src/FSharp.Core/FSharp.Core.fsproj
浏览文件 @
539de850
...
...
@@ -13,21 +13,18 @@
<DefineConstants
Condition=
"'$(Configuration)' == 'Proto'"
>
BUILDING_WITH_LKG;$(DefineConstants)
</DefineConstants>
<!-- 3218: ArgumentsInSigAndImplMismatch -->
<OtherFlags>
$(OtherFlags) --warnon:3218
</OtherFlags>
<!-- 1182: Unused variables -->
<OtherFlags>
$(OtherFlags) --warnon:1182
</OtherFlags>
<!-- 3390: xmlDocBadlyFormed -->
<OtherFlags>
$(OtherFlags) --warnon:3390
</OtherFlags>
<!-- 3520: invalidXmlDocPosition -->
<OtherFlags>
$(OtherFlags) --warnon:3520
</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 -->
<OtherFlags>
$(OtherFlags) --nowarn:3511
</OtherFlags>
<!-- Turn off 3513: resumable code invocation' - expected for resumable code combinators -->
<OtherFlags>
$(OtherFlags) --nowarn:351
1 --nowarn:351
3
</OtherFlags>
<OtherFlags>
$(OtherFlags) --nowarn:3513
</OtherFlags>
<OtherFlags>
$(OtherFlags) --compiling-fslib --compiling-fslib-40 --maxerrors:100 --extraoptimizationloops:1
</OtherFlags>
<!-- preview needed for use of state machines for tasks -->
<LangVersion>
preview
</LangVersion>
...
...
src/FSharp.Core/prim-types.fsi
浏览文件 @
539de850
...
...
@@ -1027,7 +1027,7 @@ namespace Microsoft.FSharp.Core
/// <category>Basic Types with Units of Measure</category>
[<
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
...
...
@@ -1036,7 +1036,7 @@ namespace Microsoft.FSharp.Core
/// <category>Basic Types with Units of Measure</category>
[<
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
...
...
@@ -1045,7 +1045,7 @@ namespace Microsoft.FSharp.Core
/// <category>Basic Types with Units of Measure</category>
[<
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
...
...
@@ -1054,7 +1054,7 @@ namespace Microsoft.FSharp.Core
/// <category>Basic Types with Units of Measure</category>
[<
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
...
...
src/FSharp.Core/printf.fsi
浏览文件 @
539de850
...
...
@@ -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>
...
...
vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs
浏览文件 @
539de850
...
...
@@ -167,14 +167,17 @@ type internal FSharpEditorFormattingService
return
textChanges
|>
Option
.
defaultValue
Seq
.
empty
|>
toIList
}
interface
IFSharpEditorFormattingService
with
interface
IFSharpEditorFormattingService
WithOptions
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
...
...
vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs
浏览文件 @
539de850
...
...
@@ -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
...
...
vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs
浏览文件 @
539de850
...
...
@@ -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
_.
Has
Overloads
=
false
member
_.
ForceRenameOverloads
=
fals
e
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
_.
ForceRename
Overloads
=
false
override
_.
DisplayName
=
symbolUse
.
Symbol
.
DisplayNam
e
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
)
:>
I
FSharpInlineRenameInfo
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
)
vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
浏览文件 @
539de850
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录