GithubHelp home page GithubHelp logo

sshelll / telescope-gott.nvim Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 0.0 595 KB

A telescope plug helps you run go test easily.

License: BSD 2-Clause "Simplified" License

Lua 100.00%
neovim-plugin golang testing

telescope-gott.nvim's Introduction

telescope-gott.nvim

A nvim go test runner based on [email protected] and telescope.nvim.
This extension helps you choose and run a go test func with telescope.

Demo

demo

Requirements

  1. [email protected] (required)

go install github.com/sshelll/gott/v2@latest

  1. telescope.nvim (required)

Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.x' }

  1. gott.nvim (optional, but highly recommend)

Plug 'sshelll/gott.nvim'

Install

use your nvim plug manager, for example:

Plug 'sshelll/telescope-gott.nvim'

Setup

require('telescope').load_extension('gott')

Config

require('telescope').setup {
    defaults = {
        -- ...
    },
    pickers = {
        -- ...
    },
    -- config telescope-gott here ⬇️
    extensions = {
        gott = {
            test_args = "-v -vet=off", -- go test args
            test_args_list = {
                "-v",
                '-gcflags=\"all=-l -N\" -v'
            },                         -- go test args list, if this is empty, use test_args. Otherwise, you'll see another picker to choose args.
            timeout = 3000,            -- try to close go test result notification after 3s.
            keep = function()          -- decide whether to keep the notification after timeout(3s).
                return false           -- you can use 'return true' to keep the notification window forever.
            end,
            render = 'default',        -- default / minimal / simple / compact, controls the notification style.
            theme = 'dropdown',        -- cursor / dropdown / ivy, telescope picker theme
            layout_config = {          -- telescope picker layout
                width = 0.2,
                height = 0.4,
            },
            display_with_buf = {       -- display go test result with buf instead of vim.notify
                enabled = false,       -- set to true to enable this feature
                modifiable = false,    -- set to true to make the buf modifiable
                height = 20,           -- set the buf height
            },
        },
    }
}

Usage

  1. :Telescope gott, use this command to open the test selector.
  2. :lua require('notify').dismiss(), use this command to clear the test result pop-up notifications.

It's recommended to make your own custom key map or cmd for the 2nd command.

Also note that the 2nd command will clear all notifications made by the 'notify' plug.

If you have gott.nvim installed, you can use :GottClear instead of the 2nd command.

Tips!

There's similar tool to run test - gott.nvim.

The differences between gott.nvim and telescope-gott.nvim:

  1. gott.nvim provides a vim cmd to run the test under the cursor, while telescope-gott.nvim provides a interactive way to choose a go test to run.
  2. gott.nvim allows you to enter go test args, such as :Gott -v -race, while telescope-gott.nvim can only exec go tests with configured args.

And that's why I highly recommend you to install both of them 🎉!

telescope-gott.nvim's People

Contributors

sshelll avatar

Stargazers

nebu avatar Felix Schürmeyer avatar  avatar Siddhartha Basu avatar Chaz avatar Rizky Ilham Pratama avatar  avatar Ryan Oles avatar Antoine Cotten avatar Yuta Katayama avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.