luasnip with jsdoc like in the luasnip features video

This page summarizes the projects mentioned and recommended in the original post on /r/neovim

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • neogen

    A better annotation generator. Supports multiple languages and annotation conventions.

  • Well, I jsdoc and similar types of comments have a lot of things to consider so I suggest you to use a separate plugin: https://github.com/danymat/neogen

  • LuaSnip

    Snippet Engine for Neovim written in Lua.

  • -- experiment with live jsdoc local ls = require("luasnip") local s = ls.snippet local sn = ls.snippet_node local t = ls.text_node local i = ls.insert_node local d = ls.dynamic_node local r = ls.restore_node local c = ls.choice_node -- from https://github.com/L3MON4D3/LuaSnip/blob/master/Examples/snippets.lua#L81-L166 -- hacked up for javascript and jsdoc local function jsdoc(args) local pstring = vim.trim(args[1][1]) local nodes = { t({ "/**", " * " }), r(1, "desc", i(1, "A short Description")), t({ "", "" }), } -- At least one param. if #pstring > 0 then vim.list_extend(nodes, { t({ " * ", "" }) }) end local insert = 2 for arg in string.gmatch(pstring, '%w+') do local inode = r(insert, "arg" .. arg, i(1, "any")) vim.list_extend(nodes, { t({ " * @param {" }), inode, t({ "} " .. arg .. " ", "" }) }) insert = insert + 1 end vim.list_extend(nodes, { t({ " * @returns {" }), r(insert, "returns", i(1, "void")), t({ "} ", ""}) }) vim.list_extend(nodes, { t({ " */" }) }) local snip = sn(nil, nodes) return snip end return { -- function with jsdoc s("jf", { d(4, jsdoc, 3), -- generate the jsdoc t({ "", "" }), c(1, { -- choose function or method t({ "function "}), t({ "" }) }), i(2, "name"), -- give it a name t("("), i(3), -- parameters t(")"), t({ " {", "\t" }), i(0), -- body t({ "", "}" }), }), }

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • [Help] Convert LaTeX UltiSnips Snippets to LuaSnip

    3 projects | /r/neovim | 16 Aug 2022
  • Nvim + nvim-cmp + luasnip jumps to previous snippets

    3 projects | /r/neovim | 9 May 2022
  • Code documentation with Luasnip

    3 projects | /r/neovim | 4 Apr 2022
  • What is your preferred snippet plug-in?

    1 project | /r/neovim | 14 Aug 2023
  • HTML and Css snippets

    2 projects | /r/neovim | 3 Jul 2023