Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
e2f2cd27
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,体验更适合开发者的 AI 搜索 >>
提交
e2f2cd27
编写于
2月 11, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable Glyph's on code actions.
上级
613b9912
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
48 addition
and
33 deletion
+48
-33
src/EditorFeatures/Core/Implementation/NavigationBar/NavigationBarController.cs
...e/Implementation/NavigationBar/NavigationBarController.cs
+3
-8
src/EditorFeatures/Core/Implementation/Suggestions/FixAllGetFixesService.cs
.../Core/Implementation/Suggestions/FixAllGetFixesService.cs
+5
-3
src/EditorFeatures/Core/Implementation/Suggestions/PreviewChangesCodeAction.cs
...re/Implementation/Suggestions/PreviewChangesCodeAction.cs
+1
-1
src/EditorFeatures/Core/Implementation/Suggestions/SuggestedAction.cs
...atures/Core/Implementation/Suggestions/SuggestedAction.cs
+1
-8
src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.SearchScope.cs
...AddImport/AbstractAddImportCodeFixProvider.SearchScope.cs
+1
-1
src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.SymbolReference.cs
...mport/AbstractAddImportCodeFixProvider.SymbolReference.cs
+16
-6
src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
...e/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
+8
-3
src/Features/Core/Portable/Features.csproj
src/Features/Core/Portable/Features.csproj
+0
-1
src/Workspaces/Core/Portable/CodeActions/CodeAction.cs
src/Workspaces/Core/Portable/CodeActions/CodeAction.cs
+2
-0
src/Workspaces/Core/Portable/Shared/Extensions/ProjectExtensions.cs
...aces/Core/Portable/Shared/Extensions/ProjectExtensions.cs
+9
-1
src/Workspaces/Core/Portable/Shared/Glyph.cs
src/Workspaces/Core/Portable/Shared/Glyph.cs
+0
-0
src/Workspaces/Core/Portable/Workspaces.csproj
src/Workspaces/Core/Portable/Workspaces.csproj
+2
-1
未找到文件。
src/EditorFeatures/Core/Implementation/NavigationBar/NavigationBarController.cs
浏览文件 @
e2f2cd27
...
...
@@ -10,6 +10,7 @@
using
Microsoft.CodeAnalysis.Editor.Shared.Tagging
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Internal.Log
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Shared.TestHooks
;
using
Microsoft.CodeAnalysis.Text
;
using
Microsoft.VisualStudio.Text
;
...
...
@@ -261,7 +262,7 @@ private void GetProjectItems(out IList<NavigationBarProjectItem> projectItems, o
projectItems
=
documents
.
Select
(
d
=>
new
NavigationBarProjectItem
(
d
.
Project
.
Name
,
GetProjectGlyph
(
d
.
Project
),
d
.
Project
.
GetGlyph
(
),
workspace
:
d
.
Project
.
Solution
.
Workspace
,
documentId
:
d
.
Id
,
language
:
d
.
Project
.
Language
)).
OrderBy
(
projectItem
=>
projectItem
.
Text
).
ToList
();
...
...
@@ -274,12 +275,6 @@ private void GetProjectItems(out IList<NavigationBarProjectItem> projectItems, o
:
projectItems
.
First
();
}
private
Glyph
GetProjectGlyph
(
Project
project
)
{
// TODO: Get the glyph from the hierarchy
return
project
.
Language
==
LanguageNames
.
CSharp
?
Glyph
.
CSharpProject
:
Glyph
.
BasicProject
;
}
/// <summary>
/// Check if the presenter has already been pushed the full model that corresponds to the
/// current buffer's project version stamp.
...
...
@@ -400,4 +395,4 @@ private void NavigateToItem(NavigationBarItem item, Document document, ITextSnap
languageService
.
NavigateToItem
(
document
,
item
,
_presenter
.
TryGetCurrentView
(),
cancellationToken
);
}
}
}
}
\ No newline at end of file
src/EditorFeatures/Core/Implementation/Suggestions/FixAllGetFixesService.cs
浏览文件 @
e2f2cd27
...
...
@@ -133,9 +133,11 @@ private async Task<IEnumerable<CodeActionOperation>> GetFixAllOperationsAsync(Co
using
(
Logger
.
LogBlock
(
FunctionId
.
CodeFixes_FixAllOccurrencesPreviewChanges
,
cancellationToken
))
{
var
previewService
=
workspace
.
Services
.
GetService
<
IPreviewDialogService
>();
var
glyph
=
languageOpt
==
null
?
Glyph
.
Assembly
:
languageOpt
==
LanguageNames
.
CSharp
?
Glyph
.
CSharpProject
:
Glyph
.
BasicProject
;
var
glyph
=
languageOpt
==
null
?
Glyph
.
Assembly
:
languageOpt
==
LanguageNames
.
CSharp
?
Glyph
.
CSharpProject
:
Glyph
.
BasicProject
;
var
changedSolution
=
previewService
.
PreviewChanges
(
string
.
Format
(
EditorFeaturesResources
.
PreviewChangesOf
,
fixAllPreviewChangesTitle
),
...
...
src/EditorFeatures/Core/Implementation/Suggestions/PreviewChangesCodeAction.cs
浏览文件 @
e2f2cd27
...
...
@@ -43,7 +43,7 @@ protected override async Task<IEnumerable<CodeActionOperation>> ComputeOperation
"vs.codefix.previewchanges"
,
_originalCodeAction
.
Title
,
EditorFeaturesResources
.
PreviewChangesRootNodeText
,
Glyph
.
OpenFolder
,
CodeAnalysis
.
Glyph
.
OpenFolder
,
_changeSummary
.
NewSolution
,
_changeSummary
.
OldSolution
,
showCheckBoxes
:
false
);
...
...
src/EditorFeatures/Core/Implementation/Suggestions/SuggestedAction.cs
浏览文件 @
e2f2cd27
...
...
@@ -259,14 +259,7 @@ void IDisposable.Dispose()
// same as display text
string
ISuggestedAction
.
IconAutomationText
=>
DisplayText
;
ImageMoniker
ISuggestedAction
.
IconMoniker
{
get
{
// no icon support
return
default
(
ImageMoniker
);
}
}
ImageMoniker
ISuggestedAction
.
IconMoniker
=>
CodeAction
.
Glyph
?.
GetImageMoniker
()
??
default
(
ImageMoniker
);
string
ISuggestedAction
.
InputGestureText
{
...
...
src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.SearchScope.cs
浏览文件 @
e2f2cd27
...
...
@@ -84,7 +84,7 @@ public ProjectSearchScope(Project project, bool ignoreCase, CancellationToken ca
public
override
SymbolReference
CreateReference
<
T
>(
SearchResult
<
T
>
searchResult
)
{
return
new
ProjectSymbolReference
(
searchResult
.
WithSymbol
<
INamespaceOrTypeSymbol
>(
searchResult
.
Symbol
),
_project
.
Id
);
searchResult
.
WithSymbol
<
INamespaceOrTypeSymbol
>(
searchResult
.
Symbol
),
_project
);
}
}
...
...
src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.SymbolReference.cs
浏览文件 @
e2f2cd27
...
...
@@ -49,22 +49,30 @@ public override int GetHashCode()
return
this
.
SearchResult
.
Symbol
.
GetHashCode
();
}
public
abstract
Glyph
?
GetGlyph
(
Document
document
);
public
abstract
Solution
UpdateSolution
(
Document
newDocument
);
}
private
class
ProjectSymbolReference
:
SymbolReference
{
private
readonly
Project
Id
_projectId
;
private
readonly
Project
_project
;
public
ProjectSymbolReference
(
SearchResult
<
INamespaceOrTypeSymbol
>
searchResult
,
Project
Id
projectId
)
public
ProjectSymbolReference
(
SearchResult
<
INamespaceOrTypeSymbol
>
searchResult
,
Project
project
)
:
base
(
searchResult
)
{
_projectId
=
projectId
;
_project
=
project
;
}
public
override
Glyph
?
GetGlyph
(
Document
document
)
{
return
document
.
Project
.
Id
==
_project
.
Id
?
default
(
Glyph
?)
:
_project
.
GetGlyph
();
}
public
override
Solution
UpdateSolution
(
Document
newDocument
)
{
if
(
_projectId
==
newDocument
.
Project
.
Id
)
if
(
_project
.
Id
==
newDocument
.
Project
.
Id
)
{
// This reference was found while searching in the project for our document. No
// need to make any solution changes.
...
...
@@ -74,7 +82,7 @@ public override Solution UpdateSolution(Document newDocument)
// If this reference came from searching another project, then add a project reference
// as well.
var
newProject
=
newDocument
.
Project
;
newProject
=
newProject
.
AddProjectReference
(
new
ProjectReference
(
_projectId
));
newProject
=
newProject
.
AddProjectReference
(
new
ProjectReference
(
_project
.
Id
));
return
newProject
.
Solution
;
}
...
...
@@ -90,10 +98,12 @@ public MetadataSymbolReference(SearchResult<INamespaceOrTypeSymbol> searchResult
_reference
=
reference
;
}
public
override
Glyph
?
GetGlyph
(
Document
document
)
=>
Glyph
.
Reference
;
public
override
Solution
UpdateSolution
(
Document
newDocument
)
{
return
newDocument
.
Project
.
AddMetadataReference
(
_reference
).
Solution
;
}
}
}
}
}
\ No newline at end of file
src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
浏览文件 @
e2f2cd27
...
...
@@ -100,8 +100,8 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
var
description
=
this
.
GetDescription
(
reference
.
SearchResult
.
Symbol
,
semanticModel
,
node
);
if
(
description
!=
null
)
{
var
action
=
new
MyCodeAction
(
description
,
c
=>
this
.
AddImportAndReferenceAsync
(
node
,
reference
,
document
,
placeSystemNamespaceFirst
,
c
));
var
action
=
new
MyCodeAction
(
description
,
reference
.
GetGlyph
(
document
),
c
=>
this
.
AddImportAndReferenceAsync
(
node
,
reference
,
document
,
placeSystemNamespaceFirst
,
c
));
context
.
RegisterCodeFix
(
action
,
diagnostic
);
}
}
...
...
@@ -383,10 +383,15 @@ private static bool NotNull(SymbolReference reference)
private
class
MyCodeAction
:
CodeAction
.
SolutionChangeAction
{
public
MyCodeAction
(
string
title
,
Func
<
CancellationToken
,
Task
<
Solution
>>
createChangedSolution
)
:
private
readonly
Glyph
?
_glyph
;
public
MyCodeAction
(
string
title
,
Glyph
?
glyph
,
Func
<
CancellationToken
,
Task
<
Solution
>>
createChangedSolution
)
:
base
(
title
,
createChangedSolution
,
equivalenceKey
:
title
)
{
_glyph
=
glyph
;
}
internal
override
Glyph
?
Glyph
=>
_glyph
;
}
private
struct
SearchResult
<
T
>
where
T
:
ISymbol
...
...
src/Features/Core/Portable/Features.csproj
浏览文件 @
e2f2cd27
...
...
@@ -146,7 +146,6 @@
<Compile
Include=
"CodeRefactorings\PredefinedCodeRefactoringProviderNames.cs"
/>
<Compile
Include=
"CodeRefactorings\ServicesLayerCodeActionHelpersService.cs"
/>
<Compile
Include=
"CodeRefactorings\WorkspaceServices\IAddMetadataReferenceCodeActionOperationFactoryWorkspaceService.cs"
/>
<Compile
Include=
"Common\Glyph.cs"
/>
<Compile
Include=
"Completion\AbstractCompletionService.cs"
/>
<Compile
Include=
"Completion\CommonCompletionUtilities.cs"
/>
<Compile
Include=
"Completion\CompletionFilterReason.cs"
/>
...
...
src/Workspaces/Core/Portable/CodeActions/CodeAction.cs
浏览文件 @
e2f2cd27
...
...
@@ -47,6 +47,8 @@ public abstract class CodeAction
internal
virtual
bool
IsInvokable
=>
true
;
internal
virtual
Glyph
?
Glyph
=>
null
;
internal
virtual
ImmutableArray
<
CodeAction
>
GetCodeActions
()
{
return
ImmutableArray
<
CodeAction
>.
Empty
;
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ProjectExtensions.cs
浏览文件 @
e2f2cd27
...
...
@@ -38,5 +38,13 @@ public static async Task<VersionStamp> GetVersionAsync(this Project project, Can
return
version
.
GetNewerVersion
(
latestVersion
);
}
public
static
Glyph
GetGlyph
(
this
Project
project
)
{
// TODO: Get the glyph from the hierarchy
return
project
.
Language
==
LanguageNames
.
CSharp
?
Glyph
.
CSharpProject
:
project
.
Language
==
LanguageNames
.
VisualBasic
?
Glyph
.
BasicProject
:
Glyph
.
Assembly
;
}
}
}
}
\ No newline at end of file
src/
Features/Core/Portable/Common
/Glyph.cs
→
src/
Workspaces/Core/Portable/Shared
/Glyph.cs
浏览文件 @
e2f2cd27
文件已移动
src/Workspaces/Core/Portable/Workspaces.csproj
浏览文件 @
e2f2cd27
...
...
@@ -385,6 +385,7 @@
<Compile
Include=
"FindSymbols\FindReferences\Finders\ILanguageServiceReferenceFinder.cs"
/>
<Compile
Include=
"FindSymbols\SymbolTree\ISymbolTreeInfoCacheService.cs"
/>
<Compile
Include=
"FindSymbols\FindReferences\MetadataUnifyingEquivalenceComparer.cs"
/>
<Compile
Include=
"Shared\Glyph.cs"
/>
<Compile
Include=
"Utilities\ArraySlice.cs"
/>
<Compile
Include=
"Utilities\BKTree.cs"
/>
<Compile
Include=
"FindSymbols\SyntaxTree\AbstractSyntaxTreeInfo.cs"
/>
...
...
@@ -963,4 +964,4 @@
<ImportGroup
Label=
"Targets"
>
<Import
Project=
"..\..\..\..\build\Targets\VSL.Imports.targets"
/>
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录