Git Product home page Git Product logo

ask-vscode.nvim's Introduction

Use the "lightbulb" action menu (think Visual Studio Code) within vim

Vim example

Overview

This plugin will ask a running instance of Visual Studio Code which code actions it would suggest based on your cursor position within a buffer. It will then present the response in a nice popup menu and execute the selected action.

Examples include...

  • Auto importing a required module
  • Infering a type from it's usage
  • Removing unrequired imports
  • ...whatever Visual Studio Code would do
Visual Studio Code Vim
Visual Studio Code example Vim example

Why

I very much prefer as primary editor (numerous reasons). However, Visual Studio Code's code action items are super useful and seem to be consistently ahead of the curve. I wanted to use them within vim.

Goals

  • Treat Visual Studio Code as an external language server protocol.
  • Benefit from the growing Visual Studio Code community from within vim
  • Be language agnostic (ie. don't need to configure numerous language servers within vim - just ask vscode)

How

  • This plugin sends a request to to a running instance of vscode, providing all the deail to execute it's code action providers
  • The response is returned and displayed within a popup
  • Once selected the plugin knows how to execute vscode's code action implementation (provided as a json payload)

Get started

Requirements

  1. The latest version of neovim (which provides the "popup window" functionaity)
brew install --HEAD neovim
  1. The neovim node-client remote plugin host
npm install -g neovim
  1. The ask vscode server Visual Studio Code extension
  2. This plugin
if has('nvim')
  Plug 'kizza/ask-vscode.nvim'
endif

Finally

Map a keybinding to execute this plugin within vim

nnoremap <silent> <Leader>a :AskVisualStudioCode<CR>

Next steps

This plugin is the very definition of beta. I wrote it familiarise myself with nvim's remote plugin functionality. I personally find it useful and will continue to work on it.

On my list to do is...

  • Improve the documentation, installation and setup process (for other operating systems, other vim package managers etc)
  • Expand the code action functionality (ie. currently it does not implement spelling changes)
  • General flurry of improvements

All ideas and support are welcome. If you find this interesting or useful, i'd love you to have a play - and let me know how it goes.

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.