Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6f30d11d
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,发现更多精彩内容 >>
提交
6f30d11d
编写于
4月 15, 2020
作者:
D
David Poeschl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show warning in ChangeSig dialog for duplicated param names
No warning in AddParam dialog yet
上级
0603145d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
10 deletion
+63
-10
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialog.xaml
...Implementation/ChangeSignature/ChangeSignatureDialog.xaml
+14
-7
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialogViewModel.ParameterViewModels.cs
...ure/ChangeSignatureDialogViewModel.ParameterViewModels.cs
+5
-3
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialogViewModel.cs
...ntation/ChangeSignature/ChangeSignatureDialogViewModel.cs
+44
-0
未找到文件。
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialog.xaml
浏览文件 @
6f30d11d
...
...
@@ -211,13 +211,20 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn x:Name="parameterHeader" Binding="{Binding ParameterName, Mode=OneWay}" Width="*" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="Padding" Value="{StaticResource ResourceKey=cellPadding}" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTemplateColumn x:Name="parameterHeader" Width="*" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<imaging:CrispImage
Moniker="{x:Static imagecatalog:KnownMonikers.StatusWarning}"
Visibility="{Binding HasParameterNameConflict, Mode=TwoWay}"
vs2:ImageThemingUtilities.ImageBackgroundColor="White"
Margin="0,0,5,0"/>
<TextBlock Text="{Binding ParameterName, Mode=OneWay}"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn x:Name="defaultHeader" Binding="{Binding DefaultValue, Mode=OneWay}" Width="*" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
...
...
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialogViewModel.ParameterViewModels.cs
浏览文件 @
6f30d11d
...
...
@@ -29,14 +29,16 @@ public abstract class ParameterViewModel
public
abstract
bool
IsRequired
{
get
;
}
public
abstract
string
DefaultValue
{
get
;
}
public
abstract
string
InitialIndex
{
get
;
}
public
abstract
string
Modifier
{
get
;
}
public
abstract
string
Default
{
get
;
}
public
ParameterViewModel
(
ChangeSignatureDialogViewModel
changeSignatureDialogViewModel
)
{
ChangeSignatureDialogViewModel
=
changeSignatureDialogViewModel
;
}
public
abstract
string
InitialIndex
{
get
;
}
public
abstract
string
Modifier
{
get
;
}
public
abstract
string
Default
{
get
;
}
public
Visibility
HasParameterNameConflict
{
get
;
set
;
}
public
virtual
Visibility
TypeWarningVisibility
=>
Visibility
.
Collapsed
;
...
...
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialogViewModel.cs
浏览文件 @
6f30d11d
...
...
@@ -9,6 +9,7 @@
using
System.Collections.Immutable
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Windows
;
using
System.Windows.Controls
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.ChangeSignature
;
...
...
@@ -41,6 +42,8 @@ internal partial class ChangeSignatureDialogViewModel : AbstractNotifyPropertyCh
private
ImmutableArray
<
SymbolDisplayPart
>
_declarationParts
;
private
bool
_previewChanges
;
private
readonly
Dictionary
<
string
,
List
<
ParameterViewModel
>>
_parameterNameOverlapMap
=
new
Dictionary
<
string
,
List
<
ParameterViewModel
>>();
/// <summary>
/// The document where the symbol we are changing signature is defined.
/// </summary>
...
...
@@ -82,6 +85,8 @@ internal partial class ChangeSignatureDialogViewModel : AbstractNotifyPropertyCh
_paramsParameter
=
new
ExistingParameterViewModel
(
this
,
parameters
.
ParamsParameter
,
initialDisplayIndex
++);
}
UpdateNameConflictMarkers
();
var
selectedIndex
=
parameters
.
SelectedIndex
;
// Currently, we do not support editing the ThisParameter.
// Therefore, if there is such parameter, we should move the selectedIndex.
...
...
@@ -104,6 +109,42 @@ internal partial class ChangeSignatureDialogViewModel : AbstractNotifyPropertyCh
}
}
private
void
UpdateNameConflictMarkers
()
{
var
parameterNameOverlapMap
=
new
Dictionary
<
string
,
List
<
ParameterViewModel
>>();
foreach
(
var
parameter
in
AllParameters
)
{
if
(!
parameter
.
IsRemoved
)
{
parameterNameOverlapMap
.
GetOrAdd
(
parameter
.
ParameterName
,
_
=>
new
List
<
ParameterViewModel
>())
.
Add
(
parameter
);
}
else
{
parameter
.
HasParameterNameConflict
=
Visibility
.
Collapsed
;
}
}
foreach
(
var
parameterName
in
parameterNameOverlapMap
.
Keys
)
{
var
matchingParameters
=
parameterNameOverlapMap
[
parameterName
];
if
(
matchingParameters
.
Count
>
1
)
{
foreach
(
var
matchingParameter
in
matchingParameters
)
{
matchingParameter
.
HasParameterNameConflict
=
Visibility
.
Visible
;
}
}
else
{
matchingParameters
.
Single
().
HasParameterNameConflict
=
Visibility
.
Collapsed
;
}
}
NotifyPropertyChanged
(
nameof
(
AllParameters
));
}
public
AddParameterDialogViewModel
CreateAddParameterDialogViewModel
()
=>
new
AddParameterDialogViewModel
(
_document
,
_insertPosition
);
...
...
@@ -209,12 +250,14 @@ internal void Remove()
AllParameters
[
_selectedIndex
!.
Value
].
IsRemoved
=
true
;
}
UpdateNameConflictMarkers
();
RemoveRestoreNotifyPropertyChanged
();
}
internal
void
Restore
()
{
AllParameters
[
_selectedIndex
!.
Value
].
IsRemoved
=
false
;
UpdateNameConflictMarkers
();
RemoveRestoreNotifyPropertyChanged
();
}
...
...
@@ -229,6 +272,7 @@ internal void AddParameter(AddedParameter addedParameter)
_parametersWithDefaultValues
.
Add
(
new
AddedParameterViewModel
(
this
,
addedParameter
));
}
UpdateNameConflictMarkers
();
RemoveRestoreNotifyPropertyChanged
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录