Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bc3fd5fc
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bc3fd5fc
编写于
7月 29, 2020
作者:
A
Allison Chou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address feedback - add unifying classes
上级
b31f01bc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
112 addition
and
42 deletion
+112
-42
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs
...pf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs
+6
-5
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeRefactoringSuggestedAction.cs
...stions/SuggestedActions/CodeRefactoringSuggestedAction.cs
+5
-1
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs
...Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs
+12
-10
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs
...orFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs
+4
-4
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/ICodeFixSuggestedAction.cs
...stions/UnifiedSuggestedActions/ICodeFixSuggestedAction.cs
+19
-0
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/ICodeRefactoringSuggestedAction.cs
...nifiedSuggestedActions/ICodeRefactoringSuggestedAction.cs
+19
-0
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/IFixAllSuggestedAction.cs
...estions/UnifiedSuggestedActions/IFixAllSuggestedAction.cs
+24
-0
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/IUnifiedSuggestedAction.cs
...stions/UnifiedSuggestedActions/IUnifiedSuggestedAction.cs
+3
-1
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedCodeFixSuggestedAction.cs
.../UnifiedSuggestedActions/UnifiedCodeFixSuggestedAction.cs
+3
-2
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedCodeRefactoringSuggestedAction.cs
...SuggestedActions/UnifiedCodeRefactoringSuggestedAction.cs
+2
-1
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedFixAllSuggestedAction.cs
...s/UnifiedSuggestedActions/UnifiedFixAllSuggestedAction.cs
+2
-1
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedSuggestedAction.cs
...estions/UnifiedSuggestedActions/UnifiedSuggestedAction.cs
+3
-3
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs
...table/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs
+6
-6
src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs
...eServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs
+4
-8
未找到文件。
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -7,6 +7,7 @@
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
;
using
Microsoft.VisualStudio.Language.Intellisense
;
using
Microsoft.VisualStudio.Text
;
...
...
@@ -15,9 +16,9 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
/// <summary>
/// Represents light bulb menu item for code fixes.
/// </summary>
internal
sealed
class
CodeFixSuggestedAction
:
SuggestedActionWithNestedFlavors
,
ITelemetryDiagnosticID
<
string
>
internal
sealed
class
CodeFixSuggestedAction
:
SuggestedActionWithNestedFlavors
,
I
CodeFixSuggestedAction
,
I
TelemetryDiagnosticID
<
string
>
{
p
rivate
readonly
CodeFix
_fix
;
p
ublic
CodeFix
CodeFix
{
get
;
}
public
CodeFixSuggestedAction
(
IThreadingContext
threadingContext
,
...
...
@@ -31,13 +32,13 @@ internal sealed class CodeFixSuggestedAction : SuggestedActionWithNestedFlavors,
:
base
(
threadingContext
,
sourceProvider
,
workspace
,
subjectBuffer
,
provider
,
action
,
fixAllFlavors
)
{
_f
ix
=
fix
;
CodeF
ix
=
fix
;
}
public
string
GetDiagnosticID
()
=>
_f
ix
.
PrimaryDiagnostic
.
GetTelemetryDiagnosticID
();
=>
CodeF
ix
.
PrimaryDiagnostic
.
GetTelemetryDiagnosticID
();
protected
override
DiagnosticData
GetDiagnostic
()
=>
_f
ix
.
GetPrimaryDiagnosticData
();
=>
CodeF
ix
.
GetPrimaryDiagnosticData
();
}
}
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeRefactoringSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -5,6 +5,7 @@
using
Microsoft.CodeAnalysis.CodeActions
;
using
Microsoft.CodeAnalysis.CodeRefactorings
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
;
using
Microsoft.VisualStudio.Text
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
...
...
@@ -12,8 +13,10 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
/// <summary>
/// Represents light bulb menu item for code refactorings.
/// </summary>
internal
sealed
class
CodeRefactoringSuggestedAction
:
SuggestedActionWithNestedFlavors
internal
sealed
class
CodeRefactoringSuggestedAction
:
SuggestedActionWithNestedFlavors
,
ICodeRefactoringSuggestedAction
{
public
CodeRefactoringProvider
CodeRefactoringProvider
{
get
;
}
public
CodeRefactoringSuggestedAction
(
IThreadingContext
threadingContext
,
SuggestedActionsSourceProvider
sourceProvider
,
...
...
@@ -23,6 +26,7 @@ internal sealed class CodeRefactoringSuggestedAction : SuggestedActionWithNested
CodeAction
codeAction
)
:
base
(
threadingContext
,
sourceProvider
,
workspace
,
subjectBuffer
,
provider
,
codeAction
)
{
CodeRefactoringProvider
=
provider
;
}
}
}
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -10,6 +10,7 @@
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Internal.Log
;
using
Microsoft.CodeAnalysis.Shared.Utilities
;
using
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
;
using
Microsoft.VisualStudio.Language.Intellisense
;
using
Microsoft.VisualStudio.Text
;
...
...
@@ -19,9 +20,9 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
/// Suggested action for fix all occurrences code fix. Note: this is only used
/// as a 'flavor' inside CodeFixSuggestionAction.
/// </summary>
internal
sealed
partial
class
FixAllSuggestedAction
:
SuggestedAction
,
ITelemetryDiagnosticID
<
string
>
internal
sealed
partial
class
FixAllSuggestedAction
:
SuggestedAction
,
ITelemetryDiagnosticID
<
string
>
,
IFixAllSuggestedAction
{
p
rivate
readonly
Diagnostic
_fixedDiagnostic
;
p
ublic
Diagnostic
Diagnostic
{
get
;
}
/// <summary>
/// The original code-action that we are a fix-all for. i.e. _originalCodeAction
...
...
@@ -29,8 +30,9 @@ internal sealed partial class FixAllSuggestedAction : SuggestedAction, ITelemetr
/// and our <see cref="SuggestedAction.CodeAction"/> is the actual action that
/// will perform the fix in the appropriate document/project/solution scope.
/// </summary>
private
readonly
CodeAction
_originalCodeAction
;
private
readonly
FixAllState
_fixAllState
;
public
CodeAction
OriginalCodeAction
{
get
;
}
public
FixAllState
FixAllState
{
get
;
}
internal
FixAllSuggestedAction
(
IThreadingContext
threadingContext
,
...
...
@@ -43,9 +45,9 @@ internal sealed partial class FixAllSuggestedAction : SuggestedAction, ITelemetr
:
base
(
threadingContext
,
sourceProvider
,
workspace
,
subjectBuffer
,
fixAllState
.
FixAllProvider
,
new
FixAllCodeAction
(
fixAllState
))
{
_fixed
Diagnostic
=
originalFixedDiagnostic
;
_o
riginalCodeAction
=
originalCodeAction
;
_f
ixAllState
=
fixAllState
;
Diagnostic
=
originalFixedDiagnostic
;
O
riginalCodeAction
=
originalCodeAction
;
F
ixAllState
=
fixAllState
;
}
public
override
bool
TryGetTelemetryId
(
out
Guid
telemetryId
)
...
...
@@ -53,19 +55,19 @@ public override bool TryGetTelemetryId(out Guid telemetryId)
// We get the telemetry id for the original code action we are fixing,
// not the special 'FixAllCodeAction'. that is the .CodeAction this
// SuggestedAction is pointing at.
telemetryId
=
_originalCodeAction
.
GetType
().
GetTelemetryId
(
_f
ixAllState
.
Scope
.
GetScopeIdForTelemetry
());
telemetryId
=
OriginalCodeAction
.
GetType
().
GetTelemetryId
(
F
ixAllState
.
Scope
.
GetScopeIdForTelemetry
());
return
true
;
}
public
string
GetDiagnosticID
()
=>
_fixed
Diagnostic
.
GetTelemetryDiagnosticID
();
=>
Diagnostic
.
GetTelemetryDiagnosticID
();
protected
override
void
InnerInvoke
(
IProgressTracker
progressTracker
,
CancellationToken
cancellationToken
)
{
this
.
AssertIsForeground
();
using
(
Logger
.
LogBlock
(
FunctionId
.
CodeFixes_FixAllOccurrencesSession
,
FixAllLogger
.
CreateCorrelationLogMessage
(
_f
ixAllState
.
CorrelationId
),
cancellationToken
))
using
(
Logger
.
LogBlock
(
FunctionId
.
CodeFixes_FixAllOccurrencesSession
,
FixAllLogger
.
CreateCorrelationLogMessage
(
F
ixAllState
.
CorrelationId
),
cancellationToken
))
{
base
.
InnerInvoke
(
progressTracker
,
cancellationToken
);
}
...
...
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs
浏览文件 @
bc3fd5fc
...
...
@@ -252,17 +252,17 @@ ISuggestedAction ConvertToSuggestedAction(IUnifiedSuggestedAction unifiedSuggest
{
UnifiedCodeFixSuggestedAction
codeFixAction
=>
new
CodeFixSuggestedAction
(
ThreadingContext
,
_owner
,
codeFixAction
.
Workspace
,
_subjectBuffer
,
codeFixAction
.
CodeFix
,
codeFixAction
.
Provider
,
codeFixAction
.
CodeAction
,
codeFixAction
.
CodeFix
,
codeFixAction
.
Provider
,
codeFixAction
.
Original
CodeAction
,
ConvertToSuggestedActionSet
(
codeFixAction
.
FixAllFlavors
)),
UnifiedCodeRefactoringSuggestedAction
codeRefactoringAction
=>
new
CodeRefactoringSuggestedAction
(
ThreadingContext
,
_owner
,
codeRefactoringAction
.
Workspace
,
_subjectBuffer
,
codeRefactoringAction
.
CodeRefactoringProvider
,
codeRefactoringAction
.
CodeAction
),
codeRefactoringAction
.
CodeRefactoringProvider
,
codeRefactoringAction
.
Original
CodeAction
),
UnifiedFixAllSuggestedAction
fixAllAction
=>
new
FixAllSuggestedAction
(
ThreadingContext
,
_owner
,
fixAllAction
.
Workspace
,
_subjectBuffer
,
fixAllAction
.
FixAllState
,
fixAllAction
.
Diagnostic
,
fixAllAction
.
CodeAction
),
fixAllAction
.
FixAllState
,
fixAllAction
.
Diagnostic
,
fixAllAction
.
Original
CodeAction
),
UnifiedSuggestedActionWithNestedActions
nestedAction
=>
new
SuggestedActionWithNestedActions
(
ThreadingContext
,
_owner
,
nestedAction
.
Workspace
,
_subjectBuffer
,
nestedAction
.
Provider
??
this
,
nestedAction
.
CodeAction
,
nestedAction
.
Provider
??
this
,
nestedAction
.
Original
CodeAction
,
nestedAction
.
NestedActionSets
.
SelectAsArray
(
s
=>
ConvertToSuggestedActionSet
(
s
))),
_
=>
throw
ExceptionUtilities
.
Unreachable
};
...
...
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/ICodeFixSuggestedAction.cs
0 → 100644
浏览文件 @
bc3fd5fc
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.CodeAnalysis.CodeFixes
;
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
{
/// <summary>
/// Common interface used by both local Roslyn and LSP to implement
/// their specific versions of CodeFixSuggestedAction.
/// </summary>
internal
interface
ICodeFixSuggestedAction
{
public
CodeFix
CodeFix
{
get
;
}
}
}
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/ICodeRefactoringSuggestedAction.cs
0 → 100644
浏览文件 @
bc3fd5fc
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.CodeAnalysis.CodeRefactorings
;
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
{
/// <summary>
/// Common interface used by both local Roslyn and LSP to implement
/// their specific versions of CodeRefactoringSuggestedAction.
/// </summary>
internal
interface
ICodeRefactoringSuggestedAction
{
CodeRefactoringProvider
CodeRefactoringProvider
{
get
;
}
}
}
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/IFixAllSuggestedAction.cs
0 → 100644
浏览文件 @
bc3fd5fc
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.CodeAnalysis.CodeActions
;
using
Microsoft.CodeAnalysis.CodeFixes
;
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
{
/// <summary>
/// Common interface used by both local Roslyn and LSP to implement
/// their specific versions of FixAllSuggestedAction.
/// </summary>
internal
interface
IFixAllSuggestedAction
{
Diagnostic
Diagnostic
{
get
;
}
CodeAction
OriginalCodeAction
{
get
;
}
FixAllState
?
FixAllState
{
get
;
}
}
}
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/IUnifiedSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -14,7 +14,9 @@ namespace Microsoft.CodeAnalysis.UnifiedSuggestions
internal
interface
IUnifiedSuggestedAction
{
Workspace
Workspace
{
get
;
}
CodeAction
CodeAction
{
get
;
}
CodeAction
OriginalCodeAction
{
get
;
}
CodeActionPriority
CodeActionPriority
{
get
;
}
}
}
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedCodeFixSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -6,14 +6,15 @@
using
Microsoft.CodeAnalysis.CodeActions
;
using
Microsoft.CodeAnalysis.CodeFixes
;
using
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
;
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions
{
/// <summary>
/// Similar to
Unified
CodeFixSuggestionAction, but in a location that can be used by
/// Similar to CodeFixSuggestionAction, but in a location that can be used by
/// both local Roslyn and LSP.
/// </summary>
internal
class
UnifiedCodeFixSuggestedAction
:
UnifiedSuggestedAction
internal
class
UnifiedCodeFixSuggestedAction
:
UnifiedSuggestedAction
,
ICodeFixSuggestedAction
{
public
CodeFix
CodeFix
{
get
;
}
...
...
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedCodeRefactoringSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -6,6 +6,7 @@
using
Microsoft.CodeAnalysis.CodeActions
;
using
Microsoft.CodeAnalysis.CodeRefactorings
;
using
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
;
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions
{
...
...
@@ -13,7 +14,7 @@ namespace Microsoft.CodeAnalysis.UnifiedSuggestions
/// Similar to CodeRefactoringSuggestedAction, but in a location that can be used by
/// both local Roslyn and LSP.
/// </summary>
internal
class
UnifiedCodeRefactoringSuggestedAction
:
UnifiedSuggestedAction
internal
class
UnifiedCodeRefactoringSuggestedAction
:
UnifiedSuggestedAction
,
ICodeRefactoringSuggestedAction
{
public
CodeRefactoringProvider
CodeRefactoringProvider
{
get
;
}
...
...
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedFixAllSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -6,6 +6,7 @@
using
Microsoft.CodeAnalysis.CodeActions
;
using
Microsoft.CodeAnalysis.CodeFixes
;
using
Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
;
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions
{
...
...
@@ -13,7 +14,7 @@ namespace Microsoft.CodeAnalysis.UnifiedSuggestions
/// Similar to FixAllSuggestedAction, but in a location that can be used by
/// both local Roslyn and LSP.
/// </summary>
internal
class
UnifiedFixAllSuggestedAction
:
UnifiedSuggestedAction
internal
class
UnifiedFixAllSuggestedAction
:
UnifiedSuggestedAction
,
IFixAllSuggestedAction
{
public
Diagnostic
Diagnostic
{
get
;
}
...
...
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedSuggestedAction.cs
浏览文件 @
bc3fd5fc
...
...
@@ -9,21 +9,21 @@
namespace
Microsoft.CodeAnalysis.UnifiedSuggestions
{
/// <summary>
/// Similar to
Unified
SuggestedAction, but in a location that can be used by
/// Similar to SuggestedAction, but in a location that can be used by
/// both local Roslyn and LSP.
/// </summary>
internal
class
UnifiedSuggestedAction
:
IUnifiedSuggestedAction
{
public
Workspace
Workspace
{
get
;
}
public
CodeAction
CodeAction
{
get
;
}
public
CodeAction
Original
CodeAction
{
get
;
}
public
CodeActionPriority
CodeActionPriority
{
get
;
}
public
UnifiedSuggestedAction
(
Workspace
workspace
,
CodeAction
codeAction
,
CodeActionPriority
codeActionPriority
)
{
Workspace
=
workspace
;
CodeAction
=
codeAction
;
Original
CodeAction
=
codeAction
;
CodeActionPriority
=
codeActionPriority
;
}
}
...
...
src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs
浏览文件 @
bc3fd5fc
...
...
@@ -284,14 +284,14 @@ static CodeFixGroupKey GetGroupKey(CodeFix fix)
{
var
actions
=
map
[
groupKey
];
var
nonSuppressionActions
=
actions
.
Where
(
a
=>
!
IsTopLevelSuppressionAction
(
a
.
CodeAction
));
var
nonSuppressionActions
=
actions
.
Where
(
a
=>
!
IsTopLevelSuppressionAction
(
a
.
Original
CodeAction
));
AddUnifiedSuggestedActionsSet
(
nonSuppressionActions
,
groupKey
,
nonSuppressionSets
);
var
suppressionActions
=
actions
.
Where
(
a
=>
IsTopLevelSuppressionAction
(
a
.
CodeAction
)
&&
!
IsBulkConfigurationAction
(
a
.
CodeAction
));
var
suppressionActions
=
actions
.
Where
(
a
=>
IsTopLevelSuppressionAction
(
a
.
Original
CodeAction
)
&&
!
IsBulkConfigurationAction
(
a
.
Original
CodeAction
));
AddUnifiedSuggestedActionsSet
(
suppressionActions
,
groupKey
,
suppressionSets
);
bulkConfigurationActions
.
AddRange
(
actions
.
Where
(
a
=>
IsBulkConfigurationAction
(
a
.
CodeAction
)));
bulkConfigurationActions
.
AddRange
(
actions
.
Where
(
a
=>
IsBulkConfigurationAction
(
a
.
Original
CodeAction
)));
}
var
sets
=
nonSuppressionSets
.
ToImmutable
();
...
...
@@ -667,7 +667,7 @@ private static UnifiedSuggestedActionSet InlineActions(UnifiedSuggestedActionSet
var
actionWithNestedActions
=
action
as
UnifiedSuggestedActionWithNestedActions
;
// Only inline if the underlying code action allows it.
if
(
actionWithNestedActions
?.
CodeAction
.
IsInlinable
==
true
)
if
(
actionWithNestedActions
?.
Original
CodeAction
.
IsInlinable
==
true
)
{
newActions
.
AddRange
(
actionWithNestedActions
.
NestedActionSets
.
SelectMany
(
set
=>
set
.
Actions
));
}
...
...
@@ -709,7 +709,7 @@ private static UnifiedSuggestedActionSet InlineActions(UnifiedSuggestedActionSet
foreach
(
var
action
in
set
.
Actions
)
{
if
(
seenTitles
.
Add
(
action
.
CodeAction
.
Title
))
if
(
seenTitles
.
Add
(
action
.
Original
CodeAction
.
Title
))
{
actions
.
Add
(
action
);
}
...
...
src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs
浏览文件 @
bc3fd5fc
...
...
@@ -52,7 +52,7 @@ internal static class CodeActionHelpers
foreach
(
var
suggestedAction
in
set
.
Actions
)
{
// Filter out code actions with options since they'll show dialogs and we can't remote the UI and the options.
if
(
suggestedAction
.
CodeAction
is
CodeActionWithOptions
)
if
(
suggestedAction
.
Original
CodeAction
is
CodeActionWithOptions
)
{
continue
;
}
...
...
@@ -88,13 +88,9 @@ internal static class CodeActionHelpers
nestedActions
.
Add
(
GenerateVSCodeAction
(
request
,
action
,
codeActionKind
,
currentTitle
));
}
// WPF uses the first underscore to create keyboard shortcuts, so we have to insert an extra underscore
// wherever there's an underscore for it to be displayed properly.
var
title
=
codeAction
.
Title
.
Replace
(
"_"
,
"__"
);
return
new
VSCodeAction
{
Title
=
t
itle
,
Title
=
codeAction
.
T
itle
,
Kind
=
codeActionKind
,
Diagnostics
=
request
.
Context
.
Diagnostics
,
Children
=
nestedActions
.
ToArray
(),
...
...
@@ -129,7 +125,7 @@ internal static class CodeActionHelpers
foreach
(
var
suggestedAction
in
set
.
Actions
)
{
// Filter out code actions with options since they'll show dialogs and we can't remote the UI and the options.
if
(
suggestedAction
.
CodeAction
is
CodeActionWithOptions
)
if
(
suggestedAction
.
Original
CodeAction
is
CodeActionWithOptions
)
{
continue
;
}
...
...
@@ -146,7 +142,7 @@ internal static class CodeActionHelpers
/// </summary>
private
static
CodeAction
GetNestedActionsFromActionSet
(
IUnifiedSuggestedAction
suggestedAction
)
{
var
codeAction
=
suggestedAction
.
CodeAction
;
var
codeAction
=
suggestedAction
.
Original
CodeAction
;
if
(!(
suggestedAction
is
UnifiedSuggestedActionWithNestedActions
suggestedActionWithNestedActions
))
{
return
codeAction
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录