Git Product home page Git Product logo

vim-coverage's Introduction

vim-coverage is a utility for visualizing test coverage results in vim. vim-coverage relies on maktaba for registration and management of coverage providing plugins.

For details, see the helpfiles in the doc/ directory. The helpfiles are also available via :help vim-coverage if vim-coverage is installed (and helptags have been generated).

Commands

Use :CoverageShow to show file coverage for the current buffer. Use :CoverageToggle to toggle coverage visibility for the current file.

Installation

This example uses Vundle, whose plugin-adding command is Plugin.

" Add maktaba and coverage to the runtimepath.
" (The latter must be installed before it can be used.)
Plugin 'google/vim-maktaba'
Plugin 'google/vim-coverage'
" Also add Glaive, which is used to configure coverage's maktaba flags. See
" `:help :Glaive` for usage.
Plugin 'google/vim-glaive'
call glaive#Install()
" Optional: Enable coverage's default mappings on the <Leader>C prefix.
Glaive coverage plugin[mappings]

Make sure you have updated maktaba recently. Older versions had an issue detecting installed libraries.

Installing and configuring coverage providers

vim-coverage defines no built-in formatters. The easiest way to see the list of available providers is via tab completion: Type :CoverageShow <TAB> in vim.

To use a particular provider, type :CoverageShow PROVIDER-NAME. This will either show coverage in the current buffer using the selected provider or show an error message if provider is not available. Normally you will trigger providers via key mappings and/or autocommand hooks.

Coverage offers a lot of customization on colors and signs rendered for covered and uncovered lines. You can get a quick view of all coverage flags by executing :Glaive coverage, or start typing flag names and use tab completion. See :help Glaive for usage details.

Any plugin wishing to be a coverage provider needs only to register itself using Maktaba's registry feature, passing a dictionary of following format:

  • IsAvailable(filename) - return 1 if plugin can handle the current file, otherwise 0.
  • GetCoverage(filename) - returns the coverage dict created by coverage#CreateReport that contains all coverage data.
  • Name() - returns the name of the plugin.
  • optional: GetCoverageAsync(filename, callback) - gets the coverage and once done, invokes the provided callback with the coverage dict created by coverage#CreateReport that contains all coverage data.

Example:

let s:registry = maktaba#extension#GetRegistry('coverage')
call s:registry.AddExtension({
      \ 'name': 'my_provider',
      \ 'GetCoverage': function('myplugin#GetCoverage'),
      \ 'GetCoverageAsync': function('myplugin#GetCoverageAsync'),
      \ 'IsAvailable': function('myplugin#IsAvailable')})

vim-coverage's People

Contributors

dbarnett avatar stgpetrovic avatar alexhaxe avatar andreich avatar

Watchers

rosa maria palacios juncosa avatar  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.