Skip to content

Releases: zardoy/vscode-better-snippets

v0.1.25

03 Sep 03:13
Compare
Choose a tag to compare

New Features

  • typing-snippets: enable support for multicursor by default
    you can disable it typingSnippetsEnableMulticursor setting f71db34
  • Trigger Characters! (#16)
    presenting you absolutely new feature! Now you can target some snippets to only show after typing specific character!
    It wasn't possible before to split snippets into groups, but now you can do this with new when.triggerCharacters optional array.

The Problem

Even if you have quick suggestions enabled, it doesn't mean it would show snippets after typing every character (even space).
What if we wanted to quickly specify true/false after property name or expand it as a method?

const config = {
enableFeature
customMethod
}

Here, we have two properties, we want to quickly specify true on first and epxand method on second.
Firstly, let's assume that we don't want complicated checks and hacks. No typing snippets.
We could add a snippet to expand it to true/method after a single word on the line so we could type space and... the snippet won't appear, yes, because you firstly need to trigger completions and only then you can select it, this can be super annoying

enableFeature t -> true

The Solution

{
"name": "t",
"body": ": true,",
"when": {
"lineHasRegex": "^\\s*\\w+ $",
"triggerCharacters": [
" "
]
},
"replaceTriggerCharacter": true
},
// to expand it as method
{
"name": "fun",
"body": "($1) {\n\t$0\n},",
"when": {
"lineHasRegex": "^\\s*\\w+ $",
"triggerCharacters": [
" "
]
},
"replaceTriggerCharacter": true
},

Also, as you can see, we also now have optional replaceTriggerCharacter setting, because we want to remove the trigger character (space in our case):

enableFeature t 61b7ffdb5c2fce855817754ed288fe6218de13d2
### Bug Fixes

- **perf**: doesn't check changed contents for non-writable FS (e.g. for outputs) 072c330b5d485b91f598d2927d6308a4a180ac06

v0.1.24

04 May 19:18
Compare
Choose a tag to compare

Bug Fixes

  • fix auto-import for new version of TypeScript
    auto-import was broken for some time, since they simplified the format auto codefix message 2b7401a
  • hide internal command for builtin snippets 919b378

v0.1.23

01 Apr 15:07
5485d6d
Compare
Choose a tag to compare

New Features

  • other lines (#9)
  • Introduce new snippet constrain! Meet otherLines!

Until now, we had only lineRegex and lineHasRegex snippet constrain. Both received regex and can be used to filter out snippets by matching regex against current line.
Now you have the same thing to for any other line as well! The most powerful thing is that you can also match regex against line with one indentation up (you can set any number). More docs and examples are coming soon, however active usage of that feature theoretically can slowdown weak computors. Also basic example was updated to use this new feature. 5485d6d

  • Builtin useParam snippet now use otherLines constrain with function|=>|React.FC regex on indentation above. If you feel some slowdown for you or just want to make your configured version, you can disable this snippet (see below). Also we removed sortText. This all can be breaking behavior for some use cases, however, the main intention was to just make it less annoying on every single line. 5485d6d
  • Add experimental way to completely disable some builtin snippets via specifying experimental.disableBuiltinSnippets array as names.
    MARK AS BETA/UNSTABLE! 5485d6d

v0.1.22

20 Feb 07:49
Compare
Choose a tag to compare

New Features

  • patch ordering of suggestions when editing settings.json. ced7cc8

Bug Fixes

  • fix default value of snippetCreator.showSnippetAfterCreation. The behaviour of setting (even default one) isn't changed. You need to explicitly disable setting if you want to disable opening settings.json after snippet creation ced7cc8

v0.1.21

19 Feb 17:38
Compare
Choose a tag to compare

New Features

  • merge workspace-level snippets with global instead of replacing them
    ⚠️ It changes the way extension worked before! Previously, defining customSnippets and typingSnippets at workspace level (in .vscode/settings.json) led to replacing snippets from global settings.json. Now they are merged instead. 1d44c42

v0.1.20

19 Feb 13:18
Compare
Choose a tag to compare

New Features

  • allow to configure (add/change existent) language supersets
    Example of adding vue to js superset:
{
  "betterSnippets.languageSupersets": {
    "js": ["typescript", "javascript", "typescriptreact", "javascriptreact", "vue"]
     ...
  }
}

Bug Fixes

  • improve titles for prompts in snippet creator 5046b25

v0.1.19

28 Jan 16:01
Compare
Choose a tag to compare

New Features

  • improve snippet creation command (language comparing & detection, now select default superset) c9633bc

Bug Fixes

  • fix an issue where typing snippets were ignoring when.language c9633bc
  • suggest to use styles lang group when creating snippet from selection c9633bc

v0.1.18

17 Jan 17:40
Compare
Choose a tag to compare

Bug Fixes

  • correctly compare the typing sequence
    Important hotfix for experimental typing snippets 856d6a8

v0.1.17

17 Jan 12:00
902f627
Compare
Choose a tag to compare

Bug Fixes

  • REVAMPED resolveImports (#2)
    Now we import missing things from just inserted snippets even better, you just need to define resolveImports to be explicit (as useState for example can also be in another package).
    Now we delay displaying error about failed identifiers to import and now you can also control that delay via setting. This was done because TypeScript Language Features extensions is slow AF. If you have really fast machine, try to lower that setting to get failing notifications faster!
    Also it is now finally possible to install missing packages with npm Rapid Ready. After installing packages, imports will be resolved. You don't need to reapply the snippet! 902f627

v0.1.16

17 Jan 09:07
Compare
Choose a tag to compare

Bug Fixes

  • make description of the snippets optional
    That regression only affected IDE suggestions when editing settings.jsno 5ca0ea6