mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 14:19:11 +02:00
CodeCompletion works pretty well.
Shane git-svn-id: trunk@167 -
This commit is contained in:
parent
bf2acd12f4
commit
e07823a099
@ -38,7 +38,6 @@ Known Issues:
|
|||||||
unit SynCompletion;
|
unit SynCompletion;
|
||||||
|
|
||||||
{$I SynEdit.inc}
|
{$I SynEdit.inc}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -262,6 +261,8 @@ begin
|
|||||||
Scroll.OnChange := {$IFDEF FPC}@{$ENDIF}ScrollChange;
|
Scroll.OnChange := {$IFDEF FPC}@{$ENDIF}ScrollChange;
|
||||||
Scroll.Parent := self;
|
Scroll.Parent := self;
|
||||||
Scroll.OnEnter := {$IFDEF FPC}@{$ENDIF}ScrollGetFocus;
|
Scroll.OnEnter := {$IFDEF FPC}@{$ENDIF}ScrollGetFocus;
|
||||||
|
Scroll.Width := 10;
|
||||||
|
Scroll.Visible := TRue; //shane
|
||||||
Visible := false;
|
Visible := false;
|
||||||
FFontHeight := Canvas.TextHeight('Cyrille de Brebisson');
|
FFontHeight := Canvas.TextHeight('Cyrille de Brebisson');
|
||||||
Color := clWindow;
|
Color := clWindow;
|
||||||
|
@ -240,8 +240,7 @@ Begin
|
|||||||
else
|
else
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
|
||||||
//does freeing this kill my result? Check this...
|
Freemem(PP);
|
||||||
// Freemem(PP);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TComponentInterface.GetPPropInfoByName(Name:String): PPropInfo;
|
Function TComponentInterface.GetPPropInfoByName(Name:String): PPropInfo;
|
||||||
@ -266,13 +265,11 @@ Begin
|
|||||||
else
|
else
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
|
||||||
//does freeing this kill my result? Check this...
|
Freemem(PP);
|
||||||
// Freemem(PP);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TComponentInterface.GetComponentType : String;
|
Function TComponentInterface.GetComponentType : String;
|
||||||
Begin
|
Begin
|
||||||
//???What do I return? TObject's Classtype?
|
|
||||||
Result:=FControl.ClassName;
|
Result:=FControl.ClassName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -495,7 +492,8 @@ end;
|
|||||||
Function TComponentInterface.Focus : Boolean;
|
Function TComponentInterface.Focus : Boolean;
|
||||||
Begin
|
Begin
|
||||||
// XXX Todo:
|
// XXX Todo:
|
||||||
|
if (FCOntrol is TWinControl) {and (TWinControl(FControl).CanFocus)} then
|
||||||
|
TWinControl(FControl).SetFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TComponentInterface.Delete : Boolean;
|
Function TComponentInterface.Delete : Boolean;
|
||||||
|
@ -137,7 +137,7 @@ type
|
|||||||
Procedure BookMarkGoto(Value : Integer);
|
Procedure BookMarkGoto(Value : Integer);
|
||||||
|
|
||||||
Procedure ccExecute(Sender : TObject);
|
Procedure ccExecute(Sender : TObject);
|
||||||
|
procedure ccComplete(var Value: ansistring; Shift: TShiftState);
|
||||||
|
|
||||||
Procedure ProcessUserCommand(Sender: TObject; var Command: TSynEditorCommand; var AChar: char; Data: pointer);
|
Procedure ProcessUserCommand(Sender: TObject; var Command: TSynEditorCommand; var AChar: char; Data: pointer);
|
||||||
|
|
||||||
@ -280,6 +280,8 @@ var
|
|||||||
Editor_Num : Integer;
|
Editor_Num : Integer;
|
||||||
aHighlighter: TSynPasSyn;
|
aHighlighter: TSynPasSyn;
|
||||||
aCompletion : TSynCompletion;
|
aCompletion : TSynCompletion;
|
||||||
|
scompl : TSynBaseCompletion; //used in ccexecute and cccomplete
|
||||||
|
|
||||||
|
|
||||||
{ TSourceEditor }
|
{ TSourceEditor }
|
||||||
|
|
||||||
@ -838,6 +840,25 @@ Begin
|
|||||||
EditorOpts.GetSynEditSettings(FEditor);
|
EditorOpts.GetSynEditSettings(FEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditor.ccComplete(var Value: ansistring; Shift: TShiftState);
|
||||||
|
var
|
||||||
|
S1,S2 : String;
|
||||||
|
Begin
|
||||||
|
Writeln('ccComplete. Value = '+Value);
|
||||||
|
Writeln('FEditor.seltext = '+FEditor.Seltext);
|
||||||
|
S1 := Copy(Value,1,pos(' ',Value)-1);
|
||||||
|
Delete(Value,1,pos(' ',Value));
|
||||||
|
S2 := Copy(Value,1,pos(' ',Value)-1);
|
||||||
|
|
||||||
|
if S1 = 'property' then Value := S2
|
||||||
|
else
|
||||||
|
if S1 = 'procedure' then Value := S2+'(';
|
||||||
|
|
||||||
|
Value := Feditor.SelText + Value;
|
||||||
|
scompl.Deactivate;
|
||||||
|
End;
|
||||||
|
|
||||||
|
|
||||||
Procedure TSourceEditor.ccExecute(Sender : TObject);
|
Procedure TSourceEditor.ccExecute(Sender : TObject);
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -847,7 +868,6 @@ type
|
|||||||
TypeName : ShortString;
|
TypeName : ShortString;
|
||||||
end;
|
end;
|
||||||
var
|
var
|
||||||
scompl : TSynBaseCompletion;
|
|
||||||
S : TStrings;
|
S : TStrings;
|
||||||
CompInt : TComponentInterface;
|
CompInt : TComponentInterface;
|
||||||
CompName : String;
|
CompName : String;
|
||||||
@ -1006,6 +1026,7 @@ Begin
|
|||||||
RefreshEditorSettings;
|
RefreshEditorSettings;
|
||||||
aCompletion.Editor := FEditor;
|
aCompletion.Editor := FEditor;
|
||||||
aCompletion.OnExecute := @ccExecute;
|
aCompletion.OnExecute := @ccExecute;
|
||||||
|
aCompletion.OnCodeCompletion := @ccComplete;
|
||||||
FEditor.Lines.Assign(FSource);
|
FEditor.Lines.Assign(FSource);
|
||||||
FEditor.Setfocus
|
FEditor.Setfocus
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user