CudaText-addons / cuda_snippets

CudaText plugin: Snippets
6 stars 5 forks source link

readme file needs revision #32

Closed veksha closed 1 year ago

veksha commented 1 year ago

we can add to readme:

Plugin for CudaText.
Snippets engine, which is described in CudaText wiki:
https://wiki.freepascal.org/CudaText_plugins#Snippets

IMPORTANT NOTICE:
- For your own snippets it is better to create custom snippet package.
  Because if you modify standard packages and reinstall them, your changes will be lost.
  That is why editing controls are disabled for packages whose names start with "std." or "snippets."

Formats of snippets supported:

- CudaText snippets.
  These are packages with prefix "snippets_ct" in the Addons Manager.
  They are installed into folder [CudaText]/data/snippets_ct.
- VSCode snippets.
  These are VSCode packages located in the VSCode repositories.
  They are installed to folder [CudaText]/data/snippets_vs.

......

also question: what formats of snippets are actually supported by Snippets plugin/engine?

i think the only format that is supported now is VSCode Snippets JSON format?

if so then we can remove "Now plugin also supports snippets from VS Code...." from readme. and replace with something like: "VS Code snippet format support is a big rework done by @OlehL" also we can remove info about macros from readme. this info is too detailed for file like this, i think.

and reword "Formats of snippets supported:" to "Snippet folders:" ?

also maybe this info in wiki is outdated:

Snippets file names
Snippets are stored in separate files with extensions:

.cuda-snippet or .synw-snippet: main format.
.cuda-snips: compact format for collections of tiny snippets.

....

what do you say, @Alexey-T ?

Alexey-T commented 1 year ago

Agree! I don’t remember are old snip formats still supported or not. I will check it . And will update readme

Alexey-T commented 1 year ago

I know that both formats

Dir snippets_ct Dir snippets_vs

are supported. Addons manager has many snippets in first format !

veksha commented 1 year ago

Addons manager has many snippets in first format !

can you show example of snippets in old format that can be installed from Addons manager? I read somewhere they were all converted to a new format.

Alexey-T commented 1 year ago

readme is fixed. wiki is cleaned.

can you show example of snippets in old format that can be installed from Addons manager?

no, all old snippets-sets were converted to snippets_ct format.

veksha commented 1 year ago

snippets_ct format is the same as snippets_vs format, no?

Alexey-T commented 1 year ago

hmm, I don't know. pls check it.

veksha commented 1 year ago

I checked some. I think the old format is not used. they are both in VS Code JSON format.

Alexey-T commented 1 year ago

Yes, okay. what to fix in readme/wiki?

veksha commented 1 year ago

in wiki this is no longer needed:

Format of .cuda-snippet
First lines have format "key=value" (no spaces around "="), where "key" is one of strings:

"name": snippet full name, shown in dialog.
"id": snippet short alias for Tab-key (latin letters, digits, "_.$"), line is optional.
"lex": lexers list, comma-separated, for which snippet is active, line is optional, empty means snippet always active.
Then follows the line "text=" without value, and all next lines - are snippet contents.

Trailing blank lines are discarded.
Use tab-chars in text indents, they are auto replaced to spaces if current editor configured so.
Format of .cuda-snips
File contains one or several lines, one snippet per line. Empty lines, lines starting with "#" or space, are ignored. Format of lines:

id text
/N=name text
id /N=name text
id /L=lexers text
id /L=lexers /N=name text
id /L="lexers" /N="name" text
Here "id" is short alias for Tab-key, "name" (if not set, it's the same as "id") is full name for dialog, "lexers" is comma-separated lexer list, "text" is snippet contents. Contents can have escaped special chars: "\n", "\r", "\t" (tab-char), "\\" (backslash).
veksha commented 1 year ago

and maybe mention in readme/wiki that both folders has same format.

Alexey-T commented 1 year ago

ok, changed line to Plugin supports two snippets folder, but formats of data are the same, VSCode JSON format:

Alexey-T commented 1 year ago

readme.txt changed too, will upload it next time.