summary refs log tree commit diff
path: root/.vim/snippets/javascript.lua
blob: 4c7b8e340338125b4d4ea5794b45c00814b0b443 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---@diagnostic disable: undefined-global

local jsdoc_s = function(ctx, snip)
  return s(ctx, snip, {
    show_condition = cond.ts('comment'),
  })
end

return {
  s({ trig = 'jsdoc', name = 'JSDoc comment' }, {
    t('/**'),
    nl(),
    t(' * '),
    i(1),
    nl(),
    t(' */'),
  }),
  jsdoc_s(
    { trig = 'param', name = 'JSDoc @param' },
    { t('@param '), t('{'), i(1), t('}'), t(' '), i(2) }
  ),
  jsdoc_s(
    { trig = 'return', name = 'JSDoc @return' },
    { t('@return '), t('{'), i(1), t('}'), t(' ') }
  ),
}