Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
08f85242
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,发现更多精彩内容 >>
提交
08f85242
编写于
12月 13, 2019
作者:
I
Ivan Basov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dialog ui update
上级
7cc728c0
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
95 addition
and
119 deletion
+95
-119
src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialog.xaml
...ef/Implementation/ChangeSignature/AddParameterDialog.xaml
+73
-72
src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialog.xaml.cs
...Implementation/ChangeSignature/AddParameterDialog.xaml.cs
+1
-26
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialogViewModel.cs
...ntation/ChangeSignature/ChangeSignatureDialogViewModel.cs
+20
-19
src/VisualStudio/Core/Def/Implementation/ChangeSignature/VisualStudioChangeSignatureOptionsService.cs
...ngeSignature/VisualStudioChangeSignatureOptionsService.cs
+1
-1
src/VisualStudio/Core/Def/Implementation/IntellisenseControls/IntellisenseTextBoxViewModelFactory.cs
...tellisenseControls/IntellisenseTextBoxViewModelFactory.cs
+0
-1
未找到文件。
src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialog.xaml
浏览文件 @
08f85242
...
...
@@ -6,8 +6,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0" xmlns:changesignature="clr-namespace:Microsoft.VisualStudio.LanguageServices.Implementation.ChangeSignature"
Height="300" Width="600"
MinHeight="300" MinWidth="600"
Height="300" Width="500"
MinHeight="300" MinWidth="500"
MaxHeight="400" MaxWidth="600"
Title="{Binding ElementName=dialog, Path=AddParameterDialogTitle}"
HasHelpButton="False"
ResizeMode="CanResizeWithGrip"
...
...
@@ -15,11 +16,7 @@
HasDialogFrame="True"
WindowStartupLocation="CenterOwner">
<Window.Resources>
<Thickness x:Key="labelPadding">0, 5, 0, 2</Thickness>
<Thickness x:Key="okCancelButtonPadding">9,2,9,2</Thickness>
<Thickness x:Key="selectDeselectButtonPadding">9,2,9,2</Thickness>
<Thickness x:Key="cellPadding">4 0 8 0</Thickness>
<Thickness x:Key="textboxPadding">2</Thickness>
</Window.Resources>
<Grid Name="ContentGrid" Margin="11,6,11,11">
<Grid.RowDefinitions>
...
...
@@ -27,24 +24,28 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
/>
<ColumnDefinition
/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0"
Name="Table" Margin="11,6,11,11">
<Grid Grid.Row="0"
Name="Table">
<Grid.RowDefinitions>
<RowDefinition Height="
50"/>
<RowDefinition Height="
50"/>
<RowDefinition Height="
50"/>
<RowDefinition Height="
1*"/>
<RowDefinition Height="
1*"/>
<RowDefinition Height="
1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="
400" />
<ColumnDefinition Width="
350" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{Binding ElementName=dialog, Path=TypeNameLabel}" />
<Border Grid.Row="0" Grid.Column="1" BorderThickness="1" Margin="6,0,0,0"> <ContentControl x:Name="TypeContentControl" Focusable="True" PreviewKeyDown="TypeNameContentControl_PreviewKeyDown" Margin="100,0,100,15" BorderBrush="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}" /> </Border>
<Border Grid.Row="0" Grid.Column="1" BorderThickness="1" Margin="5,5,5,5">
<ContentControl x:Name="TypeContentControl" Focusable="True" Margin="0,0,0,0" PreviewKeyDown="TypeNameContentControl_PreviewKeyDown"/>
</Border>
<Label Grid.Row="1" Grid.Column="0" Content="{Binding ElementName=dialog, Path=ParameterNameLabel}" />
<Border Grid.Row="1" Grid.Column="1" BorderThickness="1" Margin="6,0,0,0"> <ContentControl x:Name="NameContentControl" Focusable="True" PreviewKeyDown="TypeNameContentControl_PreviewKeyDown" Margin="100,0,100,15" BorderBrush="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}" /> </Border>
<Border Grid.Row="1" Grid.Column="1" BorderThickness="1" Margin="5,5,5,5">
<ContentControl x:Name="NameContentControl" Focusable="True" Margin="0,0,0,0" PreviewKeyDown="TypeNameContentControl_PreviewKeyDown"/>
</Border>
<Label Grid.Row="2" Grid.Column="0" Content="{Binding ElementName=dialog, Path=CallsiteValueLabel}" />
<TextBox Grid.Row="2" Grid.Column="1"
Width="200" Text="{Binding CallsiteValue, Mode=TwoWay}" Margin="100,0,100,15" />
<TextBox Grid.Row="2" Grid.Column="1"
Text="{Binding CallsiteValue, Mode=TwoWay}" Margin="5,5,5,5" />
</Grid>
<StackPanel Grid.Row="1"
HorizontalAlignment="Right"
...
...
src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialog.xaml.cs
浏览文件 @
08f85242
...
...
@@ -16,17 +16,6 @@ internal partial class AddParameterDialog : DialogWindow
public
readonly
AddParameterDialogViewModel
ViewModel
;
private
readonly
IntellisenseTextBoxViewModel
_typeIntellisenseTextBoxView
;
private
readonly
IntellisenseTextBoxViewModel
_nameIntellisenseTextBoxView
;
private
bool
_isValid
;
private
bool
IsValid
{
get
{
return
_isValid
;
}
set
{
this
.
OKButton
.
IsEnabled
=
value
;
_isValid
=
value
;
}
}
public
string
OK
{
get
{
return
ServicesVSResources
.
OK
;
}
}
public
string
Cancel
{
get
{
return
ServicesVSResources
.
Cancel
;
}
}
...
...
@@ -50,9 +39,6 @@ private bool IsValid
this
.
Loaded
+=
AddParameterDialog_Loaded
;
DataContext
=
ViewModel
;
// This is for Add. For edit, it should be true by default.
_isValid
=
false
;
InitializeComponent
();
}
...
...
@@ -65,8 +51,6 @@ private void AddParameterDialog_Loaded(object sender, RoutedEventArgs e)
IntellisenseTextBox
nameTextBox
=
new
IntellisenseTextBox
(
_nameIntellisenseTextBoxView
,
NameContentControl
);
this
.
NameContentControl
.
Content
=
nameTextBox
;
this
.
OKButton
.
IsEnabled
=
_isValid
;
}
private
void
OK_Click
(
object
sender
,
RoutedEventArgs
e
)
...
...
@@ -74,6 +58,7 @@ private void OK_Click(object sender, RoutedEventArgs e)
if
(
ViewModel
.
TrySubmit
())
{
ViewModel
.
TypeName
=
((
IntellisenseTextBox
)
TypeContentControl
.
Content
).
Text
;
ViewModel
.
ParameterName
=
((
IntellisenseTextBox
)
NameContentControl
.
Content
).
Text
;
DialogResult
=
true
;
}
}
...
...
@@ -113,15 +98,5 @@ private void TypeNameContentControl_PreviewKeyDown(object sender, KeyEventArgs e
}
}
}
private
void
TextBox_ParameterNameChanged
(
object
sender
,
System
.
Windows
.
Controls
.
TextChangedEventArgs
e
)
{
// check for empty
// check for starting with non-letter
// check for special symbols
// check for matching other parameter names
// if not valid and _isValid, then _isValid = false;
// if valid and !_isValid, then validate all controls
}
}
}
src/VisualStudio/Core/Def/Implementation/ChangeSignature/ChangeSignatureDialogViewModel.cs
浏览文件 @
08f85242
...
...
@@ -23,8 +23,8 @@ internal class ChangeSignatureDialogViewModel : AbstractNotifyPropertyChanged
private
readonly
ParameterConfiguration
_originalParameterConfiguration
;
private
readonly
ParameterViewModel
_thisParameter
;
private
readonly
List
<
ParameterViewModel
>
_parameter
Group1
;
private
readonly
List
<
ParameterViewModel
>
_parameter
Group2
;
private
readonly
List
<
ParameterViewModel
>
_parameter
sWithoutDefaultValues
;
private
readonly
List
<
ParameterViewModel
>
_parameter
sWithDefaultValues
;
private
readonly
ParameterViewModel
_paramsParameter
;
private
HashSet
<
ParameterViewModel
>
_disabledParameters
=
new
HashSet
<
ParameterViewModel
>();
public
readonly
int
InsertPosition
;
...
...
@@ -58,8 +58,8 @@ internal class ChangeSignatureDialogViewModel : AbstractNotifyPropertyChanged
_declarationParts
=
symbol
.
ToDisplayParts
(
s_symbolDeclarationDisplayFormat
);
_parameter
Group1
=
parameters
.
ParametersWithoutDefaultValues
.
Select
(
p
=>
new
ExistingParameterViewModel
(
this
,
p
,
initialIndex
++)).
ToList
<
ParameterViewModel
>();
_parameter
Group2
=
parameters
.
RemainingEditableParameters
.
Select
(
p
=>
new
ExistingParameterViewModel
(
this
,
p
,
initialIndex
++)).
ToList
<
ParameterViewModel
>();
_parameter
sWithoutDefaultValues
=
parameters
.
ParametersWithoutDefaultValues
.
Select
(
p
=>
new
ExistingParameterViewModel
(
this
,
p
,
initialIndex
++)).
ToList
<
ParameterViewModel
>();
_parameter
sWithDefaultValues
=
parameters
.
RemainingEditableParameters
.
Select
(
p
=>
new
ExistingParameterViewModel
(
this
,
p
,
initialIndex
++)).
ToList
<
ParameterViewModel
>();
if
(
parameters
.
ParamsParameter
!=
null
)
{
...
...
@@ -159,7 +159,7 @@ public bool CanEdit
}
// Cannot edit params parameter
if
(
index
>=
(
_thisParameter
==
null
?
0
:
1
)
+
_parameter
Group1
.
Count
+
_parameterGroup2
.
Count
)
if
(
index
>=
(
_thisParameter
==
null
?
0
:
1
)
+
_parameter
sWithoutDefaultValues
.
Count
+
_parametersWithDefaultValues
.
Count
)
{
return
false
;
}
...
...
@@ -172,7 +172,8 @@ internal void Remove()
{
if
(
AllParameters
[
_selectedIndex
.
Value
]
is
AddedParameterViewModel
)
{
AllParameters
.
Remove
(
AllParameters
[
_selectedIndex
.
Value
]);
ParameterViewModel
parameterToRemove
=
AllParameters
[
_selectedIndex
.
Value
];
_parametersWithoutDefaultValues
.
Remove
(
parameterToRemove
);
}
else
{
...
...
@@ -190,7 +191,7 @@ internal void Restore()
internal
void
AddParameter
(
AddedParameter
addedParameter
)
{
_parameter
Group1
.
Add
(
new
AddedParameterViewModel
(
this
,
addedParameter
));
_parameter
sWithoutDefaultValues
.
Add
(
new
AddedParameterViewModel
(
this
,
addedParameter
));
RemoveRestoreNotifyPropertyChanged
();
}
...
...
@@ -213,8 +214,8 @@ internal ParameterConfiguration GetParameterConfiguration()
{
return
new
ParameterConfiguration
(
_originalParameterConfiguration
.
ThisParameter
,
_parameter
Group1
.
Where
(
p
=>
!
p
.
IsRemoved
).
Select
(
p
=>
p
.
CreateParameter
()).
ToList
(),
_parameter
Group2
.
Where
(
p
=>
!
p
.
IsRemoved
).
Select
(
p
=>
p
.
CreateParameter
()).
ToList
(),
_parameter
sWithoutDefaultValues
.
Where
(
p
=>
!
p
.
IsRemoved
).
Select
(
p
=>
p
.
CreateParameter
()).
ToList
(),
_parameter
sWithDefaultValues
.
Where
(
p
=>
!
p
.
IsRemoved
).
Select
(
p
=>
p
.
CreateParameter
()).
ToList
(),
(
_paramsParameter
==
null
||
_paramsParameter
.
IsRemoved
)
?
null
:
(
_paramsParameter
as
ExistingParameterViewModel
).
CreateParameter
(),
selectedIndex
:
-
1
);
}
...
...
@@ -312,8 +313,8 @@ public List<ParameterViewModel> AllParameters
list
.
Add
(
_thisParameter
);
}
list
.
AddRange
(
_parameter
Group1
);
list
.
AddRange
(
_parameter
Group2
);
list
.
AddRange
(
_parameter
sWithoutDefaultValues
);
list
.
AddRange
(
_parameter
sWithDefaultValues
);
if
(
_paramsParameter
!=
null
)
{
...
...
@@ -335,7 +336,7 @@ public bool CanMoveUp
var
index
=
SelectedIndex
.
Value
;
index
=
_thisParameter
==
null
?
index
:
index
-
1
;
if
(
index
<=
0
||
index
==
_parameter
Group1
.
Count
||
index
>=
_parameterGroup1
.
Count
+
_parameterGroup2
.
Count
)
if
(
index
<=
0
||
index
==
_parameter
sWithoutDefaultValues
.
Count
||
index
>=
_parametersWithoutDefaultValues
.
Count
+
_parametersWithDefaultValues
.
Count
)
{
return
false
;
}
...
...
@@ -355,7 +356,7 @@ public bool CanMoveDown
var
index
=
SelectedIndex
.
Value
;
index
=
_thisParameter
==
null
?
index
:
index
-
1
;
if
(
index
<
0
||
index
==
_parameter
Group1
.
Count
-
1
||
index
>=
_parameterGroup1
.
Count
+
_parameterGroup2
.
Count
-
1
)
if
(
index
<
0
||
index
==
_parameter
sWithoutDefaultValues
.
Count
-
1
||
index
>=
_parametersWithoutDefaultValues
.
Count
+
_parametersWithDefaultValues
.
Count
-
1
)
{
return
false
;
}
...
...
@@ -370,7 +371,7 @@ internal void MoveUp()
var
index
=
SelectedIndex
.
Value
;
index
=
_thisParameter
==
null
?
index
:
index
-
1
;
Move
(
index
<
_parameter
Group1
.
Count
?
_parameterGroup1
:
_parameterGroup2
,
index
<
_parameterGroup1
.
Count
?
index
:
index
-
_parameterGroup1
.
Count
,
delta
:
-
1
);
Move
(
index
<
_parameter
sWithoutDefaultValues
.
Count
?
_parametersWithoutDefaultValues
:
_parametersWithDefaultValues
,
index
<
_parametersWithoutDefaultValues
.
Count
?
index
:
index
-
_parametersWithoutDefaultValues
.
Count
,
delta
:
-
1
);
}
internal
void
MoveDown
()
...
...
@@ -379,7 +380,7 @@ internal void MoveDown()
var
index
=
SelectedIndex
.
Value
;
index
=
_thisParameter
==
null
?
index
:
index
-
1
;
Move
(
index
<
_parameter
Group1
.
Count
?
_parameterGroup1
:
_parameterGroup2
,
index
<
_parameterGroup1
.
Count
?
index
:
index
-
_parameterGroup1
.
Count
,
delta
:
1
);
Move
(
index
<
_parameter
sWithoutDefaultValues
.
Count
?
_parametersWithoutDefaultValues
:
_parametersWithDefaultValues
,
index
<
_parametersWithoutDefaultValues
.
Count
?
index
:
index
-
_parametersWithoutDefaultValues
.
Count
,
delta
:
1
);
}
private
void
Move
(
List
<
ParameterViewModel
>
list
,
int
index
,
int
delta
)
...
...
@@ -410,7 +411,7 @@ private IList<ParameterViewModel> GetSelectedGroup()
{
var
index
=
SelectedIndex
;
index
=
_thisParameter
==
null
?
index
:
index
-
1
;
return
index
<
_parameter
Group1
.
Count
?
_parameterGroup1
:
index
<
_parameterGroup1
.
Count
+
_parameterGroup2
.
Count
?
_parameterGroup2
:
SpecializedCollections
.
EmptyList
<
ParameterViewModel
>();
return
index
<
_parameter
sWithoutDefaultValues
.
Count
?
_parametersWithoutDefaultValues
:
index
<
_parametersWithoutDefaultValues
.
Count
+
_parametersWithDefaultValues
.
Count
?
_parametersWithDefaultValues
:
SpecializedCollections
.
EmptyList
<
ParameterViewModel
>();
}
public
bool
IsOkButtonEnabled
...
...
@@ -673,13 +674,13 @@ public bool NeedsBottomBorder
return
true
;
}
if
(
this
==
changeSignatureDialogViewModel
.
_parameter
Group1
.
LastOrDefault
()
&&
(
changeSignatureDialogViewModel
.
_parameter
Group2
.
Any
()
||
changeSignatureDialogViewModel
.
_paramsParameter
!=
null
))
if
(
this
==
changeSignatureDialogViewModel
.
_parameter
sWithoutDefaultValues
.
LastOrDefault
()
&&
(
changeSignatureDialogViewModel
.
_parameter
sWithDefaultValues
.
Any
()
||
changeSignatureDialogViewModel
.
_paramsParameter
!=
null
))
{
return
true
;
}
if
(
this
==
changeSignatureDialogViewModel
.
_parameter
Group2
.
LastOrDefault
()
&&
if
(
this
==
changeSignatureDialogViewModel
.
_parameter
sWithDefaultValues
.
LastOrDefault
()
&&
changeSignatureDialogViewModel
.
_paramsParameter
!=
null
)
{
return
true
;
...
...
src/VisualStudio/Core/Def/Implementation/ChangeSignature/VisualStudioChangeSignatureOptionsService.cs
浏览文件 @
08f85242
...
...
@@ -101,7 +101,7 @@ public AddedParameterResult GetAddedParameter(Document document, int insertPosit
var
documentText
=
sourceText
.
ToString
();
var
rolesCollection1
=
new
[]
{
PredefinedTextViewRoles
.
Editable
,
PredefinedTextViewRoles
.
Interactive
,
AddParameterTextViewRole
,
AddParameterTypeTextViewRole
};
AddParameterTextViewRole
,
AddParameterTypeTextViewRole
};
var
rolesCollection2
=
new
[]
{
PredefinedTextViewRoles
.
Editable
,
PredefinedTextViewRoles
.
Interactive
,
AddParameterTextViewRole
,
AddParameterNameTextViewRole
};
var
rolesCollections
=
new
[]
{
rolesCollection1
,
rolesCollection2
};
...
...
src/VisualStudio/Core/Def/Implementation/IntellisenseControls/IntellisenseTextBoxViewModelFactory.cs
浏览文件 @
08f85242
...
...
@@ -5,7 +5,6 @@
using
System.Threading
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Formatting
;
using
Microsoft.CodeAnalysis.Host.Mef
;
using
Microsoft.CodeAnalysis.Text
;
using
Microsoft.VisualStudio.Editor
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录