@@ -16,8 +16,9 @@ internal partial class ExpressionScriptEditorDialog : Form
1616 {
1717 readonly StringBuilder autoCompleteList = new ( ) ;
1818
19- public ExpressionScriptEditorDialog ( )
19+ public ExpressionScriptEditorDialog ( Type ? itType = null )
2020 {
21+ ItType = itType ;
2122 InitializeComponent ( ) ;
2223 scintilla . StyleResetDefault ( ) ;
2324 scintilla . Styles [ Style . Default ] . Font = "Consolas" ;
@@ -35,8 +36,11 @@ public ExpressionScriptEditorDialog()
3536 scintilla . Lexer = Lexer . Cpp ;
3637
3738 var typeKeywords = string . Join ( " " , CaretExpressionAnalyzer . PredefinedTypeKeywords . Keys ) ;
39+ var predefinedTypes = CaretExpressionAnalyzer . PredefinedTypes ;
3840 scintilla . SetKeywords ( 0 , "it iif new outerIt as true false null " + typeKeywords ) ;
39- scintilla . SetKeywords ( 1 , string . Join ( " " , CaretExpressionAnalyzer . PredefinedTypes . Select ( type => type . Name ) ) ) ;
41+ scintilla . SetKeywords ( 1 , string . Join ( " " , Enumerable . Concat (
42+ ( itType is not null ? predefinedTypes . Append ( itType ) : predefinedTypes ) . Select ( type => type . Name ) ,
43+ predefinedTypes . Select ( type => type . Name . ToLowerInvariant ( ) ) ) ) ) ;
4044
4145 scintilla . AutoCSeparator = ';' ;
4246 scintilla . AutoCTypeSeparator = '?' ;
@@ -47,7 +51,7 @@ public ExpressionScriptEditorDialog()
4751 scintilla . RegisterRgbaImage ( 3 , Resources . TypeIcon ) ;
4852 }
4953
50- public Type ItType { get ; set ; }
54+ public Type ? ItType { get ; }
5155
5256 public string Script { get ; set ; }
5357
@@ -190,7 +194,7 @@ private void AppendMethods(Type type, BindingFlags bindingFlags, StringBuilder s
190194 private void AppendTypes ( Type itType , StringBuilder sb )
191195 {
192196 foreach ( var type in CaretExpressionAnalyzer . PredefinedTypes . Append ( itType )
193- . OrderBy ( t => t . Name ) )
197+ . OrderBy ( t => t . Name ) )
194198 {
195199 AppendMember ( type . Name , 3 , sb ) ;
196200 }
0 commit comments