discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

autocomplete feature extension

UF
ulf.freyhoff@gmx.net
Mon, Jul 26, 2021 4:46 PM

hi,

since i spend a lot of time adding brackets as well as commas,

could the autocomplete feature complete like so:

‘translate([0,0,0])’ instead of just ‘translate’ ?

of course for example for ‘scale’ it would be ‘scale([1,1,1])’

or would it be unnerving for the 2d users to erase the third parameter ?

i did not see through the inner workings of the qscintilla editing component yet …

greetz to all, ulf

hi, since i spend a lot of time adding brackets as well as commas, could the autocomplete feature complete like so: ‘translate(\[0,0,0\])’ instead of just ‘translate’ ? of course for example for ‘scale’ it would be ‘scale(\[1,1,1\])’ or would it be unnerving for the 2d users to erase the third parameter ? i did not see through the inner workings of the qscintilla editing component yet … greetz to all, ulf
TP
Torsten Paul
Mon, Jul 26, 2021 10:33 PM

On 26.07.21 18:46, ulf.freyhoff@gmx.net wrote:

could the autocomplete feature complete like so:
‘translate([0,0,0])’ instead of just ‘translate’ ?

From technical perspective that should be possible. I'm not
sure if there's a safe way to modify the cursor position after
the text is inserted, but that would likely be solvable too.

It would reduce the "natural" invocation of the call-tips
though as those are triggered by typing the '('.

Also it would be more difficult to extend the feature to
user defined modules as those then would need to provide
some additional information, or revert to just use the
names.

So overall, I'm not sure if that's the best way to go.

Maybe another option would be to improve the code snippet
handling which already has support for even inserting multi
line code snippets with some basic awareness of indentation.

i did not see through the inner workings of the qscintilla
editing component yet …

Autocompletion and call-tips are handled by a dedicated
API provided by QScintilla. The main entry point is:
https://github.com/openscad/openscad/blob/master/src/ScadApi.cc#L20

For templates / code snippets, see:
https://github.com/openscad/openscad/blob/master/src/ScintillaEditor.cc#L1195

ciao,
Torsten.

On 26.07.21 18:46, ulf.freyhoff@gmx.net wrote: > could the autocomplete feature complete like so: > ‘translate([0,0,0])’ instead of just ‘translate’ ? From technical perspective that should be possible. I'm not sure if there's a safe way to modify the cursor position after the text is inserted, but that would likely be solvable too. It would reduce the "natural" invocation of the call-tips though as those are triggered by typing the '('. Also it would be more difficult to extend the feature to user defined modules as those then would need to provide some additional information, or revert to just use the names. So overall, I'm not sure if that's the best way to go. Maybe another option would be to improve the code snippet handling which already has support for even inserting multi line code snippets with some basic awareness of indentation. > i did not see through the inner workings of the qscintilla > editing component yet … Autocompletion and call-tips are handled by a dedicated API provided by QScintilla. The main entry point is: https://github.com/openscad/openscad/blob/master/src/ScadApi.cc#L20 For templates / code snippets, see: https://github.com/openscad/openscad/blob/master/src/ScintillaEditor.cc#L1195 ciao, Torsten.
M
MichaelAtOz
Mon, Jul 26, 2021 10:56 PM

‘translate([0,0,0])’ instead of just ‘translate’ ?

I find when that style is used you end up with more keystrokes
moving the cursor and deleting the '0's & then going to end of line & ENTER.

Would it be possible to combine the template/snippets with the future
key customisation, to associate a key with a template?

Thus you could do 'tr' (autocomplete pops-up) ENTER ('anslate' added),
then you could have a couple of key-combinations to follow that with,
e.g. Ctl-alt-0 inserts a template of '([_])' {where _ is the cursor},
then you enter number,number etc. Or do the full '([0,0,0])' if that's your thing.
Ctl-alt-1 does '([1,1,1])' or whatever.

-----Original Message-----
From: Torsten Paul [mailto:Torsten.Paul@gmx.de]
Sent: Tue, 27 Jul 2021 08:34

--
This email has been checked for viruses by AVG.
https://www.avg.com

> > ‘translate([0,0,0])’ instead of just ‘translate’ ? I find when that style is used you end up with more keystrokes moving the cursor and deleting the '0's & then going to end of line & ENTER. Would it be possible to combine the template/snippets with the future key customisation, to associate a key with a template? Thus you could do 'tr' (autocomplete pops-up) ENTER ('anslate' added), then you could have a couple of key-combinations to follow that with, e.g. Ctl-alt-0 inserts a template of '([_])' {where _ is the cursor}, then you enter number,number etc. Or do the full '([0,0,0])' if that's your thing. Ctl-alt-1 does '([1,1,1])' or whatever. > -----Original Message----- > From: Torsten Paul [mailto:Torsten.Paul@gmx.de] > Sent: Tue, 27 Jul 2021 08:34 -- This email has been checked for viruses by AVG. https://www.avg.com
TP
Torsten Paul
Mon, Jul 26, 2021 11:33 PM

On 27.07.21 00:56, MichaelAtOz wrote:

Would it be possible to combine the template/snippets
with the future key customisation, to associate a key
with a template?

Probably not with the current solution which uses the
built-in "User-Lists" from QScintilla. I don't know if
those support input customization. But there is nothing
that would prevent us from having a 2nd way for accessing
the templates.

ciao,
Torsten.

On 27.07.21 00:56, MichaelAtOz wrote: > Would it be possible to combine the template/snippets > with the future key customisation, to associate a key > with a template? Probably not with the current solution which uses the built-in "User-Lists" from QScintilla. I don't know if those support input customization. But there is nothing that would prevent us from having a 2nd way for accessing the templates. ciao, Torsten.
I
info@hjcreations.nl
Wed, Jul 28, 2021 6:36 AM

Hi 2 all.

Is it not an idea to make this all more flexible.
I mean that everybody can change what he/she like,
after all we're all openscad users so 'parametrics' ;)

I do not know the exact principle but can imagine there is kind of ascii
file
where everybody can change it to the prefered result.

MichaelAtOz schreef op 2021-07-27 00:56:

‘translate([0,0,0])’ instead of just ‘translate’ ?

I find when that style is used you end up with more keystrokes
moving the cursor and deleting the '0's & then going to end of line &
ENTER.

Would it be possible to combine the template/snippets with the future
key customisation, to associate a key with a template?

Thus you could do 'tr' (autocomplete pops-up) ENTER ('anslate' added),
then you could have a couple of key-combinations to follow that with,
e.g. Ctl-alt-0 inserts a template of '([_])' {where _ is the cursor},
then you enter number,number etc. Or do the full '([0,0,0])' if that's
your thing.
Ctl-alt-1 does '([1,1,1])' or whatever.

-----Original Message-----
From: Torsten Paul [mailto:Torsten.Paul@gmx.de]
Sent: Tue, 27 Jul 2021 08:34

Hi 2 all. Is it not an idea to make this all more flexible. I mean that everybody can change what he/she like, after all we're all openscad users so 'parametrics' ;) I do not know the exact principle but can imagine there is kind of ascii file where everybody can change it to the prefered result. MichaelAtOz schreef op 2021-07-27 00:56: >> > ‘translate([0,0,0])’ instead of just ‘translate’ ? > > I find when that style is used you end up with more keystrokes > moving the cursor and deleting the '0's & then going to end of line & > ENTER. > > Would it be possible to combine the template/snippets with the future > key customisation, to associate a key with a template? > > Thus you could do 'tr' (autocomplete pops-up) ENTER ('anslate' added), > then you could have a couple of key-combinations to follow that with, > e.g. Ctl-alt-0 inserts a template of '([_])' {where _ is the cursor}, > then you enter number,number etc. Or do the full '([0,0,0])' if that's > your thing. > Ctl-alt-1 does '([1,1,1])' or whatever. > > >> -----Original Message----- >> From: Torsten Paul [mailto:Torsten.Paul@gmx.de] >> Sent: Tue, 27 Jul 2021 08:34
TP
Torsten Paul
Wed, Jul 28, 2021 9:04 AM

On 28.07.21 08:36, info@hjcreations.nl wrote:

I do not know the exact principle but can imagine there
is kind of ascii file where everybody can change it to the
prefered result.

For text templates yes, see this thread for some details:
https://lists.openscad.org/empathy/thread/WYMTSQDMVOUQW7WJFPBSDZ4OEZCJ677W?hash=HANEQ5O6JNDIB2ILFTZCO2YKFX5EJE6P#HANEQ5O6JNDIB2ILFTZCO2YKFX5EJE6P

For the auto-complete feature it's not likely to have a
configuration option as this is either coming from the
source code for the built-in modules plus at some point
from the opened scad script.

ciao,
Torsten.

On 28.07.21 08:36, info@hjcreations.nl wrote: > I do not know the exact principle but can imagine there > is kind of ascii file where everybody can change it to the > prefered result. For text templates yes, see this thread for some details: https://lists.openscad.org/empathy/thread/WYMTSQDMVOUQW7WJFPBSDZ4OEZCJ677W?hash=HANEQ5O6JNDIB2ILFTZCO2YKFX5EJE6P#HANEQ5O6JNDIB2ILFTZCO2YKFX5EJE6P For the auto-complete feature it's not likely to have a configuration option as this is either coming from the source code for the built-in modules plus at some point from the opened scad script. ciao, Torsten.
M
MichaelAtOz
Wed, Jul 28, 2021 10:43 AM

The issue is OpenSCAD is constructed with a bunch of library code.
That means it is not possible (rather not straight forward) to do detailed customisation.
You live within the capabilities of the libraries.

-----Original Message-----
From: info@hjcreations.nl [mailto:info@hjcreations.nl]
Sent: Wed, 28 Jul 2021 16:37
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: autocomplete feature extension

Hi 2 all.

Is it not an idea to make this all more flexible.
I mean that everybody can change what he/she like,
after all we're all openscad users so 'parametrics' ;)

I do not know the exact principle but can imagine there is kind of ascii
file
where everybody can change it to the prefered result.

MichaelAtOz schreef op 2021-07-27 00:56:

‘translate([0,0,0])’ instead of just ‘translate’ ?

I find when that style is used you end up with more keystrokes
moving the cursor and deleting the '0's & then going to end of line &
ENTER.

Would it be possible to combine the template/snippets with the future
key customisation, to associate a key with a template?

Thus you could do 'tr' (autocomplete pops-up) ENTER ('anslate' added),
then you could have a couple of key-combinations to follow that with,
e.g. Ctl-alt-0 inserts a template of '([_])' {where _ is the cursor},
then you enter number,number etc. Or do the full '([0,0,0])' if that's
your thing.
Ctl-alt-1 does '([1,1,1])' or whatever.

-----Original Message-----
From: Torsten Paul [mailto:Torsten.Paul@gmx.de]
Sent: Tue, 27 Jul 2021 08:34


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

The issue is OpenSCAD is constructed with a bunch of library code. That means it is not possible (rather not straight forward) to do detailed customisation. You live within the capabilities of the libraries. > -----Original Message----- > From: info@hjcreations.nl [mailto:info@hjcreations.nl] > Sent: Wed, 28 Jul 2021 16:37 > To: OpenSCAD general discussion > Subject: [OpenSCAD] Re: autocomplete feature extension > > Hi 2 all. > > Is it not an idea to make this all more flexible. > I mean that everybody can change what he/she like, > after all we're all openscad users so 'parametrics' ;) > > I do not know the exact principle but can imagine there is kind of ascii > file > where everybody can change it to the prefered result. > > > > > MichaelAtOz schreef op 2021-07-27 00:56: > >> > ‘translate([0,0,0])’ instead of just ‘translate’ ? > > > > I find when that style is used you end up with more keystrokes > > moving the cursor and deleting the '0's & then going to end of line & > > ENTER. > > > > Would it be possible to combine the template/snippets with the future > > key customisation, to associate a key with a template? > > > > Thus you could do 'tr' (autocomplete pops-up) ENTER ('anslate' added), > > then you could have a couple of key-combinations to follow that with, > > e.g. Ctl-alt-0 inserts a template of '([_])' {where _ is the cursor}, > > then you enter number,number etc. Or do the full '([0,0,0])' if that's > > your thing. > > Ctl-alt-1 does '([1,1,1])' or whatever. > > > > > >> -----Original Message----- > >> From: Torsten Paul [mailto:Torsten.Paul@gmx.de] > >> Sent: Tue, 27 Jul 2021 08:34 > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
UF
ulf.freyhoff@gmx.net
Wed, Jul 28, 2021 10:48 AM

hello, the templates are close to what i had in mind, only on my ubuntu linux, the “alt-insert” shortcut does not work…

greetz, ulf

hello, the templates are close to what i had in mind, only on my ubuntu linux, the “alt-insert” shortcut does not work… greetz, ulf