New functionality for 2016 Beta:
1) Script.RegisterAction and Script.RegisterDocumentAction now returns the name of the registered action
2) AutoCompleteLibrary.AddPHPEntry(LibraryName: string; ItemType: TPhpItemType; Name, Description, Inheritance: string; Scope: TPhpItemScope; IsStatic: Boolean; Arguments: string; ClassName, ClassExtends, Returns: string) - added ClassExtends parameter
New functions/attributes for 2016 Beta:
1) Actions.SetIcon(Actn: string; Icon: TBitmap)
2) function LoadFileToBitmap(InputFileName: string; BM: TBitmap): Boolean
3) Script.ProjectSettings.SelectedProjectFileTypes
4) Script.ProjectSettings.SelectedProjectExcludeFilters
5) Script.ProjectSettings.SelectedProjectAssetsBrowseDir
6) AutoComplete.Clear(Strings: TStrings) - AutoComplete class functions are meant to be called from "auto_complete" signal processing function (see below). Sample below.
7) AutoComplete.AddItem(Strings: TStrings; const CodeWord, Txt: string): Integer
8 ) AutoComplete.GetWordBeforeCursor(AdditionalChars: string): string
9 ) AutoComplete.Count(Strings: TStrings): Integer
10) AutoComplete.GetCodeWord(idx: Integer): string
11) AutoComplete.SetImageIndex(ItemIndex, ImgIndex: Integer)
12) AutoComplete.GetFunctionData(LookupType: string; var Name, ObjName, ObjClass, ObjSignature: string; var Param, Start: Integer)
13) AutoComplete.FormatActiveParam(s: string; Param: Integer): string
New signals for 2016 Beta:
1) update_code_type (Params: AType: Integer) - signal sent when cursor traverses between different code types (e.g. from HTML into JavaScript etc) or on actions that
might change the code type, it's not always guaranteed to change.
2) auto_complete (Params: CodeType, ACType: Integer; Strings: TStrings; AKey: Char; var AllowPopup, ShowImages: boolean) - signal sent on AutoComplete popup. Use Strings parameter with AutoComplete class functions that require it.
3) show_hint (Params: CodeType: Integer; var Hint: string; AKey: Char; var AllowHint: Boolean) - signal sent on code hint (when cursor is inside function brackets and/or ctrl+shift+space is pressed)
New type/enums for 2016 Beta:
1) pscTrait added to TPhpItemScope
AutoComplete and Code Hint sample:
- Code: Select all
function OnAutoComplete(CodeType, ACType, Strings, AKey, AllowPopup, ShowImages) {
//debug stuff for trying out different AC types
//ACType will be different for PHP functions, properties, classes, JS objects, methods, HTML tags, attributes etc
//Script.Message("ACType: " + _t(ACType));
if (Strings.Count > 0) {
Script.Message("Sample item:" + Strings[0]);
}
if (ACType == 19) {
//add a hyphotetical PHP global function
AutoComplete.AddItem(Strings, "awesomefunction", "int{\\rtf\\b awesomefunction} (string $someparam, string $secondparam)");
} else if (ACType == 18) {
//add a hypthetical PHP global variable
AutoComplete.AddItem(Strings, "$CONFIG", "$CONFIG");
} else if (ACType == 4) {
//add this experimental HTML tag
var i = AutoComplete.AddItem(Strings, "shadow", "shadow");
AutoComplete.SetImageIndex(i, 8);
}
}
function OnShowHint(CodeType, Hint, AKey, AllowHint) {
//Script.Message(_t(CodeType) + ":" + Hint);
if ((CodeType == 6) && (Hint == "")) {
var Name = "";
var ObjName = "";
var ObjClass = "";
var ObjSignature = "";
var Param = 0;
var Start = 0;
AutoComplete.GetFunctionData("PHP", Name, ObjName, ObjClass, ObjSignature, Param, Start);
//Script.Message(Name + ":" + ObjName + ":" + ObjClass + ":" + ObjSignature);
//Script.Message(_t(Param) + ":" + _t(Start));
if ((Name == "awesomefunction") && (ObjName == "") && (ObjSignature == "")) {
Hint = "{\\colortbl\\red128\\green128\\blue128}int awesomefunction ( string $someparam, string $secondparam )\r\n{\\cf0 Do something awesome}\r\n{\\cf0 Added by: Auto complete plugin }";
Hint = AutoComplete.FormatActiveParam(Hint, Param);
AllowHint = true;
}
}
}
Script.ConnectSignal("auto_complete", &OnAutoComplete);
Script.ConnectSignal("show_hint", &OnShowHint);