snippets.ts 497 B

12345678
  1. // 1. Convert from Ace `$1` to CodeMirror numbered placeholder format `${1}` or `#{1}` in snippets.
  2. // Note: metadata from the server still uses the old format, so it's not enough to convert all
  3. // the bundled data to the new format.
  4. // 2. Add a final placeholder at the end of the snippet to allow for
  5. // shift-tabbing back from the penultimate placeholder. See #8697.
  6. export const prepareSnippetTemplate = (template: string): string => {
  7. return template.replace(/\$(\d+)/g, '#{$1}') + '${}'
  8. }