Временная опция "Использовать компилятор для Intellisense"

This commit is contained in:
Ivan Bondarev 2021-11-14 11:34:27 +01:00
parent 163bb02603
commit 945e34bc3f
21 changed files with 162 additions and 72 deletions

View file

@ -20,7 +20,7 @@ namespace CodeCompletion
public Dictionary<PascalABCCompiler.SyntaxTree.syntax_tree_node, string> docs = new Dictionary<PascalABCCompiler.SyntaxTree.syntax_tree_node, string>(); public Dictionary<PascalABCCompiler.SyntaxTree.syntax_tree_node, string> docs = new Dictionary<PascalABCCompiler.SyntaxTree.syntax_tree_node, string>();
static bool parsers_loaded=false; static bool parsers_loaded=false;
public IParser Parser; public IParser Parser;
static CodeCompletionController() static CodeCompletionController()
{ {
//ParsersController.Reload(); //ParsersController.Reload();

View file

@ -69,7 +69,7 @@ namespace CodeCompletion
//throw e; //throw e;
//System.Diagnostics.Debug.WriteLine(e.StackTrace); //System.Diagnostics.Debug.WriteLine(e.StackTrace);
} }
if (use_semantic_for_intellisense && cu.file_name.IndexOf("PABCSystem.pas") == -1) if (use_semantic_for_intellisense && !parse_only_interface)
try try
{ {
CorrectTreeWithSemantic(cu); CorrectTreeWithSemantic(cu);
@ -90,15 +90,16 @@ namespace CodeCompletion
var ntr = new named_type_reference(); var ntr = new named_type_reference();
ttr.name = ntr; ttr.name = ntr;
ttr.params_list = new template_param_list(); ttr.params_list = new template_param_list();
var arr = tn.full_name.Split('.'); var arr = tn.original_generic.full_name.Split('.');
foreach (string s in arr) for (int i = 0; i < arr.Length; i++)
{ {
if (s.IndexOf("<") == -1) var s = arr[i];
if (i < arr.Length - 1)
ntr.names.Add(new ident(s)); ntr.names.Add(new ident(s));
else else
{ {
var id = new ident_with_templateparams(); var id = new ident_with_templateparams();
ntr.Add(new ident(s.Substring(0, s.IndexOf("<")))); ntr.Add(new ident(s));
foreach (var gen_td in tn.instance_params) foreach (var gen_td in tn.instance_params)
ttr.params_list.Add(BuildSyntaxNodeForTypeReference(gen_td)); ttr.params_list.Add(BuildSyntaxNodeForTypeReference(gen_td));
} }
@ -108,7 +109,11 @@ namespace CodeCompletion
else else
{ {
var ntr = new named_type_reference(); var ntr = new named_type_reference();
if (tn.IsDelegate)
{
ntr.names.Add(new ident(tn.PrintableName.Replace("()", "")));
return ntr;
}
var arr = tn.full_name.Split('.'); var arr = tn.full_name.Split('.');
foreach (string s in arr) foreach (string s in arr)
{ {
@ -138,7 +143,7 @@ namespace CodeCompletion
if (ts is TypeSynonim) if (ts is TypeSynonim)
{ {
var corrected_type = GetCorrectedType((ts as TypeSynonim).actType, tn, topScope); var corrected_type = GetCorrectedType((ts as TypeSynonim).actType, tn, topScope);
if (corrected_type != (ts as TypeSynonim).actType) if (!corrected_type.IsEqual((ts as TypeSynonim).actType))
return corrected_type; return corrected_type;
return ts; return ts;
} }
@ -146,7 +151,11 @@ namespace CodeCompletion
{ {
var ctn = tn as compiled_type_node; var ctn = tn as compiled_type_node;
if (ctn.compiled_type.IsArray) if (ctn.compiled_type.IsArray)
{
if (ctn.rank > 1)
return new ArrayScope(GetIntellisenseTypeByType((ctn.element_type as compiled_type_node).compiled_type), new TypeScope[ctn.rank]);
return new ArrayScope(GetIntellisenseTypeByType((ctn.element_type as compiled_type_node).compiled_type), null); return new ArrayScope(GetIntellisenseTypeByType((ctn.element_type as compiled_type_node).compiled_type), null);
}
if (ctn.compiled_type.GetGenericArguments().Length == 0) if (ctn.compiled_type.GetGenericArguments().Length == 0)
return TypeTable.get_compiled_type(ctn.compiled_type); return TypeTable.get_compiled_type(ctn.compiled_type);
else else
@ -158,11 +167,22 @@ namespace CodeCompletion
} }
return CompiledScope.get_type_instance(ctn.compiled_type.GetGenericTypeDefinition(), gen_args); return CompiledScope.get_type_instance(ctn.compiled_type.GetGenericTypeDefinition(), gen_args);
} }
} }
else if (tn is ref_type_node && ts is PointerScope)
{
var corrected_type = GetCorrectedType((ts as PointerScope).elementType, tn.element_type, topScope);
if (!corrected_type.IsEqual((ts as PointerScope).elementType))
return new PointerScope(corrected_type);
return ts;
}
else else
{ {
if (tn.full_name.IndexOf("$") != -1 || tn.full_name.IndexOf("#") != -1) if (tn.full_name.IndexOf("$") != -1 || tn.full_name.IndexOf("#") != -1)
return ts; return ts;
if (ts is FileScope && tn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.typed_file)
return ts;
if (ts is FileScope && tn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.binary_file)
return ts;
var ntr = BuildSyntaxNodeForTypeReference(tn); var ntr = BuildSyntaxNodeForTypeReference(tn);
cur_scope = topScope; cur_scope = topScope;

View file

@ -28,6 +28,7 @@ namespace CodeCompletion
//string dir = Path.Combine(@"c:\Work\Miks\_PABCNETGitHub\TestSuite", "intellisense_tests"); //string dir = Path.Combine(@"c:\Work\Miks\_PABCNETGitHub\TestSuite", "intellisense_tests");
var comp = new PascalABCCompiler.Compiler(); var comp = new PascalABCCompiler.Compiler();
var controller = new CodeCompletion.CodeCompletionController(); var controller = new CodeCompletion.CodeCompletionController();
CodeCompletion.DomSyntaxTreeVisitor.use_semantic_for_intellisense = true;
CodeCompletion.CodeCompletionController.comp = comp; CodeCompletion.CodeCompletionController.comp = comp;
CodeCompletion.CodeCompletionController.SetParser(".pas"); CodeCompletion.CodeCompletionController.SetParser(".pas");
CodeCompletion.CodeCompletionController.ParsersController = comp.ParsersController; CodeCompletion.CodeCompletionController.ParsersController = comp.ParsersController;
@ -54,7 +55,7 @@ namespace CodeCompletion
if (desc == null) if (desc == null)
desc = ""; desc = "";
desc = desc.Split(new string[] { "\n"},StringSplitOptions.None)[0].Trim(); desc = desc.Split(new string[] { "\n"},StringSplitOptions.None)[0].Trim();
assert(desc.Replace(", ", ",") == should_desc.Replace(", ",","), FileName+", should: "+should_desc+", is: "+desc); assert(string.Compare(desc.Replace(", ", ","), should_desc.Replace(", ", ","), true) == 0, FileName+", should: "+should_desc+", is: "+desc);
tmp = tmp.Remove(ind, tmp.IndexOf("@}") + 2 - ind); tmp = tmp.Remove(ind, tmp.IndexOf("@}") + 2 - ind);
ind = tmp.IndexOf("{@"); ind = tmp.IndexOf("{@");
} }
@ -71,7 +72,7 @@ namespace CodeCompletion
if (desc == null) if (desc == null)
desc = ""; desc = "";
desc = desc.Split(new string[] { "\n" }, StringSplitOptions.None)[0].Trim(); desc = desc.Split(new string[] { "\n" }, StringSplitOptions.None)[0].Trim();
assert(desc.Replace(", ", ",") == should_desc.Replace(", ", ","), FileName + ", should: " + should_desc + ", is: " + desc); assert(string.Compare(desc.Replace(", ", ","), should_desc.Replace(", ", ","), true) == 0, FileName + ", should: " + should_desc + ", is: " + desc);
tmp = tmp.Remove(ind, tmp.IndexOf("]}") + 2 - ind); tmp = tmp.Remove(ind, tmp.IndexOf("]}") + 2 - ind);
ind = tmp.IndexOf("{["); ind = tmp.IndexOf("{[");
} }
@ -88,7 +89,7 @@ namespace CodeCompletion
if (desc == null) if (desc == null)
desc = ""; desc = "";
desc = desc.Split(new string[] { "\n" }, StringSplitOptions.None)[0].Trim(); desc = desc.Split(new string[] { "\n" }, StringSplitOptions.None)[0].Trim();
assert(desc.Replace(", ", ",") == should_desc.Replace(", ", ","), FileName + ", should: " + should_desc + ", is: " + desc); assert(string.Compare(desc.Replace(", ", ","), should_desc.Replace(", ", ","), true) == 0, FileName + ", should: " + should_desc + ", is: " + desc);
tmp = tmp.Remove(ind, tmp.IndexOf(")}") + 2 - ind); tmp = tmp.Remove(ind, tmp.IndexOf(")}") + 2 - ind);
ind = tmp.IndexOf("{("); ind = tmp.IndexOf("{(");
} }

View file

@ -242,6 +242,7 @@ namespace VisualPascalABCPlugins
bool UseDllForSystemUnits { get; set; } bool UseDllForSystemUnits { get; set; }
bool PABCDllChecked { get; set; } bool PABCDllChecked { get; set; }
bool AutoInsertCodeIsEnabledOnStartup { get; set; } bool AutoInsertCodeIsEnabledOnStartup { get; set; }
bool UseSemanticIntellisense { get; set; }
} }
public interface IListItem public interface IListItem

View file

@ -1,10 +1,11 @@
begin begin
var Floors := new Dictionary<(cardinal, cardinal), List<integer>>; var Floors := new Dictionary<(longword, longword), List<integer>>;
var sz := (1, 2); var sz := (1, 2);
foreach var a{@var a: (cardinal,cardinal);@} in Floors.Keys do foreach var a{@var a: (longword,longword);@} in Floors.Keys do
begin begin
end; end;
var l{@var l: List<integer>;@} := Floors[sz]; var l{@var l: List<integer>;@} := Floors[sz];
l.Add(23); l.Add(23);
end. end.

View file

@ -1,4 +1,5 @@
type //!semantic
type
TClass = class TClass = class
fX: byte; fX: byte;
@ -9,7 +10,7 @@
begin begin
var instance := new TClass(); var instance := new TClass();
var x1{@var x1: byte;@} := instance?.fX; var x1{@var x1: Nullable<byte>;@} := instance?.fX;
var x3{@var x3: integer;@} := instance?.F; var x3{@var x3: Nullable<integer>;@} := instance?.F;
writeln(instance?.F{@function TClass.F(): integer;@}); writeln(instance?.F{@function TClass.F(): integer;@});
end. end.

View file

@ -0,0 +1,7 @@
//!semantic
{$reference system.windows.forms.dll}
begin
var coll: system.windows.forms.ListBox.SelectedIndexCollection;
foreach var a in coll do
a{@var a: Object;@}.IsEven.print;
end.

View file

@ -0,0 +1,4 @@
//!semantic
begin
var q{@var q: sequence of real;@} := Arr(1,2,3).Select(x->1/x);
end.

View file

@ -0,0 +1,6 @@
//!semantic
begin
Arr(1,2,3).Aggregate(1.0, (y, x{@parameter x: integer;@}) ->
(y{@parameter y: real;@} * (x mod 10)));
ReadArrInteger(10).Where((x, i) -> i{@parameter i: integer;@} mod 2 = 0);
end.

View file

@ -0,0 +1,5 @@
//!semantic
begin
var a: array of integer;
a.Min(p -> p{@parameter p: integer;@}[0]);
end.

View file

@ -125,7 +125,6 @@ namespace PascalABCCompiler.TreeConverter
{ {
semantic_check_extended_foreach(vars, elem_type, foreachCollection.location); semantic_check_extended_foreach(vars, elem_type, foreachCollection.location);
} }
CheckToEmbeddedStatementCannotBeADeclaration(_foreach_stmt.stmt); CheckToEmbeddedStatementCannotBeADeclaration(_foreach_stmt.stmt);
foreachVariable = FindForeachVariable(_foreach_stmt, elem_type, sys_coll_ienum); foreachVariable = FindForeachVariable(_foreach_stmt, elem_type, sys_coll_ienum);

View file

@ -15749,21 +15749,17 @@ namespace PascalABCCompiler.TreeConverter
public override void visit(SyntaxTree.if_node _if_node) public override void visit(SyntaxTree.if_node _if_node)
{ {
expression_node condition = convert_strong(_if_node.condition); expression_node condition = null;
condition = convertion_data_and_alghoritms.convert_type(condition, SystemLibrary.SystemLibrary.bool_type); if (!for_intellisense)
try_convert_typed_expression_to_function_call(ref condition, true);
// SSM 29/08/16
/*var cc = condition as bool_const_node;
if (cc != null && cc.constant_value == false && _if_node.else_body == null)
{ {
// недостижимый код - ничего не генерировать condition = convert_strong(_if_node.condition);
return_value(new empty_statement(get_location(_if_node))); condition = convertion_data_and_alghoritms.convert_type(condition, SystemLibrary.SystemLibrary.bool_type);
// перед этим надо обходить then_body try_convert_typed_expression_to_function_call(ref condition, true);
return;
}*/
CheckToEmbeddedStatementCannotBeADeclaration(_if_node.then_body); CheckToEmbeddedStatementCannotBeADeclaration(_if_node.then_body);
CheckToEmbeddedStatementCannotBeADeclaration(_if_node.else_body); CheckToEmbeddedStatementCannotBeADeclaration(_if_node.else_body);
}
statements_list sl = new statements_list(get_location(_if_node.then_body)); statements_list sl = new statements_list(get_location(_if_node.then_body));
convertion_data_and_alghoritms.statement_list_stack_push(sl); convertion_data_and_alghoritms.statement_list_stack_push(sl);
@ -15805,10 +15801,14 @@ namespace PascalABCCompiler.TreeConverter
public override void visit(SyntaxTree.while_node _while_node) public override void visit(SyntaxTree.while_node _while_node)
{ {
expression_node expr = convert_strong(_while_node.expr); expression_node expr = null;
expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type); if (!for_intellisense)
try_convert_typed_expression_to_function_call(ref expr, true); {
CheckToEmbeddedStatementCannotBeADeclaration(_while_node.statements); expr = convert_strong(_while_node.expr);
expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type);
try_convert_typed_expression_to_function_call(ref expr, true);
CheckToEmbeddedStatementCannotBeADeclaration(_while_node.statements);
}
while_node wn = new while_node(expr, get_location(_while_node)); while_node wn = new while_node(expr, get_location(_while_node));
context.cycle_stack.push(wn); context.cycle_stack.push(wn);
@ -15853,10 +15853,14 @@ namespace PascalABCCompiler.TreeConverter
} }
rep.body = st; rep.body = st;
expression_node expr = convert_strong(_repeat_node.expr); expression_node expr = null;
expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type); if (!for_intellisense)
try_convert_typed_expression_to_function_call(ref expr, true); {
rep.condition = expr; expr = convert_strong(_repeat_node.expr);
expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type);
try_convert_typed_expression_to_function_call(ref expr, true);
rep.condition = expr;
}
context.cycle_stack.pop(); context.cycle_stack.pop();
return_value(rep); return_value(rep);
} }
@ -16078,6 +16082,12 @@ namespace PascalABCCompiler.TreeConverter
{ {
AddError(loc, "NO_DEFAULT_PROPERTY_TO_FUNCTION_TYPE"); AddError(loc, "NO_DEFAULT_PROPERTY_TO_FUNCTION_TYPE");
} }
if (for_intellisense)
{
return_value(expr);
return;
}
} }
if (expr.type.default_property_node.polymorphic_state == SemanticTree.polymorphic_state.ps_static) if (expr.type.default_property_node.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
@ -17933,6 +17943,16 @@ namespace PascalABCCompiler.TreeConverter
statement syntax_statement = _statement_list.subnodes[i]; statement syntax_statement = _statement_list.subnodes[i];
try try
{ {
if (for_intellisense)
{
if (syntax_statement is assign && !(context.converted_func_stack.top() != null && context.converted_func_stack.top().return_value_type is undefined_type)
|| syntax_statement is procedure_call || syntax_statement is raise_statement)
{
if (!(new LambdaSearcher(syntax_statement).CheckIfContainsLambdas()))
continue;
}
}
statement_node semantic_statement = convert_strong(syntax_statement); statement_node semantic_statement = convert_strong(syntax_statement);
if (semantic_statement != null) if (semantic_statement != null)
{ {

View file

@ -36,6 +36,7 @@ namespace VisualPascalABC.OptionsContent
this.cbCodeCompletionDot = new System.Windows.Forms.CheckBox(); this.cbCodeCompletionDot = new System.Windows.Forms.CheckBox();
this.cbCodeCompletionHint = new System.Windows.Forms.CheckBox(); this.cbCodeCompletionHint = new System.Windows.Forms.CheckBox();
this.cbIntellisencePanel = new System.Windows.Forms.CheckBox(); this.cbIntellisencePanel = new System.Windows.Forms.CheckBox();
this.cbUseSemanticIntellisense = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.nuNamespaceVisibleRange)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nuNamespaceVisibleRange)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -45,11 +46,10 @@ namespace VisualPascalABC.OptionsContent
this.cbCodeCompletionKeyPressed.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.cbCodeCompletionKeyPressed.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbCodeCompletionKeyPressed.Checked = true; this.cbCodeCompletionKeyPressed.Checked = true;
this.cbCodeCompletionKeyPressed.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCodeCompletionKeyPressed.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbCodeCompletionKeyPressed.Location = new System.Drawing.Point(23, 110); this.cbCodeCompletionKeyPressed.Location = new System.Drawing.Point(17, 89);
this.cbCodeCompletionKeyPressed.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbCodeCompletionKeyPressed.Name = "cbCodeCompletionKeyPressed"; this.cbCodeCompletionKeyPressed.Name = "cbCodeCompletionKeyPressed";
this.cbCodeCompletionKeyPressed.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cbCodeCompletionKeyPressed.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbCodeCompletionKeyPressed.Size = new System.Drawing.Size(264, 21); this.cbCodeCompletionKeyPressed.Size = new System.Drawing.Size(210, 17);
this.cbCodeCompletionKeyPressed.TabIndex = 38; this.cbCodeCompletionKeyPressed.TabIndex = 38;
this.cbCodeCompletionKeyPressed.Text = "CODE_COMPLETION_KEYPRESSED"; this.cbCodeCompletionKeyPressed.Text = "CODE_COMPLETION_KEYPRESSED";
this.cbCodeCompletionKeyPressed.UseVisualStyleBackColor = true; this.cbCodeCompletionKeyPressed.UseVisualStyleBackColor = true;
@ -57,24 +57,22 @@ namespace VisualPascalABC.OptionsContent
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(91, 170); this.label5.Location = new System.Drawing.Point(68, 138);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(207, 17); this.label5.Size = new System.Drawing.Size(163, 13);
this.label5.TabIndex = 37; this.label5.TabIndex = 37;
this.label5.Text = "NAMESPACE_VISIBLE_RANGE"; this.label5.Text = "NAMESPACE_VISIBLE_RANGE";
// //
// nuNamespaceVisibleRange // nuNamespaceVisibleRange
// //
this.nuNamespaceVisibleRange.Location = new System.Drawing.Point(23, 165); this.nuNamespaceVisibleRange.Location = new System.Drawing.Point(17, 134);
this.nuNamespaceVisibleRange.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.nuNamespaceVisibleRange.Maximum = new decimal(new int[] { this.nuNamespaceVisibleRange.Maximum = new decimal(new int[] {
32, 32,
0, 0,
0, 0,
0}); 0});
this.nuNamespaceVisibleRange.Name = "nuNamespaceVisibleRange"; this.nuNamespaceVisibleRange.Name = "nuNamespaceVisibleRange";
this.nuNamespaceVisibleRange.Size = new System.Drawing.Size(64, 22); this.nuNamespaceVisibleRange.Size = new System.Drawing.Size(48, 20);
this.nuNamespaceVisibleRange.TabIndex = 36; this.nuNamespaceVisibleRange.TabIndex = 36;
this.nuNamespaceVisibleRange.Value = new decimal(new int[] { this.nuNamespaceVisibleRange.Value = new decimal(new int[] {
3, 3,
@ -88,11 +86,10 @@ namespace VisualPascalABC.OptionsContent
this.cbAllowCodeCompletion.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.cbAllowCodeCompletion.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbAllowCodeCompletion.Checked = true; this.cbAllowCodeCompletion.Checked = true;
this.cbAllowCodeCompletion.CheckState = System.Windows.Forms.CheckState.Checked; this.cbAllowCodeCompletion.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbAllowCodeCompletion.Location = new System.Drawing.Point(7, 6); this.cbAllowCodeCompletion.Location = new System.Drawing.Point(5, 5);
this.cbAllowCodeCompletion.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbAllowCodeCompletion.Name = "cbAllowCodeCompletion"; this.cbAllowCodeCompletion.Name = "cbAllowCodeCompletion";
this.cbAllowCodeCompletion.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cbAllowCodeCompletion.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbAllowCodeCompletion.Size = new System.Drawing.Size(221, 21); this.cbAllowCodeCompletion.Size = new System.Drawing.Size(176, 17);
this.cbAllowCodeCompletion.TabIndex = 35; this.cbAllowCodeCompletion.TabIndex = 35;
this.cbAllowCodeCompletion.Text = "ALLOW_CODE_COMPLETION"; this.cbAllowCodeCompletion.Text = "ALLOW_CODE_COMPLETION";
this.cbAllowCodeCompletion.UseVisualStyleBackColor = true; this.cbAllowCodeCompletion.UseVisualStyleBackColor = true;
@ -104,11 +101,10 @@ namespace VisualPascalABC.OptionsContent
this.cbCodeCompletionParams.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.cbCodeCompletionParams.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbCodeCompletionParams.Checked = true; this.cbCodeCompletionParams.Checked = true;
this.cbCodeCompletionParams.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCodeCompletionParams.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbCodeCompletionParams.Location = new System.Drawing.Point(23, 84); this.cbCodeCompletionParams.Location = new System.Drawing.Point(17, 68);
this.cbCodeCompletionParams.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbCodeCompletionParams.Name = "cbCodeCompletionParams"; this.cbCodeCompletionParams.Name = "cbCodeCompletionParams";
this.cbCodeCompletionParams.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cbCodeCompletionParams.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbCodeCompletionParams.Size = new System.Drawing.Size(229, 21); this.cbCodeCompletionParams.Size = new System.Drawing.Size(183, 17);
this.cbCodeCompletionParams.TabIndex = 34; this.cbCodeCompletionParams.TabIndex = 34;
this.cbCodeCompletionParams.Text = "CODE_COMPLETION_PARAMS"; this.cbCodeCompletionParams.Text = "CODE_COMPLETION_PARAMS";
this.cbCodeCompletionParams.UseVisualStyleBackColor = true; this.cbCodeCompletionParams.UseVisualStyleBackColor = true;
@ -119,11 +115,10 @@ namespace VisualPascalABC.OptionsContent
this.cbCodeCompletionDot.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.cbCodeCompletionDot.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbCodeCompletionDot.Checked = true; this.cbCodeCompletionDot.Checked = true;
this.cbCodeCompletionDot.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCodeCompletionDot.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbCodeCompletionDot.Location = new System.Drawing.Point(23, 58); this.cbCodeCompletionDot.Location = new System.Drawing.Point(17, 47);
this.cbCodeCompletionDot.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbCodeCompletionDot.Name = "cbCodeCompletionDot"; this.cbCodeCompletionDot.Name = "cbCodeCompletionDot";
this.cbCodeCompletionDot.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cbCodeCompletionDot.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbCodeCompletionDot.Size = new System.Drawing.Size(202, 21); this.cbCodeCompletionDot.Size = new System.Drawing.Size(161, 17);
this.cbCodeCompletionDot.TabIndex = 33; this.cbCodeCompletionDot.TabIndex = 33;
this.cbCodeCompletionDot.Text = "CODE_COMPLETION_DOT"; this.cbCodeCompletionDot.Text = "CODE_COMPLETION_DOT";
this.cbCodeCompletionDot.UseVisualStyleBackColor = true; this.cbCodeCompletionDot.UseVisualStyleBackColor = true;
@ -134,11 +129,10 @@ namespace VisualPascalABC.OptionsContent
this.cbCodeCompletionHint.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.cbCodeCompletionHint.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbCodeCompletionHint.Checked = true; this.cbCodeCompletionHint.Checked = true;
this.cbCodeCompletionHint.CheckState = System.Windows.Forms.CheckState.Checked; this.cbCodeCompletionHint.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbCodeCompletionHint.Location = new System.Drawing.Point(23, 32); this.cbCodeCompletionHint.Location = new System.Drawing.Point(17, 26);
this.cbCodeCompletionHint.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbCodeCompletionHint.Name = "cbCodeCompletionHint"; this.cbCodeCompletionHint.Name = "cbCodeCompletionHint";
this.cbCodeCompletionHint.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cbCodeCompletionHint.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbCodeCompletionHint.Size = new System.Drawing.Size(204, 21); this.cbCodeCompletionHint.Size = new System.Drawing.Size(164, 17);
this.cbCodeCompletionHint.TabIndex = 32; this.cbCodeCompletionHint.TabIndex = 32;
this.cbCodeCompletionHint.Text = "CODE_COMPLETION_HINT"; this.cbCodeCompletionHint.Text = "CODE_COMPLETION_HINT";
this.cbCodeCompletionHint.UseVisualStyleBackColor = true; this.cbCodeCompletionHint.UseVisualStyleBackColor = true;
@ -149,19 +143,30 @@ namespace VisualPascalABC.OptionsContent
this.cbIntellisencePanel.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.cbIntellisencePanel.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbIntellisencePanel.Checked = true; this.cbIntellisencePanel.Checked = true;
this.cbIntellisencePanel.CheckState = System.Windows.Forms.CheckState.Checked; this.cbIntellisencePanel.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbIntellisencePanel.Location = new System.Drawing.Point(23, 136); this.cbIntellisencePanel.Location = new System.Drawing.Point(17, 110);
this.cbIntellisencePanel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbIntellisencePanel.Name = "cbIntellisencePanel"; this.cbIntellisencePanel.Name = "cbIntellisencePanel";
this.cbIntellisencePanel.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cbIntellisencePanel.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbIntellisencePanel.Size = new System.Drawing.Size(227, 21); this.cbIntellisencePanel.Size = new System.Drawing.Size(183, 17);
this.cbIntellisencePanel.TabIndex = 39; this.cbIntellisencePanel.TabIndex = 39;
this.cbIntellisencePanel.Text = "SHOW_INTELLISENCE_PANEL"; this.cbIntellisencePanel.Text = "SHOW_INTELLISENCE_PANEL";
this.cbIntellisencePanel.UseVisualStyleBackColor = true; this.cbIntellisencePanel.UseVisualStyleBackColor = true;
// //
// cbUseSemanticIntellisense
//
this.cbUseSemanticIntellisense.AutoSize = true;
this.cbUseSemanticIntellisense.Location = new System.Drawing.Point(17, 161);
this.cbUseSemanticIntellisense.Name = "cbUseSemanticIntellisense";
this.cbUseSemanticIntellisense.Size = new System.Drawing.Size(191, 17);
this.cbUseSemanticIntellisense.TabIndex = 40;
this.cbUseSemanticIntellisense.Text = "USE_SEMANTIC_INTELLISENSE";
this.cbUseSemanticIntellisense.UseVisualStyleBackColor = true;
this.cbUseSemanticIntellisense.CheckedChanged += new System.EventHandler(this.cbUseSemanticIntellisense_CheckedChanged);
//
// IntelliseseOptionsContent // IntelliseseOptionsContent
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cbUseSemanticIntellisense);
this.Controls.Add(this.cbIntellisencePanel); this.Controls.Add(this.cbIntellisencePanel);
this.Controls.Add(this.cbCodeCompletionKeyPressed); this.Controls.Add(this.cbCodeCompletionKeyPressed);
this.Controls.Add(this.label5); this.Controls.Add(this.label5);
@ -170,9 +175,8 @@ namespace VisualPascalABC.OptionsContent
this.Controls.Add(this.cbCodeCompletionParams); this.Controls.Add(this.cbCodeCompletionParams);
this.Controls.Add(this.cbCodeCompletionDot); this.Controls.Add(this.cbCodeCompletionDot);
this.Controls.Add(this.cbCodeCompletionHint); this.Controls.Add(this.cbCodeCompletionHint);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "IntelliseseOptionsContent"; this.Name = "IntelliseseOptionsContent";
this.Size = new System.Drawing.Size(701, 260); this.Size = new System.Drawing.Size(526, 211);
((System.ComponentModel.ISupportInitialize)(this.nuNamespaceVisibleRange)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nuNamespaceVisibleRange)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -189,5 +193,6 @@ namespace VisualPascalABC.OptionsContent
private System.Windows.Forms.CheckBox cbCodeCompletionDot; private System.Windows.Forms.CheckBox cbCodeCompletionDot;
private System.Windows.Forms.CheckBox cbCodeCompletionHint; private System.Windows.Forms.CheckBox cbCodeCompletionHint;
private System.Windows.Forms.CheckBox cbIntellisencePanel; private System.Windows.Forms.CheckBox cbIntellisencePanel;
private System.Windows.Forms.CheckBox cbUseSemanticIntellisense;
} }
} }

View file

@ -59,6 +59,7 @@ namespace VisualPascalABC.OptionsContent
cbCodeCompletionKeyPressed.Checked = MainForm.UserOptions.EnableSmartIntellisense; cbCodeCompletionKeyPressed.Checked = MainForm.UserOptions.EnableSmartIntellisense;
nuNamespaceVisibleRange.Value = MainForm.UserOptions.CodeCompletionNamespaceVisibleRange; nuNamespaceVisibleRange.Value = MainForm.UserOptions.CodeCompletionNamespaceVisibleRange;
cbIntellisencePanel.Checked = MainForm.UserOptions.ShowQuickClassBrowserPanel; cbIntellisencePanel.Checked = MainForm.UserOptions.ShowQuickClassBrowserPanel;
cbUseSemanticIntellisense.Checked = MainForm.UserOptions.UseSemanticIntellisense;
alreadyShown = true; alreadyShown = true;
} }
break; break;
@ -70,6 +71,7 @@ namespace VisualPascalABC.OptionsContent
MainForm.UserOptions.EnableSmartIntellisense = cbCodeCompletionKeyPressed.Checked; MainForm.UserOptions.EnableSmartIntellisense = cbCodeCompletionKeyPressed.Checked;
MainForm.UserOptions.CodeCompletionNamespaceVisibleRange = Convert.ToInt32(nuNamespaceVisibleRange.Value); MainForm.UserOptions.CodeCompletionNamespaceVisibleRange = Convert.ToInt32(nuNamespaceVisibleRange.Value);
MainForm.UserOptions.ShowQuickClassBrowserPanel = cbIntellisencePanel.Checked; MainForm.UserOptions.ShowQuickClassBrowserPanel = cbIntellisencePanel.Checked;
MainForm.UserOptions.UseSemanticIntellisense = cbUseSemanticIntellisense.Checked;
MainForm.UpdateUserOptions(); MainForm.UpdateUserOptions();
alreadyShown = false; alreadyShown = false;
WorkbenchServiceFactory.OptionsService.SaveOptions(); WorkbenchServiceFactory.OptionsService.SaveOptions();
@ -84,9 +86,13 @@ namespace VisualPascalABC.OptionsContent
private void cbAllowCodeCompletion_CheckedChanged(object sender, EventArgs e) private void cbAllowCodeCompletion_CheckedChanged(object sender, EventArgs e)
{ {
cbIntellisencePanel.Checked = cbCodeCompletionKeyPressed.Checked = cbCodeCompletionDot.Checked = cbCodeCompletionHint.Checked = cbCodeCompletionParams.Checked = cbAllowCodeCompletion.Checked; cbIntellisencePanel.Checked = cbUseSemanticIntellisense.Checked = cbCodeCompletionKeyPressed.Checked = cbCodeCompletionDot.Checked = cbCodeCompletionHint.Checked = cbCodeCompletionParams.Checked = cbAllowCodeCompletion.Checked;
cbIntellisencePanel.Enabled = cbCodeCompletionKeyPressed.Enabled = nuNamespaceVisibleRange.Enabled = cbCodeCompletionDot.Enabled = cbCodeCompletionHint.Enabled = cbCodeCompletionParams.Enabled = cbAllowCodeCompletion.Checked; cbIntellisencePanel.Enabled = cbUseSemanticIntellisense.Enabled = cbCodeCompletionKeyPressed.Enabled = nuNamespaceVisibleRange.Enabled = cbCodeCompletionDot.Enabled = cbCodeCompletionHint.Enabled = cbCodeCompletionParams.Enabled = cbAllowCodeCompletion.Checked;
}
private void cbUseSemanticIntellisense_CheckedChanged(object sender, EventArgs e)
{
CodeCompletion.DomSyntaxTreeVisitor.use_semantic_for_intellisense = cbUseSemanticIntellisense.Checked;
} }
} }
} }

View file

@ -112,9 +112,9 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
</root> </root>

View file

@ -31,6 +31,7 @@ namespace VisualPascalABC
public bool ShowCompletionInfoByGroup = true; public bool ShowCompletionInfoByGroup = true;
public bool EnableSmartIntellisense = false; public bool EnableSmartIntellisense = false;
public bool ShowQuickClassBrowserPanel = false; public bool ShowQuickClassBrowserPanel = false;
public bool UseSemanticIntellisense = false;
public bool AllowCodeFormatting = false; public bool AllowCodeFormatting = false;
public bool SkipStackTraceItemIfSourceFileInSystemDirectory = true; public bool SkipStackTraceItemIfSourceFileInSystemDirectory = true;
public bool AlwaysAttachDebuggerAtStart = false; public bool AlwaysAttachDebuggerAtStart = false;
@ -256,6 +257,12 @@ namespace VisualPascalABC
set { PABCDllChecked = value; } set { PABCDllChecked = value; }
} }
bool VisualPascalABCPlugins.IUserOptions.UseSemanticIntellisense
{
get { return UseSemanticIntellisense; }
set { UseSemanticIntellisense = value; }
}
#endregion #endregion
} }
} }

View file

@ -58,6 +58,7 @@ namespace VisualPascalABC
private string OptionsItemNameDockLeftPortion = "DockLeftPortion"; private string OptionsItemNameDockLeftPortion = "DockLeftPortion";
private string OptionsItemNameDockRightPortion = "DockRightPortion"; private string OptionsItemNameDockRightPortion = "DockRightPortion";
private string OptionsItemNameShowQuickClassBrowserPanel = "ShowQuickClassBrowserPanel"; private string OptionsItemNameShowQuickClassBrowserPanel = "ShowQuickClassBrowserPanel";
private string OptionsItemNameUseSemanticIntellisense = "UseSemanticIntellisense";
private string OptionsItemNameSkipStackTraceItemIfSourceFileInSystemDirectory = "SkipStakTraceItemIfSourceFileInSystemDirectory"; private string OptionsItemNameSkipStackTraceItemIfSourceFileInSystemDirectory = "SkipStakTraceItemIfSourceFileInSystemDirectory";
private string OptionsItemNameShowFoundedNamesTab = "ShowFoundedNamesTab"; private string OptionsItemNameShowFoundedNamesTab = "ShowFoundedNamesTab";
private string OptionsItemNameShowWatchTab = "ShowWatchTab"; private string OptionsItemNameShowWatchTab = "ShowWatchTab";
@ -237,6 +238,8 @@ namespace VisualPascalABC
UserOptions.UseDllForSystemUnits = Convert.ToBoolean(value); UserOptions.UseDllForSystemUnits = Convert.ToBoolean(value);
if ((value = (string)Options[OptionsItemPABCDllChecked]) != null) if ((value = (string)Options[OptionsItemPABCDllChecked]) != null)
UserOptions.PABCDllChecked = Convert.ToBoolean(value); UserOptions.PABCDllChecked = Convert.ToBoolean(value);
if ((value = (string)Options[OptionsItemNameUseSemanticIntellisense]) != null)
UserOptions.UseSemanticIntellisense = Convert.ToBoolean(value);
int i = 0; int i = 0;
while ((value = (string)Options[OptionsItemNameLastFile + (i++).ToString()]) != null) while ((value = (string)Options[OptionsItemNameLastFile + (i++).ToString()]) != null)
AddLastFile(value); AddLastFile(value);
@ -286,6 +289,7 @@ namespace VisualPascalABC
Options.Add(OptionsItemNameCodeCompletionNamespaceVisibleRange, UserOptions.CodeCompletionNamespaceVisibleRange); Options.Add(OptionsItemNameCodeCompletionNamespaceVisibleRange, UserOptions.CodeCompletionNamespaceVisibleRange);
Options.Add(OptionsItemNameSaveSourceFilesIfComilationOk, UserOptions.SaveSourceFilesIfComilationOk); Options.Add(OptionsItemNameSaveSourceFilesIfComilationOk, UserOptions.SaveSourceFilesIfComilationOk);
Options.Add(OptionsItemNameShowQuickClassBrowserPanel, UserOptions.ShowQuickClassBrowserPanel); Options.Add(OptionsItemNameShowQuickClassBrowserPanel, UserOptions.ShowQuickClassBrowserPanel);
Options.Add(OptionsItemNameUseSemanticIntellisense, UserOptions.UseSemanticIntellisense);
Options.Add(OptionsItemNameSkipStackTraceItemIfSourceFileInSystemDirectory, UserOptions.SkipStackTraceItemIfSourceFileInSystemDirectory); Options.Add(OptionsItemNameSkipStackTraceItemIfSourceFileInSystemDirectory, UserOptions.SkipStackTraceItemIfSourceFileInSystemDirectory);
Options.Add(OptionsItemNameAutoInsertCode, UserOptions.AutoInsertCodeIsEnabledOnStartup); Options.Add(OptionsItemNameAutoInsertCode, UserOptions.AutoInsertCodeIsEnabledOnStartup);

View file

@ -261,7 +261,7 @@ namespace VisualPascalABCPlugins
private void cbUseSemanticForIntellisense_CheckedChanged(object sender, EventArgs e) private void cbUseSemanticForIntellisense_CheckedChanged(object sender, EventArgs e)
{ {
CodeCompletion.DomSyntaxTreeVisitor.use_semantic_for_intellisense = cbUseSemanticForIntellisense.Checked; //CodeCompletion.DomSyntaxTreeVisitor.use_semantic_for_intellisense = cbUseSemanticForIntellisense.Checked;
} }
} }
} }

View file

@ -399,6 +399,7 @@ CODE_COMPLETION_PARAMS=Show tooltip when writing method calls
CODE_COMPLETION_KEYPRESSED=Show tooltip by key pressing CODE_COMPLETION_KEYPRESSED=Show tooltip by key pressing
SHOW_INTELLISENCE_PANEL=Show quick class browser panel SHOW_INTELLISENCE_PANEL=Show quick class browser panel
NAMESPACE_VISIBLE_RANGE=Level of nesting namespaces (0 - all) NAMESPACE_VISIBLE_RANGE=Level of nesting namespaces (0 - all)
USE_SEMANTIC_INTELLISENSE=Use compiler engine for code completion
//CompilerOptions //CompilerOptions
%PREFIX%=VP_OC_COMPILEROPTIONS_ %PREFIX%=VP_OC_COMPILEROPTIONS_

View file

@ -399,6 +399,7 @@ CODE_COMPLETION_PARAMS=Подсказка параметров функций
CODE_COMPLETION_KEYPRESSED=Подсказка по нажатию клавиши CODE_COMPLETION_KEYPRESSED=Подсказка по нажатию клавиши
SHOW_INTELLISENCE_PANEL=Панель навигации по исходному коду SHOW_INTELLISENCE_PANEL=Панель навигации по исходному коду
NAMESPACE_VISIBLE_RANGE=Вложенность пространств имен (0 - все) NAMESPACE_VISIBLE_RANGE=Вложенность пространств имен (0 - все)
USE_SEMANTIC_INTELLISENSE=Использовать компилятор для Intellisense
//CompilerOptions //CompilerOptions
%PREFIX%=VP_OC_COMPILEROPTIONS_ %PREFIX%=VP_OC_COMPILEROPTIONS_

View file

@ -393,6 +393,7 @@ CODE_COMPLETION_PARAMS=Підказка параметрів функцій
CODE_COMPLETION_KEYPRESSED=Підказка по натисканню клавіші CODE_COMPLETION_KEYPRESSED=Підказка по натисканню клавіші
SHOW_INTELLISENCE_PANEL=Панель навігації по вихідному коду SHOW_INTELLISENCE_PANEL=Панель навігації по вихідному коду
NAMESPACE_VISIBLE_RANGE=Вкладеність просторів імен (0 - усі) NAMESPACE_VISIBLE_RANGE=Вкладеність просторів імен (0 - усі)
USE_SEMANTIC_INTELLISENSE=Использовать компилятор для Intellisense
//CompilerOptions //CompilerOptions
%PREFIX%=VP_OC_COMPILEROPTIONS_ %PREFIX%=VP_OC_COMPILEROPTIONS_