Page 1 of 2
Autocompletion
Posted: Tue Aug 24, 2021 10:58 pm
by gilgml
Hey there, vibrant and helpful community
I am thinking about buying community +
I have a question about Autocompletion :
Does it show you the identifiers you declared/used above or before in the stack ?
If i remember well, visual studio code did it.
Re: Autocompletion
Posted: Wed Aug 25, 2021 2:15 pm
by dunbarx
Hi.
Do you mean the "Options" submenu in the "Edit" menu, while the SE is in front?
And by "identifiers", do you mean variables?
Craig
Re: Autocompletion
Posted: Wed Aug 25, 2021 2:55 pm
by richmond62
I suppose Autocompletion may be a good thing.
Personally I have turned it off in all the Apps on both my Android phone and my Android tablet,
and anywhere else: it is almost as bad as spelling correxion that forces me to use either American
spelling or "British" English spelling.
Also those double speech marks that keep doubling all over the place just stick in my
craw.
Re: Autocompletion
Posted: Wed Aug 25, 2021 5:07 pm
by dunbarx
Is "autoCompletion" really the right word? LC has automatic SE aids, like "bracket completion", and "control structure completion", all in that "Options" subMenu, but gilgmi, is that what you meant?
Craig
Re: Autocompletion
Posted: Wed Aug 25, 2021 5:09 pm
by dunbarx
And I am much with Richmond here. I only use "Live Errors", "Control structure completion" and "autoFormat".
NEVER the others.
Craig
Re: Autocompletion
Posted: Wed Aug 25, 2021 8:42 pm
by richmond62
I am much with Richmond here
Be careful, you may get blacklisted.

Re: Autocompletion
Posted: Fri Aug 27, 2021 2:26 pm
by gilgml
Hello !
Sorry for keeping you waiting because i thought i was Email notified, and was not.
If it is a source of trouble, i will double check, but about identifiers i meant variable names yes, and command and function names.
IMHO, this is were it becomes really handy.
Re: Autocompletion
Posted: Sat Aug 28, 2021 5:29 am
by dunbarx
Hi.
So if you check "variable checking"in the Option menu wihile the SE is in front, or select "strict compilation mode" in the SE preferences, then if you do NOT declare your variables, the SE will not let you proceed.
But that is still different from autoCompletion, or at least what I think that word actually means.
Craig
Re: Autocompletion
Posted: Sat Aug 28, 2021 5:01 pm
by jacque
I don't use autocomplete either, but if I remember right it did complete variable names if they were used in the same handler. I'm not sure if it also completes variables anywhere in the same script.
Command and function handler declarations are automatically completed with the "end" statement, also control structures and paired characters like parentheses, quotation marks, brackets, etc. You can disable any of these features if you don't want them.
Re: Autocompletion
Posted: Sat Aug 28, 2021 8:07 pm
by gilgml
Thank you.
I was wondering for variable autocompletion, if possible across handlers, and anywhere in the same script.
And also command and function names.
Thank you jacque, i noticed the very handy 'pairing' of brackets and etc and control structures.
Not worth the price, so.
Re: Autocompletion
Posted: Sat Aug 28, 2021 11:40 pm
by jacque
I just tried it. Auto-completion depends on the scope of the variable. That means that global variables and script-local variables complete anywhere if they are declared in the script. Variables that occur only within a handler will auto-complete within that handler, but are removed from memory when the handler completes.
Re: Autocompletion
Posted: Sun Aug 29, 2021 4:58 pm
by golife
Besides, that is it good practice, even "best practice", to declare all variables, the autocompletion so much goes in the way for a fast typist (such as me) so that I turn it off my default. I can write faster than I can think...
But I have another question regarding autocomplete: I want to autocomplete tags (labels) that users enter for a given subject. Once completed, they form a group that contains this one phrase or word and receive colors and are in a box. They appear usually in one row horizontally, eventually create new rows. Each of them can be clicked away and the list can be reordered through drag and drop by the user. Maybe someone has already done something like this? (So far, I am using a type-forward list field, but it is not such a good solution in this specific case).
Roland
Re: Autocompletion
Posted: Mon Aug 30, 2021 4:27 am
by dunbarx
Hi.
It sounds like what you want is far outside the capabilities of any type of built-in autoComplete.
But it can be scripted easily. Please give an example of some initial text, and the resultant text your want after the user has gotten hold of it.
The drag and drop gadget you describe has been done in several ways by several people here. I can give you an example of the way I have done it, but let us do the tag/label thing first.
Craig
Re: Autocompletion
Posted: Mon Aug 30, 2021 5:02 pm
by golife
@: dunbarx on 29 Aug 2021, 23:27
Thank you dubarx
Well, the list is for example "LiveCode Builder, LIveCode Script, Private, Business school".
These are items, and the items will be tags. If the tag exists, it is autocompleted, otherwise it is added to the tag list.
So, users would enter words and phrases. It is easy to separate the items as long as there is a comma delimiter. But I currently do not have the handler to autocomplete when the user start typing.
Items that have been identified (new or existing) will be a group with a checkbox that allows the user to click them away. Deletion is just another variant, desired, or not. Items appear one after the other. Also not a problem. This is clear.
But how to make autocomplete work nicely without obstructing the work flow of the user while typing... ? So, let the user start when more than 3 characters were typed... rawkeydown, closefield, backspace, ... find one or more phrases that would autocomplete the word/phrase and let the user select without obstructing...
I can work on it, but if there is a slick solution already, why do the work twice?
Re: Autocompletion
Posted: Mon Aug 30, 2021 8:36 pm
by dunbarx
Fun, fun fun.
Here are two experiments I made that autoComplete text. Both work. A textChanged handler in the yellow fields does the work. Click on one of the buttons, and start typing in the yellow field that gains focus. Any word in the "source" field above that field will autoComplete at three chars.
The problem is when a compound word lives within an item. To be able to discriminate between, say, "LiveCode builder" and "LiveCode Script", using only a few characters as a seed is the issue. You can always change the "3' in the "compound" "textChanged" handler to "10". But that makes general usage far less valuable.
I can think of several kludges that will solve this, perhaps by temporarily combining all compound words within each item into a single word and then restoring the space(s). Want to tackle that?
Craig