Wish Snippets manager

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
Fed up by copy/paste, I wish a Snippets manager could be added to B4X.

It would work like a Map with :
- as key a name freely entered by the user // not null
- as value a formatted piece of code

The snippets manager would be available as a panel like the Logs or File Manager.
It will display the keys ordered ascending.

The keys are name of text files listed from a settable directory without their file's extension.

Clicking right on the panel will propose to refresh the directory (as the library files).

Clicking on a key will insert the code snippet at the cursor's position (works for the code editor AND the Manifest editor).

There should be no control at the code when inserted in the Snippet manager (but of course when inserted in the Code editor).

Formatting (more wishes) :
If possible, ease the user's work by inserting a commented line containing the name of the key at the top of the inserted snippet and a commented line with a / and the name of the key at the end of the snippet.

Thanks
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
I am planning such addition to a new release of my B4X-Launcher...
Maybe we can discuss this feature and how it could be implemented....
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
hello @Cableguy
Yes, if AnyWhere Software decides that is not important, I would be glad and honored to work on that project with you again :)
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Well... Some code about in B4J... The problem remains the same : if AnyWhere Software doesn't include that in their tool, we will have to use CTRL + V to paste the content inside the Code Editor...
 

Attachments

  • snippetsmanager.zip
    5.3 KB · Views: 232

Cableguy

Expert
Licensed User
Longtime User
Thanks for sharing this...
Have you taken a look at the JAWTRobot and the JHook libraries?
I believe that working together, they may accomplish the task as you desire
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello @Cableguy
The problem at that time is, as I can see it, the action of pasting the code in B4X Code Editor at the cursor's position.
I haven't found the solution : when the cursor is on the Snippet Manager, it had left the Code Editor already.
So it sounds to me like it is not possible without AnyWhere Software goodwill. Or am I wrong on that, missing something ?
 

Cableguy

Expert
Licensed User
Longtime User
From what I could understand from a few unrelated threads regarding some IDE features and other stuff, the IDE is based on a third party solution, so I guess there is some kind of API for it...

Still, for me, inserting at cursor position may not always be wanted, as we can sometimes"forget" what exactly we were doing and where while browsing a few code snippets... and end up adding code in the wrong place.
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Top