cucumber / language-server

Cucumber Language Server
MIT License
35 stars 20 forks source link

Fix: take snippet template from config #113

Open SteveRusin opened 2 weeks ago

SteveRusin commented 2 weeks ago

šŸ¤” What's changed?

Fix: Take snippetTemplates property from user's lsp config

I have following lsp configuration for cucumber_language_server, however snippetTemplates is ignored. I need to change the template to use regular function instead of arrow one

    lspconfig['cucumber_language_server'].setup({
      capabilities = capabilities,
      on_attach = on_attach,
      cmd = { "fnm", "exec", "--using=18", "node", vim.fn.stdpath('data') .. "/mason/bin/cucumber-language-server", "--stdio" },
      root_dir = require("lspconfig").util.find_git_ancestor,
      settings = {
        cucumber = {
          features = { "**/*.feature" },
          glue = { "**/*.steps.ts" },
          parameterTypes = {},
          snippetTemplates = {
            tsx = string.gsub([[

              {{ keyword }}('{{ expression }}', function ({{ #parameters }}{{ #seenParameter }}, {{ /seenParameter }}{{ name }}{{ /parameters }}) {
                // {{ blurb }}
              })
            ]], "\n%s+", "\n")
          }
        },
      }
    })

āš”ļø What's your motivation?

It fixes the bug when user of the service cannot specify custom snippetTemplates option

šŸ·ļø What kind of change is this?

šŸ“‹ Checklist:


This text was originally generated from a template, then edited by hand. You can modify the template here.