Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 5ad6289

Browse files
Merge branch 'master' of github.com:icsharpcode/SharpDevelop
2 parents 99e9fad + 1a49794 commit 5ad6289

File tree

17 files changed

+68
-67
lines changed

17 files changed

+68
-67
lines changed

src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private string[] GetRuleAssemblyList(bool replacePath)
276276
private void ChangeRuleAssembliesButtonClick( object sender, RoutedEventArgs e)
277277
{
278278
var stringListDialog = new StringListEditorDialog();
279-
stringListDialog.BrowseForDirectory = true;
279+
stringListDialog.ShowBrowse = true;
280280
stringListDialog.TitleText = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.ChooseRuleAssemblyDirectory}");
281281
stringListDialog.LoadList(GetRuleAssemblyList(false));
282282
stringListDialog.ShowDialog();

src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public static void PopulateStringListEditor(string title, string listCaption,Tex
165165
var stringListDialog = new StringListEditorDialog();
166166
stringListDialog.TitleText = title;
167167
stringListDialog.ListCaption = listCaption;
168-
stringListDialog.BrowseForDirectory = browseForDirectoty;
168+
stringListDialog.ShowBrowse = browseForDirectoty;
169169
string[] strings = textBox.Text.Split(';');
170170
stringListDialog.LoadList (strings);
171171
stringListDialog.ShowDialog();

src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingSymbolsPanel.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop">
66

77
<Grid>
8-
<gui:StringListEditorXaml x:Name="editor" BrowseForDirectory="True"></gui:StringListEditorXaml>
8+
<gui:StringListEditor x:Name="editor" ShowBrowse="True" />
99
</Grid>
1010
</optionpanels:OptionPanel>

src/AddIns/Misc/PackageManagement/SharpDevelop.EnvDTE/Src/CodeElements.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ Namespace EnvDTE
2424

2525
Function Item(index As Object) As CodeElement
2626

27-
Function GetEnumerator() As IEnumerator
27+
Shadows Function GetEnumerator() As IEnumerator
2828
End Interface
2929
End Namespace

src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/AddOptionalParameterToInvocationAction.cs

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2424
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2525
// THE SOFTWARE.
26+
using System;
2627
using ICSharpCode.NRefactory.CSharp;
2728
using System.Collections.Generic;
2829
using System.Linq;
30+
using ICSharpCode.NRefactory.CSharp.Resolver;
2931
using ICSharpCode.NRefactory.Semantics;
3032
using ICSharpCode.NRefactory.Xml;
3133
using ICSharpCode.NRefactory.Documentation;
@@ -43,44 +45,28 @@ public override IEnumerable<CodeAction> GetActions(RefactoringContext context)
4345
if (invocationExpression == null)
4446
yield break;
4547

46-
var resolveResult = context.Resolve(invocationExpression) as InvocationResolveResult;
48+
var resolveResult = context.Resolve(invocationExpression) as CSharpInvocationResolveResult;
4749
if (resolveResult == null) {
4850
yield break;
4951
}
50-
52+
5153
var method = (IMethod)resolveResult.Member;
52-
53-
bool foundOptionalParameter = false;
54-
foreach (var parameter in method.Parameters) {
55-
if (parameter.IsParams) {
56-
yield break;
57-
}
58-
59-
if (parameter.IsOptional) {
60-
foundOptionalParameter = true;
61-
break;
54+
bool[] parameterIsSpecified = new bool[method.Parameters.Count];
55+
var argumentToParameterMap = resolveResult.GetArgumentToParameterMap();
56+
if (argumentToParameterMap != null) {
57+
foreach (int paramIndex in argumentToParameterMap)
58+
parameterIsSpecified[paramIndex] = true;
59+
} else {
60+
for (int i = 0; i < Math.Min(resolveResult.Arguments.Count, parameterIsSpecified.Length); i++) {
61+
parameterIsSpecified[i] = true;
6262
}
6363
}
64-
65-
if (!foundOptionalParameter) {
66-
yield break;
64+
var missingParameters = new List<IParameter>();
65+
for (int i = 0; i < method.Parameters.Count; i++) {
66+
if (!parameterIsSpecified[i] && method.Parameters[i].IsOptional)
67+
missingParameters.Add(method.Parameters[i]);
6768
}
68-
69-
//Basic sanity checks done, now see if there are any missing optional arguments
70-
var missingParameters = new List<IParameter>(method.Parameters);
71-
if (resolveResult.Arguments.Count != invocationExpression.Arguments.Count) {
72-
//Extension method
73-
missingParameters.RemoveAt (0);
74-
}
75-
foreach (var argument in invocationExpression.Arguments) {
76-
var namedArgument = argument as NamedArgumentExpression;
77-
if (namedArgument == null) {
78-
missingParameters.RemoveAt(0);
79-
} else {
80-
missingParameters.RemoveAll(parameter => parameter.Name == namedArgument.Name);
81-
}
82-
}
83-
69+
8470
foreach (var parameterToAdd in missingParameters) {
8571
//Add specific parameter
8672
yield return new CodeAction(string.Format(context.TranslateString("Add optional parameter \"{0}\""),

src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/CreateMethodDeclarationAction.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,10 @@ internal static string GuessNameFromType(IType returnType)
363363
case "System.Action":
364364
return "action";
365365
}
366-
return returnType.Name;
366+
if (returnType.Kind == TypeKind.Interface && returnType.Name.StartsWith("I", System.StringComparison.Ordinal))
367+
return returnType.Name.Substring(1);
368+
else
369+
return returnType.Name;
367370
}
368371

369372
string GetMethodName(InvocationExpression invocation)

src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3104,7 +3104,6 @@ private int consume_string (bool quoted)
31043104

31053105
value_builder[pos++] = (char) c;
31063106
}
3107-
recordNewLine = true;
31083107
}
31093108

31103109
private int consume_identifier (int s)

src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@
279279
<Compile Include="Src\Gui\Components\StringListEditorDialog.xaml.cs">
280280
<DependentUpon>StringListEditorDialog.xaml</DependentUpon>
281281
</Compile>
282-
<Compile Include="Src\Gui\Components\StringListEditorXaml.xaml.cs">
283-
<DependentUpon>StringListEditorXaml.xaml</DependentUpon>
282+
<Compile Include="Src\Gui\Components\StringListEditor.xaml.cs">
283+
<DependentUpon>StringListEditor.xaml</DependentUpon>
284284
<SubType>Code</SubType>
285285
</Compile>
286286
<Compile Include="Src\Gui\CustomFocusManager.cs" />
@@ -896,7 +896,7 @@
896896
<Page Include="Src\Editor\Dialogs\RenameSymbolDialog.xaml" />
897897
<Page Include="Src\Gui\Components\FontSelector.xaml" />
898898
<Page Include="Src\Gui\Components\StringListEditorDialog.xaml" />
899-
<Page Include="Src\Gui\Components\StringListEditorXaml.xaml" />
899+
<Page Include="Src\Gui\Components\StringListEditor.xaml" />
900900
<Page Include="Src\Gui\Dialogs\OptionPanels\ExternalToolPanel.xaml" />
901901
<Page Include="Src\Gui\Dialogs\OptionPanels\IDEOptions\CodeGenerationPanel.xaml" />
902902
<Page Include="Src\Gui\Dialogs\OptionPanels\IDEOptions\EditStandardHeaderPanel.xaml" />

src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml renamed to src/Main/Base/Project/Src/Gui/Components/StringListEditor.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<UserControl
3-
x:Class="ICSharpCode.SharpDevelop.Gui.StringListEditorXaml"
3+
x:Class="ICSharpCode.SharpDevelop.Gui.StringListEditor"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
@@ -37,7 +37,7 @@
3737
<Button x:Name="addButton"
3838
IsEnabled="False"
3939
Click="AddButton_Click"
40-
Content="{core:Localize Dialog.ProjectOptions.ReferencePaths.AddPath}"
40+
Content="{Binding AddButtonText}"
4141
Style="{x:Static core:GlobalStyles.ButtonStyle}">
4242
</Button>
4343

src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml.cs renamed to src/Main/Base/Project/Src/Gui/Components/StringListEditor.xaml.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
namespace ICSharpCode.SharpDevelop.Gui
2727
{
2828
/// <summary>
29-
/// Interaction logic for StringListEditorXaml.xaml
29+
/// Interaction logic for StringListEditor.xaml
3030
/// </summary>
31-
public partial class StringListEditorXaml : UserControl
31+
public partial class StringListEditor : UserControl
3232
{
33-
bool browseForDirectory;
33+
bool showBrowse;
3434
public event EventHandler ListChanged;
3535

36-
public StringListEditorXaml()
36+
public StringListEditor()
3737
{
3838
InitializeComponent();
3939
moveUpButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.ArrowUp") };
@@ -44,16 +44,18 @@ public StringListEditorXaml()
4444

4545
public string TitleText {get;set;}
4646

47+
public string AddButtonText { get; set; }
48+
4749
public string ListCaption {get;set;}
4850

4951

50-
public bool BrowseForDirectory {
52+
public bool ShowBrowse {
5153
get {
52-
return browseForDirectory;
54+
return showBrowse;
5355
}
5456
set {
55-
browseForDirectory = value;
56-
if (browseForDirectory) {
57+
showBrowse = value;
58+
if (showBrowse) {
5759
browseButton.Visibility = Visibility.Visible;
5860
} else {
5961
browseButton.Visibility = Visibility.Hidden;

0 commit comments

Comments
 (0)