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

Commit 0e2cb73

Browse files
Merge branch 'master' of github.com:icsharpcode/SharpDevelop
2 parents 9f7b8f4 + 40e5ec6 commit 0e2cb73

29 files changed

Lines changed: 347 additions & 81 deletions

data/resources/StringResources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,6 +1729,9 @@ Examples: "120", "MainClass", "Main.cs, 120".</value>
17291729
<data name="Dialog.HighlightingEditor.ColorDlg.Italic" xml:space="preserve">
17301730
<value>Italic</value>
17311731
</data>
1732+
<data name="Dialog.HighlightingEditor.ColorDlg.Underline" xml:space="preserve">
1733+
<value>Underlined</value>
1734+
</data>
17321735
<data name="Dialog.HighlightingEditor.Export" xml:space="preserve">
17331736
<value>Export highlighting colors</value>
17341737
</data>

src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<Compile Include="Src\Completion\CSharpCompletionContext.cs" />
7979
<Compile Include="Src\Completion\CSharpInsightItem.cs" />
8080
<Compile Include="Src\Completion\CSharpMethodInsight.cs" />
81+
<Compile Include="Src\Completion\EnumMemberCompletionData.cs" />
8182
<Compile Include="Src\Completion\EventCreationCompletionData.cs" />
8283
<Compile Include="Src\Completion\FormatItemCompletionData.cs" />
8384
<Compile Include="Src\Completion\ImportCompletionData.cs" />

src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232

3333
<!-- Colors used for semantic highlighting -->
3434
<Color name="ReferenceTypes" foreground="#004085" exampleText="System.#{#Uri#}# uri;"/>
35+
<Color name="InterfaceTypes" foreground="#004085" exampleText="System.#{#IDisposable#}# obj;"/>
36+
<Color name="TypeParameters" foreground="#004085" exampleText="class MyList&lt;#{#T#}#&gt; { }"/>
37+
<Color name="DelegateTypes" foreground="#004085" exampleText="System.#{#Action#}#; action;"/>
3538
<Color name="ValueTypes" fontWeight="bold" foreground="#004085" exampleText="System.#{#DateTime#}# date;"/>
39+
<Color name="EnumTypes" fontWeight="bold" foreground="#004085" exampleText="System.#{#ConsoleKey#}# key;"/>
3640
<Color name="MethodCall" foreground="MidnightBlue" fontWeight="bold" exampleText="o.#{#ToString#}#();"/>
3741
<Color name="FieldAccess" fontStyle="italic" exampleText="return this.#{#name#}#;"/>
3842
<Color name="InactiveCode" foreground="Gray" exampleText="#{#Deactivated by #if#}#"/>

src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ public CSharpSemanticHighlighterVisitor(CSharpSemanticHighlighter highlighter, I
5858
//this.defaultTextColor = ???;
5959
this.referenceTypeColor = highlighting.GetNamedColor("ReferenceTypes");
6060
this.valueTypeColor = highlighting.GetNamedColor("ValueTypes");
61-
this.interfaceTypeColor = this.referenceTypeColor;
62-
this.enumerationTypeColor = this.valueKeywordColor;
63-
this.typeParameterTypeColor = this.referenceTypeColor;
64-
this.delegateTypeColor = this.referenceTypeColor;
61+
this.interfaceTypeColor = highlighting.GetNamedColor("InterfaceTypes");
62+
this.enumerationTypeColor = highlighting.GetNamedColor("EnumTypes");
63+
this.typeParameterTypeColor = highlighting.GetNamedColor("TypeParameters");
64+
this.delegateTypeColor = highlighting.GetNamedColor("DelegateType");
6565
this.methodDeclarationColor = this.methodCallColor = highlighting.GetNamedColor("MethodCall");
6666
//this.eventDeclarationColor = this.eventAccessColor = defaultTextColor;
6767
//this.propertyDeclarationColor = this.propertyAccessColor = defaultTextColor;

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ static string StripAttributeSuffix(string text)
8686

8787
ICompletionData ICompletionDataFactory.CreateMemberCompletionData(IType type, IEntity member)
8888
{
89-
string typeName = builder.ConvertType(type).ToString();
90-
return new CompletionData(typeName + "." + member.Name);
89+
return new EnumMemberCompletionData(type, member, builder);
9190
}
9291

9392
ICompletionData ICompletionDataFactory.CreateLiteralCompletionData(string title, string description, string insertText)

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ public IEntity Entity {
3737
public EntityCompletionData(IEntity entity) : base(entity.Name)
3838
{
3939
this.entity = entity;
40-
this.Description = entity.Documentation;
4140
this.Image = ClassBrowserIconService.GetIcon(entity);
41+
// don't set this.Description -- we use CreateFancyDescription() instead,
42+
// and accessing entity.Documentation in the constructor is too slow
4243
}
4344

4445
protected override object CreateFancyDescription()
4546
{
4647
return new FlowDocumentScrollViewer {
47-
Document = XmlDocFormatter.CreateTooltip(entity, false),
48+
Document = XmlDocFormatter.CreateTooltip(entity, entity is ITypeDefinition),
4849
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
4950
};
5051
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
// software and associated documentation files (the "Software"), to deal in the Software
5+
// without restriction, including without limitation the rights to use, copy, modify, merge,
6+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7+
// to whom the Software is furnished to do so, subject to the following conditions:
8+
//
9+
// The above copyright notice and this permission notice shall be included in all copies or
10+
// substantial portions of the Software.
11+
//
12+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17+
// DEALINGS IN THE SOFTWARE.
18+
19+
using System;
20+
using System.Linq;
21+
using System.Windows.Controls;
22+
using ICSharpCode.NRefactory.CSharp.Refactoring;
23+
using ICSharpCode.NRefactory.TypeSystem;
24+
using ICSharpCode.SharpDevelop;
25+
using ICSharpCode.SharpDevelop.Editor;
26+
namespace CSharpBinding.Completion
27+
{
28+
class EnumMemberCompletionData : CompletionData
29+
{
30+
IType enumType;
31+
32+
IEntity member;
33+
34+
public EnumMemberCompletionData(IType enumType, IEntity member, TypeSystemAstBuilder builder) : base(enumType.Name + "." + member.Name)
35+
{
36+
this.enumType = enumType;
37+
this.member = member;
38+
this.Image = ClassBrowserIconService.Const;
39+
this.CompletionText = builder.ConvertType(enumType).ToString() + "." + member.Name;
40+
}
41+
42+
protected override object CreateFancyDescription()
43+
{
44+
return new FlowDocumentScrollViewer {
45+
Document = XmlDocFormatter.CreateTooltip(member, false),
46+
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
47+
};
48+
}
49+
}
50+
}
51+
52+

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ public IType Type {
3535
public TypeCompletionData(IType type) : base(type.Name)
3636
{
3737
this.type = type;
38-
ITypeDefinition typeDef = type.GetDefinition();
39-
if (typeDef != null)
40-
this.Description = typeDef.Documentation;
4138
this.Image = ClassBrowserIconService.GetIcon(type);
39+
// don't set this.Description -- we use CreateFancyDescription() instead,
40+
// and accessing entity.Documentation in the constructor is too slow
4241
}
4342

4443
protected override object CreateFancyDescription()
4544
{
4645
return new FlowDocumentScrollViewer {
47-
Document = XmlDocFormatter.CreateTooltip(type, false),
46+
Document = XmlDocFormatter.CreateTooltip(type),
4847
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
4948
};
5049
}

src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,30 @@ public override IInsightWindow ShowInsightWindow(IEnumerable<IInsightItem> items
5555
{
5656
if (items == null)
5757
return null;
58-
var insightWindow = new SharpDevelopInsightWindow(this.TextEditor.TextArea);
59-
insightWindow.Items.AddRange(items);
60-
if (insightWindow.Items.Count > 0) {
61-
insightWindow.SelectedItem = insightWindow.Items[0];
58+
var insightWindow = textEditor.ActiveInsightWindow;
59+
bool isNewWindow = false;
60+
if (insightWindow == null) {
61+
insightWindow = new SharpDevelopInsightWindow(this.TextEditor.TextArea);
62+
isNewWindow = true;
63+
}
64+
var adapter = new SharpDevelopInsightWindowAdapter(insightWindow);
65+
adapter.Items.AddRange(items);
66+
if (adapter.Items.Count > 0) {
67+
adapter.SelectedItem = adapter.Items[0];
6268
} else {
6369
// don't open insight window when there are no items
6470
return null;
6571
}
66-
textEditor.ShowInsightWindow(insightWindow);
67-
return insightWindow;
72+
insightWindow.SetActiveAdapter(adapter, isNewWindow);
73+
if (isNewWindow)
74+
{
75+
textEditor.ShowInsightWindow(insightWindow);
76+
}
77+
return adapter;
6878
}
6979

7080
public override IInsightWindow ActiveInsightWindow {
71-
get { return textEditor.ActiveInsightWindow; }
81+
get { return textEditor.ActiveInsightWindow.activeAdapter; }
7282
}
7383

7484
public override ICompletionListWindow ActiveCompletionWindow {

src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class CustomizedHighlightingColor
4343

4444
public bool Bold { get; set; }
4545
public bool Italic { get; set; }
46+
public bool Underline { get; set; }
4647
public Color? Foreground { get; set; }
4748
public Color? Background { get; set; }
4849

0 commit comments

Comments
 (0)