0.2.2 • Published 3 years ago

coc-gauge v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

coc-gauge

Gauge language server extension for coc-nvim.

Gauge is a light-weight cross-platform test automation tool.

Notes:

  • This is not an official repository by Gauge project.
  • Some code blocks are taken from coc-nvim and gauge-vscode
  • Currently, I'm checking only JavaScript as step implementation language, but others may work.

Motivation

The gauge command offers language server feature, so you can use it's featue with just setup coc config like below.

{
  "languageserver": {
    "gauge": {
      "command": "gauge",
      "args": ["daemon", "--lsp", "--dir", "."],
      "filetypes": ["spec"],
      "rootPatterns": ["manifest.json"]
    }
  }
}

However, it lacks many features compared to gauge-vscode.
By using this extension, you can get the below features in neovim/vim!

  • Running tests
  • Debugging tests
  • Renaming step (It works just using the LSP, but is insufficient)
  • Listing locations that refer a step

Install

:CocInstall coc-gauge

Commands And Keymaps

Command\<Plug>(keymap)Description
coc-gauge.runAllcoc-gauge-run-allRun all specs
coc-gauge.runSpeccoc-gauge-run-specRun spec opened in current buffer
coc-gauge.runScenarioUnderCursorcoc-gauge-run-scenario-under-cursorRun scenario under the cursor
coc-gauge.runRepeatcoc-gauge-run-repeatRun with last launched config
coc-gauge.debugAllcoc-gauge-debug-allDebug all specs
coc-gauge.debugSpeccoc-gauge-debug-specDebug spec opened in current buffer
coc-gauge.debugScenarioUnderCursorcoc-gauge-debug-scenario-under-cursorDebug scenario under the cursor
coc-gauge.debugRepeatcoc-gauge-debug-repeatDebug with last launched config
coc-gauge.stopcoc-gauge-stopStop runnning gauge test
coc-gauge.renameStepcoc-gauge-rename-stepRename step under the cursor (*)
coc-gauge.restartGaugeServicecoc-gauge-restart-serviceRestart Gauge language server

*: You can also rename a step by executing CocAction('coc-rename'), but it does not work properly, because coc.nvim renaming command uses <cword> to get the name, but step name is generally separated by space characters.

Config

  • coc-gauge.enable(default: true)
    Enable this extention.
  • coc-gauge.verbose(default: false)
    Run gauge command with '--verbose' option.
  • coc-gauge.coc-gauge.autoScrollOutputWindow(default: false) Experimental Automatically scroll the output window to the bottom.

Debug

vimspector is required to be installed for debugging.

Place the following json file as <project-root>/.vimspector.json for debugging.

{
  "configurations": {
    "run": {
      "adapter": "vscode-node",
      "configuration": {
        "request": "attach",
        "stopOnEntry": true,
        "protocol": "inspector",
        "console": "integratedTerminal"
      },
      "breakpoints": {
        "exception": {
          "all": "N",
          "caught": "",
          "uncaught": "Y"
        }
      }
    }
  }
}

The exception part is important! If you don't set the part, vimspector asks you some questions before attaching the session. However, Gauge wait for just 1 second. Therefore, during the dialogue, Gauge gives up waiting for attaching from debugging session, then resume running without any breakpoints.

Autocommands

filetype=spec is set on event BufEnter *.cpt.

Videos

Run run

Debug debug

Jump step references jump

Rename step rename

License

MIT


This extension is created by create-coc-extension

0.2.2

3 years ago

0.2.1

4 years ago

0.1.0

4 years ago

0.2.0

4 years ago