Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d17c4102
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,发现更多精彩内容 >>
提交
d17c4102
编写于
2月 23, 2015
作者:
D
David Poeschl
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #773 from dpoeschl/RenameTrackingTriggerDiagnosticDescriptor
Use TriggerDiagnosticDescriptor in RenameTracking
上级
77c0c8a8
50ef7ff5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
44 deletion
+19
-44
src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs
src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs
+0
-18
src/EditorFeatures/Core/EditorFeaturesResources.resx
src/EditorFeatures/Core/EditorFeaturesResources.resx
+0
-6
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingDiagnosticAnalyzer.cs
...tation/RenameTracking/RenameTrackingDiagnosticAnalyzer.cs
+5
-13
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.StateMachine.cs
...nameTracking/RenameTrackingTaggerProvider.StateMachine.cs
+9
-2
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.cs
...ementation/RenameTracking/RenameTrackingTaggerProvider.cs
+5
-5
未找到文件。
src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs
浏览文件 @
d17c4102
...
...
@@ -1600,15 +1600,6 @@ internal class EditorFeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Rename Tracking.
/// </summary>
internal
static
string
RenameTracking
{
get
{
return
ResourceManager
.
GetString
(
"RenameTracking"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Renaming anonymous type members is not yet supported..
/// </summary>
...
...
@@ -1843,15 +1834,6 @@ internal class EditorFeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to with preview....
/// </summary>
internal
static
string
WithPreview
{
get
{
return
ResourceManager
.
GetString
(
"WithPreview"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to XML End Tag Completion.
/// </summary>
...
...
src/EditorFeatures/Core/EditorFeaturesResources.resx
浏览文件 @
d17c4102
...
...
@@ -342,9 +342,6 @@
<data
name=
"DocumentIsNotCurrentlyBeingTracked"
xml:space=
"preserve"
>
<value>
document is not currently being tracked
</value>
</data>
<data
name=
"RenameTracking"
xml:space=
"preserve"
>
<value>
Rename Tracking
</value>
</data>
<data
name=
"ComputingRenameInformation"
xml:space=
"preserve"
>
<value>
Computing Rename information...
</value>
</data>
...
...
@@ -624,9 +621,6 @@
<data
name=
"RenameToWithPreview"
xml:space=
"preserve"
>
<value>
Rename '{0}' to '{1}' with preview...
</value>
</data>
<data
name=
"WithPreview"
xml:space=
"preserve"
>
<value>
with preview...
</value>
</data>
<data
name=
"PreviewChanges"
xml:space=
"preserve"
>
<value>
Preview Changes
</value>
</data>
...
...
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingDiagnosticAnalyzer.cs
浏览文件 @
d17c4102
...
...
@@ -10,20 +10,12 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking
internal
sealed
class
RenameTrackingDiagnosticAnalyzer
:
DiagnosticAnalyzer
,
IBuiltInAnalyzer
{
public
const
string
DiagnosticId
=
"RenameTracking"
;
private
static
LocalizableString
s_localizableTitle
=
new
LocalizableResourceString
(
nameof
(
EditorFeaturesResources
.
RenameTracking
),
EditorFeaturesResources
.
ResourceManager
,
typeof
(
EditorFeaturesResources
));
private
static
LocalizableString
s_localizableMessage
=
new
LocalizableResourceString
(
nameof
(
EditorFeaturesResources
.
RenameTo
),
EditorFeaturesResources
.
ResourceManager
,
typeof
(
EditorFeaturesResources
));
public
static
DiagnosticDescriptor
DiagnosticDescriptor
=
new
TriggerDiagnosticDescriptor
(
DiagnosticId
,
customTags
:
DiagnosticCustomTags
.
Microsoft
.
Append
(
WellKnownDiagnosticTags
.
NotConfigurable
));
// TODO: Ideally we'd use a TriggerDiagnosticDescriptor here. However, this analyzer uses the message to communicate
// with it's fixer about what has changed. This analysis is not trivial to do for the fixer because of the temporal nature
// of this diagnostic. We should consider adding a field on diagnostic that is for extra data. If we have that we can
// turn this into a trigger diagnostic. For now, this just has the "NotConfigurable" tag to not show in the ruleset editor.
public
static
DiagnosticDescriptor
DiagnosticDescriptor
=
new
DiagnosticDescriptor
(
DiagnosticId
,
s_localizableTitle
,
s_localizableMessage
,
""
,
DiagnosticSeverity
.
Hidden
,
isEnabledByDefault
:
true
,
customTags
:
DiagnosticCustomTags
.
Microsoft
.
Append
(
WellKnownDiagnosticTags
.
NotConfigurable
));
internal
const
string
RenameFromPropertyKey
=
"RenameFrom"
;
internal
const
string
RenameToPropertyKey
=
"RenameTo"
;
public
override
ImmutableArray
<
DiagnosticDescriptor
>
SupportedDiagnostics
{
...
...
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.StateMachine.cs
浏览文件 @
d17c4102
...
...
@@ -15,6 +15,7 @@
using
Microsoft.CodeAnalysis.Text
;
using
Microsoft.VisualStudio.Text
;
using
Roslyn.Utilities
;
using
System.Collections.Immutable
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking
{
...
...
@@ -251,10 +252,16 @@ internal async Task<IEnumerable<Diagnostic>> GetDiagnostic(SyntaxTree tree, Diag
{
SnapshotSpan
snapshotSpan
=
trackingSession
.
TrackingSpan
.
GetSpan
(
Buffer
.
CurrentSnapshot
);
var
textSpan
=
snapshotSpan
.
Span
.
ToTextSpan
();
var
builder
=
ImmutableDictionary
.
CreateBuilder
<
string
,
string
>();
builder
.
Add
(
RenameTrackingDiagnosticAnalyzer
.
RenameFromPropertyKey
,
trackingSession
.
OriginalName
);
builder
.
Add
(
RenameTrackingDiagnosticAnalyzer
.
RenameToPropertyKey
,
snapshotSpan
.
GetText
());
var
properties
=
builder
.
ToImmutable
();
var
diagnostic
=
Diagnostic
.
Create
(
diagnosticDescriptor
,
tree
.
GetLocation
(
textSpan
),
trackingSession
.
OriginalName
,
snapshotSpan
.
GetText
());
properties
);
return
SpecializedCollections
.
SingletonEnumerable
(
diagnostic
);
}
...
...
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.cs
浏览文件 @
d17c4102
...
...
@@ -137,12 +137,12 @@ internal static async Task<IEnumerable<Diagnostic>> GetDiagnosticsAsync(SyntaxTr
bool
showPreview
)
{
// This can run on a background thread.
string
message
=
diagnostic
.
GetMessage
();
if
(
showPreview
)
{
message
+=
EditorFeaturesResources
.
WithPreview
;
}
var
renameToResourceString
=
showPreview
?
EditorFeaturesResources
.
RenameToWithPreview
:
EditorFeaturesResources
.
RenameTo
;
var
message
=
string
.
Format
(
renameToResourceString
,
diagnostic
.
Properties
[
RenameTrackingDiagnosticAnalyzer
.
RenameFromPropertyKey
],
diagnostic
.
Properties
[
RenameTrackingDiagnosticAnalyzer
.
RenameToPropertyKey
]);
return
new
RenameTrackingCodeAction
(
document
,
message
,
refactorNotifyServices
,
undoHistoryRegistry
,
showPreview
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录