Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-08

Problem with syncompletion.pas

8 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zaher Dirkey

syncompletion.pas in synedit component

1 -
in TSynBaseCompletionForm class

What for

FAnsi: boolean;
property ffAnsi: boolean read fansi write fansi;

2 -same for TSynBaseCompletion

    RFAnsi: boolean;
    SFAnsi: boolean;
    property AnsiStrings: boolean read SFAnsi write RFAnsi;

If not used i made some modification on it (removed that variables and add CaseSensitive to it)

Can i send the patch

3 - The Auto Complete in TSynCompletion not worked fine with me, it is just 2 char and then stop search for the keyword, after that pressing Enter not close the AutoComplete

--------
procedure TMainForm.LoadCompletion;
  procedure FillNow(Name: string; SchemaItems: TmncSchemaItems);
  var
    i: Integer;
  begin
    for i := 0 to SchemaItems.Count - 1 do
      Completion.ItemList.Add(SchemaItems[i].Name);
  end;
begin
  //Completion.AddEditor(SQLEdit);
  Completion.Editor := SQLEdit;
  Completion.EndOfTokenChr := Completion.EndOfTokenChr + #13;
  Completion.TheForm.Font.Assign(SQLEdit.Font);
  //Completion.CaseSensitive := True;
  EnumerateKeywords(Ord(tkDatatype), SqliteTypes, SQLEdit.IdentChars,
@DoAddKeyword);
  FillNow('Table', sqlvEngine.Session.Tables);
--------------

Thanks

Zaher Dirkey

Reply by email

Martin
to Zaher Dirkey
Zaher Dirkey wrote 22 lines
syncompletion.pas in synedit component 1 - in TSynBaseCompletionForm class What for FAnsi: boolean; property ffAnsi: boolean read fansi write fansi; 2 -same for TSynBaseCompletion RFAnsi: boolean; SFAnsi: boolean; property AnsiStrings: boolean read SFAnsi write RFAnsi; If not used i made some modification on it (removed that variables and add CaseSensitive to it) Can i send the patch

You are right, in there current form, they make little sense. They are the left over from a basic latin1/ansi only CaseSensitive flag.

RFAnsi/SFAns used to forward the setting from Completion to the Form (that got broken in 2002)

I think I will replace it by a CaseSensitive (utf8 based) option? Thanks for pointing this out, anyway.

Before this can be fixed, the below needs to be fixed, otherwise it will be hard to test it.

Show quoted text 23 lines
3 - The Auto Complete in TSynCompletion not worked fine with me, it is just 2 char and then stop search for the keyword, after that pressing Enter not close the AutoComplete -------- procedure TMainForm.LoadCompletion; procedure FillNow(Name: string; SchemaItems: TmncSchemaItems); var i: Integer; begin for i := 0 to SchemaItems.Count - 1 do Completion.ItemList.Add(SchemaItems[i].Name); end; begin //Completion.AddEditor(SQLEdit); Completion.Editor := SQLEdit; Completion.EndOfTokenChr := Completion.EndOfTokenChr + #13; Completion.TheForm.Font.Assign(SQLEdit.Font); //Completion.CaseSensitive := True; EnumerateKeywords(Ord(tkDatatype), SqliteTypes, SQLEdit.IdentChars, @DoAddKeyword); FillNow('Table', sqlvEngine.Session.Tables);

Just tried this, you are right it doesn't seem to
buggy. You can report it on mantis, so it wont be forgotten.

Thing is the IDE uses it's own code to do this, search ccComplet in SourceEditor.pp if interested

Reply by email

Martin
to Zaher Dirkey
Zaher Dirkey wrote 5 lines
Thanks for the your replay If syncompletion.pas not a sensitive area i will try to play with code before reporting the bug.

Ok, when I said: the IDE does it's own thing, I did not mean it doesn't use Syncompletion. It does. But it provides a lot of extra glue.

There are also one or two other People using it (because this questions have been asked before...)

But if you can find specific errors, such as why the form doesn't always react to return-key, or why the search doesn.t always work, then let me know.
I will review, and apply

Thanks
Martin

Reply by email

Martin
to Zaher Dirkey: syncompletion.pas in synedit component 1 - in TSynBaseCompletionForm class What for…
Zaher Dirkey wrote 17 lines
syncompletion.pas in synedit component 1 - in TSynBaseCompletionForm class What for FAnsi: boolean; property ffAnsi: boolean read fansi write fansi; 2 -same for TSynBaseCompletion RFAnsi: boolean; SFAnsi: boolean; property AnsiStrings: boolean read SFAnsi write RFAnsi;

Replaced with CaseSensitive

3 - The Auto Complete in TSynCompletion not worked fine with me, it is just 2 char and then stop search for the keyword, after that pressing Enter not close the AutoComplete

I fixed the issue with Enter (SVN revision 21100)

You can assign your own search in OnSearchPosition

example see ide/sourceeditor.pp line 3492

Show quoted text 23 lines
-------- procedure TMainForm.LoadCompletion; procedure FillNow(Name: string; SchemaItems: TmncSchemaItems); var i: Integer; begin for i := 0 to SchemaItems.Count - 1 do Completion.ItemList.Add(SchemaItems[i].Name); end; begin //Completion.AddEditor(SQLEdit); Completion.Editor := SQLEdit; Completion.EndOfTokenChr := Completion.EndOfTokenChr + #13; Completion.TheForm.Font.Assign(SQLEdit.Font); //Completion.CaseSensitive := True; EnumerateKeywords(Ord(tkDatatype), SqliteTypes, SQLEdit.IdentChars, @DoAddKeyword); FillNow('Table', sqlvEngine.Session.Tables); -------------- Thanks

Reply by email

Martin
to Zaher Dirkey: syncompletion.pas in synedit component 1 - in TSynBaseCompletionForm class What for…
Zaher Dirkey wrote 7 lines
syncompletion.pas in synedit component 3 - The Auto Complete in TSynCompletion not worked fine with me, it is just 2 char and then stop search for the keyword, after that pressing Enter not close the AutoComplete

Search should work better now. Keystrokes where handled twice (utf8 and plain). The searchstring therefore contained every char twice, so it couldn't be found.

Show quoted text 23 lines
-------- procedure TMainForm.LoadCompletion; procedure FillNow(Name: string; SchemaItems: TmncSchemaItems); var i: Integer; begin for i := 0 to SchemaItems.Count - 1 do Completion.ItemList.Add(SchemaItems[i].Name); end; begin //Completion.AddEditor(SQLEdit); Completion.Editor := SQLEdit; Completion.EndOfTokenChr := Completion.EndOfTokenChr + #13; Completion.TheForm.Font.Assign(SQLEdit.Font); //Completion.CaseSensitive := True; EnumerateKeywords(Ord(tkDatatype), SqliteTypes, SQLEdit.IdentChars, @DoAddKeyword); FillNow('Table', sqlvEngine.Session.Tables); -------------- Thanks

Reply by email

Zaher Dirkey
to Martin

Thanks ,update and worked :) , and it is add small experience to me, (because it worked on it this morning).

Can i ask again
what is best
Completion.AddEditor(SQLEdit);
or
Completion.Editor := SQLEdit;

Zaher Dirkey

Reply by email

Martin
to Zaher Dirkey
Zaher Dirkey wrote 9 lines
Thanks ,update and worked :) , and it is add small experience to me, (because it worked on it this morning). Can i ask again what is best Completion.AddEditor(SQLEdit); or Completion.Editor := SQLEdit;

As it currently stands, makes no difference

Completion.Editor := SQLEdit; // calls AddEditor

If you want to add more than editor, you can repeat the above command, but it would be more logical to use AddEditor in that case

Reply by email