purebasic
purebasic copied to clipboard
AutoComplete Full function
AutoComplete Full function. On #WINDOW_AutoComplete list, use shorcut Shift+Tab (also used for un-indent) to insert the selected word with its quick help function.
I wanted to do it like this but Shift+Tab is not allowed at the moment because it is used by Indent/Unindent. Shift+Tab seems however the most appropriate shortcuts, it's just used here for the AutoComplete Window. I don't know if it's good to allow Shift+Tab in settings or to leave it unconfigurable and hidden.
An interesting idea that could be behind this function, would be an autocomplete v2 function. A little like chi's Lazzycoder tool. For my part, I don't have the knowledge to do it
Well, since the other shortcuts are customizable (including the Tab for insert) having this one hardcoded is not a good idea. How do you know Shift+Tab is the most appropriate for other people's settings?
The shortcut Shift+Tab is now configurable in the preferences. I'm not sure about the changes in CreateKeyboardShortcuts() procedure in ShortcutManagement.pb. Is it possible to check it.
In reference To Pull Request #183: Context sensitive AutoComplete For PB constants For the AutoComplete Full function, it will be possible to write in comment the list of constants that apply to the function ex:
ButtonGadget(#Gadget, x, y, Width, Height, Text$ [, Flags]) ; #PB_Button_Right | #PB_Button_Left | #PB_Button_Default | #PB_Button_MultiLine | #PB_Button_Toggle
If FullFunction And IsBasicFunction(UCase(String$)) <> -1
index = IsBasicFunction(UCase(String$))
;String$ = BasicFunctions(index)\Name$
If BasicFunctions(index)\Proto$
String$ + StringField(BasicFunctions(index)\Proto$, 1, " - ")
; Addition Begin
; Write in comment the List of constants that apply For this Function ex:
Fields = CountString(String$, ",") + 1
*Context.AutoCompleteConstants = 0
; loop in case the flags are not at the last fields
For f = 0 To Fields - 1
; Map has lowercase names and 1-based parameter index
*Context.AutoCompleteConstants = FindMapElement(AutoComplete_ContextConstants(), LCase(BasicFunctions(index)\Name$) + "," + Str(Fields - f))
If *Context
Break
EndIf
Next f
If *Context
ForEach *Context\Constants()
If ListIndex(*Context\Constants()) > 0
String$ + " | " + *Context\Constants()
Else
String$ + " ; " + *Context\Constants()
EndIf
Next *Context\Constants()
EndIf
; Addition End
Else
String$ + "()"
EndIf
EndIf
To temporarily test it in "context-autocomplete" branch, in AutoComplete.pb, AutoComplete_Insert() procedure, add the above code after : "String$ = GetGadgetItemText(#GADGET_AutoComplete_List, index, 0)" and change "If FullFunction And IsBasicFunction(UCase(String$)) <> -1" to "If IsBasicFunction(UCase(String$)) <> -1"
The interest is low for an advanced PureBasic developer. It is just to display the complete syntax to then modify the fields or copy/paste the constants in comments. Given the limited interest, the time I'm wasting you and the conflicts I cause with my friend GitHub. It is perhaps better to delete this branch or that I leave my hand. I wanted to help and participate but I fail. I'm disappointed but otherwise no worries, good continuation :)
Insérez à la fois le nom de la fonction et les paramètres ? Insert both the function name and the parameters ? German ? Fügen Sie sowohl den Namen der Funktion mit den Parametern ?
With functions, It seems to be a good formulation: +1 Then, I can't go any further on my side because of Deutsch/Editor.catalog encoding. I'm not sure how to do it right, between ISO-8859-1 and Github desktop which probably uses my French locale setting, as you. As @tajmone wrote, Encoding in UTF-8 would greatly help.
Also, the function will have its real interest once "Context sensitive AutoComplete for PB constants" #183 is committed and by adding the list of PB Constants in comment as done in this previous post.
ButtonGadget(#Gadget, x, y, Width, Height, Text$ [, Flags]) ; #PB_Button_Right | #PB_Button_Left | #PB_Button_Default | #PB_Button_MultiLine | #PB_Button_Toggle
As previously stated, this function remains of limited interest, it will probably not be used often. However, it may be of interest from time to time when using a function for the first time, for example, or to copy/paste the constants in comments, faster than writing #PB_ with auto-completion. Without complicating too much the current code, the arrays are there, it's just an assembly. It's up to Timo or Fred to choose whether it is worth adding or not.
@ChrisRfr If you want to update your devel
branch to the state of fantaisie-software:devel
branch, use rebase instead of merge.
With rebase, Git will set your devel
branch temporarily to the fantaisie-software:devel
state, and then puts your new commits created in devel
on top of the new devel
. This keeps the commit history clean, without a merge commit.
To fix your devel
branch, follow this instruction. Instead of branch-123
use your devel
branch and instead of master
use the fantaisie-software:devel
branch.
It's been a while and I still have the same problems with the Documentation Catalogs encoding. I am unable to participate. This Pull Request has really a limited interest, I propose to remove it.