Browse Source

C# syntax highlighting: Move contextual keywords into other keyword categories

Semantic highlighting will undo the keyword highlighting when the keyword is used as an identifier.
pull/32/merge
Daniel Grunwald 13 years ago
parent
commit
658c1d2c53
  1. 20
      src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd
  2. 4
      src/Main/Base/Project/Src/Services/RefactoringService/FindReferenceService.cs

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

@ -17,7 +17,7 @@
<Color name="NullOrValueKeywords" fontWeight="bold" exampleText="if (value == null)"/> <Color name="NullOrValueKeywords" fontWeight="bold" exampleText="if (value == null)"/>
<Color name="Keywords" fontWeight="bold" foreground="Blue" exampleText="if (a) {} else {}"/> <Color name="Keywords" fontWeight="bold" foreground="Blue" exampleText="if (a) {} else {}"/>
<Color name="GotoKeywords" foreground="Navy" exampleText="continue; return null;"/> <Color name="GotoKeywords" foreground="Navy" exampleText="continue; return null;"/>
<Color name="ContextKeywords" foreground="Navy" exampleText="var a = from x in y select z;"/> <Color name="QueryKeywords" foreground="Navy" exampleText="from x in y select z;"/>
<Color name="ExceptionKeywords" fontWeight="bold" foreground="Teal" exampleText="try {} catch {} finally {}"/> <Color name="ExceptionKeywords" fontWeight="bold" foreground="Teal" exampleText="try {} catch {} finally {}"/>
<Color name="CheckedKeyword" fontWeight="bold" foreground="DarkGray" exampleText="checked {}"/> <Color name="CheckedKeyword" fontWeight="bold" foreground="DarkGray" exampleText="checked {}"/>
<Color name="UnsafeKeywords" foreground="Olive" exampleText="unsafe { fixed (..) {} }"/> <Color name="UnsafeKeywords" foreground="Olive" exampleText="unsafe { fixed (..) {} }"/>
@ -35,7 +35,7 @@
<Color name="ValueTypes" fontWeight="bold" foreground="#004085" exampleText="System.#{#DateTime#}# date;"/> <Color name="ValueTypes" fontWeight="bold" foreground="#004085" exampleText="System.#{#DateTime#}# date;"/>
<Color name="MethodCall" foreground="MidnightBlue" fontWeight="bold" exampleText="o.#{#ToString#}#();"/> <Color name="MethodCall" foreground="MidnightBlue" fontWeight="bold" exampleText="o.#{#ToString#}#();"/>
<Color name="FieldAccess" fontStyle="italic" exampleText="return this.#{#name#}#;"/> <Color name="FieldAccess" fontStyle="italic" exampleText="return this.#{#name#}#;"/>
<Color name="InactiveCode" foreground="Gray" exampleText="Deactivated by #if"/> <Color name="InactiveCode" foreground="Gray" exampleText="#{#Deactivated by #if#}#"/>
<RuleSet name="CommentMarkerSet"> <RuleSet name="CommentMarkerSet">
<Keywords fontWeight="bold" foreground="Red"> <Keywords fontWeight="bold" foreground="Red">
@ -151,6 +151,11 @@
<Word>in</Word> <Word>in</Word>
<Word>while</Word> <Word>while</Word>
<Word>lock</Word> <Word>lock</Word>
<Word>global</Word>
<Word>var</Word>
<Word>dynamic</Word>
<Word>await</Word>
<Word>where</Word>
</Keywords> </Keywords>
<Keywords color="GotoKeywords"> <Keywords color="GotoKeywords">
@ -158,13 +163,10 @@
<Word>continue</Word> <Word>continue</Word>
<Word>goto</Word> <Word>goto</Word>
<Word>return</Word> <Word>return</Word>
<Word>yield</Word>
</Keywords> </Keywords>
<Keywords color="ContextKeywords"> <Keywords color="QueryKeywords">
<Word>yield</Word>
<Word>partial</Word>
<Word>global</Word>
<Word>where</Word>
<Word>select</Word> <Word>select</Word>
<Word>group</Word> <Word>group</Word>
<Word>by</Word> <Word>by</Word>
@ -177,9 +179,6 @@
<Word>join</Word> <Word>join</Word>
<Word>on</Word> <Word>on</Word>
<Word>equals</Word> <Word>equals</Word>
<Word>var</Word>
<Word>dynamic</Word>
<Word>await</Word>
</Keywords> </Keywords>
<Keywords color="ExceptionKeywords"> <Keywords color="ExceptionKeywords">
@ -250,6 +249,7 @@
<Word>virtual</Word> <Word>virtual</Word>
<Word>volatile</Word> <Word>volatile</Word>
<Word>async</Word> <Word>async</Word>
<Word>partial</Word>
</Keywords> </Keywords>
<Keywords color="Visibility"> <Keywords color="Visibility">

4
src/Main/Base/Project/Src/Services/RefactoringService/FindReferenceService.cs

@ -173,7 +173,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
var graph = BuildTypeInheritanceGraph(compilations); var graph = BuildTypeInheritanceGraph(compilations);
TypeGraphNode node; TypeGraphNode node;
if (graph.TryGetValue(new AssemblyQualifiedTypeName(baseType), out node)) { if (graph.TryGetValue(new AssemblyQualifiedTypeName(baseType), out node)) {
node.BaseTypes.Clear(); // only derived types were requested, so don't return the base types // only derived types were requested, so don't return the base types
// (this helps the GC to collect the unused parts of the graph more quickly)
node.BaseTypes.Clear();
return node; return node;
} else { } else {
return new TypeGraphNode(baseType); return new TypeGraphNode(baseType);

Loading…
Cancel
Save