discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Snippets with QScintilla for OpenSCAD?

BH
brad hopper
Thu, Apr 16, 2015 4:48 PM

Hey folks,
Now that OpenSCAD has a new underlying editor - QScintilla, I wonder if there might already be support for "snippets", by which I mean shortcut strings which resolve to longer code templates. (If you google for "snippets" and Qscintilla, you'll get a lot of hits for what I think is actually just mini tutorials on how to use QScintilla, which isn't what I mean)
For example, in OpenSCAD, when I type "for", 99% of the time I will continue to type:
for(i=[-1,1]){    translate([i*0,0,0]) (something like cylinder() );}
and of course, if I type "cyl..." I will almost always want to get
cylinder(r=0,h=0); etc
I think a lot of editors do this type of thing - I used to use Sublime Text 2 and still use Notepad++ but just got tired of using two apps instead of one, especially now that OpenSCAD has nice looking syntax hilighting, theming etc.
I'm thinking that QScintilla might already have this feature and it may be a matter of editing/making a configuration file somewhere... true?
Thanks!
Brad

Hey folks, Now that OpenSCAD has a new underlying editor - QScintilla, I wonder if there might already be support for "snippets", by which I mean shortcut strings which resolve to longer code templates. (If you google for "snippets" and Qscintilla, you'll get a lot of hits for what I think is actually just mini tutorials on how to use QScintilla, which isn't what I mean) For example, in OpenSCAD, when I type "for", 99% of the time I will continue to type: for(i=[-1,1]){    translate([i*0,0,0]) (something like cylinder() );} and of course, if I type "cyl..." I will almost always want to get cylinder(r=0,h=0); etc I think a lot of editors do this type of thing - I used to use Sublime Text 2 and still use Notepad++ but just got tired of using two apps instead of one, especially now that OpenSCAD has nice looking syntax hilighting, theming etc. I'm thinking that QScintilla might already have this feature and it may be a matter of editing/making a configuration file somewhere... true? Thanks! Brad
BH
brad hopper
Thu, Apr 16, 2015 5:01 PM

While I'm on the topic of QScintilla, I'm wondering if, again, there's an underlying configuration file which controls the behavior of the auto indentation?
I would love to have auto-indent and I'm sure it's just a matter of style but what's there by default drives me batty!
I like my indentations to look thusly:
module myModule() {    some code here}
It helps me a lot to be able to see which statement the } closes by just looking straight up.
Using the inbuilt autoindent it takes a crazy number of arrows and backspaces and re-tabbing to get to what I want. Much less trouble at the moment to just turn it off.

While I'm on the topic of QScintilla, I'm wondering if, again, there's an underlying configuration file which controls the behavior of the auto indentation? I would love to have auto-indent and I'm sure it's just a matter of style but what's there by default drives me batty! I like my indentations to look thusly: module myModule() {    some code here} It helps me a lot to be able to see which statement the } closes by just looking straight up. Using the inbuilt autoindent it takes a crazy number of arrows and backspaces and re-tabbing to get to what I want. Much less trouble at the moment to just turn it off.
MK
Marius Kintel
Thu, Apr 16, 2015 5:03 PM

On Apr 16, 2015, at 12:48 PM, brad hopper braddo_99@yahoo.com wrote:

Now that OpenSCAD has a new underlying editor - QScintilla, I wonder if there might already be support for "snippets", by which I mean shortcut strings which resolve to longer code templates. (If you google for "snippets" and Qscintilla, you'll get a lot of hits for what I think is actually just mini tutorials on how to use QScintilla, which isn't what I mean)

This is an attempt are smth. similar:

https://github.com/openscad/openscad/pull/905

-Marius

On Apr 16, 2015, at 12:48 PM, brad hopper <braddo_99@yahoo.com> wrote: > Now that OpenSCAD has a new underlying editor - QScintilla, I wonder if there might already be support for "snippets", by which I mean shortcut strings which resolve to longer code templates. (If you google for "snippets" and Qscintilla, you'll get a lot of hits for what I think is actually just mini tutorials on how to use QScintilla, which isn't what I mean) > This is an attempt are smth. similar: https://github.com/openscad/openscad/pull/905 -Marius
MK
Marius Kintel
Thu, Apr 16, 2015 5:05 PM

On Apr 16, 2015, at 13:01 PM, brad hopper braddo_99@yahoo.com wrote:

While I'm on the topic of QScintilla, I'm wondering if, again, there's an underlying configuration file which controls the behavior of the auto indentation?

There is some configuration in Preferences.
If you try tweaking those, and then describe in more detail what you want, we could take a look at it.

-Marius

On Apr 16, 2015, at 13:01 PM, brad hopper <braddo_99@yahoo.com> wrote: > While I'm on the topic of QScintilla, I'm wondering if, again, there's an underlying configuration file which controls the behavior of the auto indentation? > There is some configuration in Preferences. If you try tweaking those, and then describe in more detail what you want, we could take a look at it. -Marius