Snippet Panel context menu

Plugins for SynWrite and CudaText...
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Snippet Panel context menu

Post by Stefan »

Wish: direct access to the file that contains the clip I hover over. Like Synwrite does it. I don't need a dialog. A simple "Edit this file" is sufficient.
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Post by main Alexey »

good small idea. wrote it to my to-do (at Github).
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Post by main Alexey »

i just saw the code. not easy to add. reason: folder of snippets can be a) in plugin's dir, b) in data/ dir (all default snippets lay there).
And one or more files can lay in the same folder.
so i cannot easily 'get' the current filename in the code.
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

I see what you mean.
For me, it were sufficient to only gain access to \data\clips and it's various subfolders. But I realize, this might confuse other users, when it only works for certain entries and not everywhere.

Guess I will have to consolidate my snippets into one txt-file only, per category/subfolder. Then add \data\clips to all my projects and switch back and forth in the side panels.

Btw, Synwrite also allowed *.synw-snippet files in the side panel. Cuda does not.
It was useful when writing documentations, to insert example snippets, even though they did not belong to txt or md or html. Now I have to open a separate doc with the correct lexer, so I can get to the right snippets menu, then insert from there, cut and paste it over to my documentation tab. No big deal, it's doable. But Synwrite was more flexible in that respect.
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Post by main Alexey »

hm, is it hard to convert old *.synw-snippet files to format of Snippet Panel?
it's documented: https://wiki.lazarus.freepascal.org/Cud ... ppet_Panel
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

Not sure I understand. Are you saying, I should be able to read in .cuda-snippet files located in data\clips\MyCategory into the side panel? I was under the impression, that both, .cuda-snippet and .synwrite-snippet only work from the snippets MENU, after I paste them into the \data\snippets_ct\MyLexer\*.json file, but not from the side panel.
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Post by main Alexey »

we have 2 snippets plugins

a. 'Snippets'. uses dir data/snippets_ct. supports *.synw-snippet.
b. 'Snippet Panel'. uses different dir under 'data'. AFAIR it don't support *.synw-snippet.
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

Exactly. That's what I meant. I cannot use my .synw-snippet files in the side panel.
main Alexey wrote:hm, is it hard to convert old *.synw-snippet files to format of Snippet Panel?
it's documented: https://wiki.lazarus.freepascal.org/Cud ... ppet_Panel
How would I do that? The documentation says, it only supports the ${sel} macro. All my ${NN:default text} etc does not seem to work from the side panel. I have to insert them one by one into the Snippets Menu and replace the double // by single /. And then they are lexer-bound. I have tried to not assign a lexer, but did not succeed.
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Post by main Alexey »

>all my ${NN:default text} etc does not seem to work from the side panel.
yes. sorry, such tab-stops won't work with the Snippet Panel.

> I have tried to not assign a lexer, but did not succeed.
sounds like a bug in Snippets plugin. snippets must support 'any lexer' when lexer is not set.
give me 1-2 such snippets to test.
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Post by main Alexey »

Confirmed that snippet with empty 'group's lexers' field don't work for ALL lexers. filed as a bug to my github.
Post Reply