Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Switching Vim Modes (insert, visual, etc) will hang VsCode

Open jwmann opened this issue 7 years ago • 11 comments

Describe the bug In the most recent version of VsCode, switching modes will result in a hang. This happens regardless of the mode switch, visual or insert or back to normal mode. Setting "vim.statusBarColorControl": false, will alleviate the issue.

To Reproduce

  1. Have "vim.statusBarColorControl": true, in settings.json
  2. Switch to a different vim mode (e.g.: press i in normal mode)

Expected behaviour No editor hang

Environment (please complete the following information):

  • Issue Type: Bug
  • Extension Name: vim
  • Extension Version: 1.8.1
  • OS Version: Darwin x64 18.2.0 (MacOS 10.14.3)
  • VSCode version: 1.36.0

This is related to #3825

jwmann avatar Jul 04 '19 21:07 jwmann

Getting this as well:

  • Extension Version: 1.8.1
  • OS Version: macOS Mojave 10.14.5 (18F203)
  • VSCode version: 1.36.0

Confirmed setting "vim.statusBarColorControl": false alleviates issue.

donut avatar Jul 04 '19 22:07 donut

Yeah, it is quite heavy to have the Vim plugin edit the settings.json file and make VS Code re-fresh settings every time you switch modes.

Is there not a better way? Why doesn't the plugin instead trigger styling for a CSS class that targets the status bar, instead of modifying settings.json?

trusktr avatar Jul 08 '19 05:07 trusktr

Getting this with Windows 10 as well.

Extension Version: 1.8.1 OS Version: Windows 10 Enterprise 1903 (Build 18362.175) VSCode version: 1.36.0

Can also confirm that setting "vim.statusBarColorControl" to false removes the lag.

sjetha-pason avatar Jul 09 '19 17:07 sjetha-pason

There is a disclaimer on our readme for this feature. Please see the linked issue for more background information: https://github.com/VSCodeVim/Vim#vim-airline

jpoon avatar Jul 12 '19 02:07 jpoon

Tracking down what was causing this slowdown was rough. I turned this on a long time ago and never had issues until recently. Thanks for reporting!

third774 avatar Jul 16 '19 14:07 third774

@jpoon Thank you for pointing that out, however I already knew this feature came with a performance hit.

I have been using this feature for roughly 6-7 months now. As soon as VsCode updated to 1.36.0 it has made the editor become practically unusable. I'm talking a full 2 second hang after every mode switch vs maybe an extra millisecond from before.

The difference is night and day.

jwmann avatar Jul 16 '19 18:07 jwmann

I encountered this when going to insert mode and typing a period. It was not set in my json file to anything.

Extension Version: 1.8.2 OS Version: OSX Mojave 10.14.6 VSCode version: 1.36.1

Confirmed manually setting "vim.statusBarColorControl": false alleviates issue.

----- UPDATED ----

Turns out this didn't fix the issue. It fixed the issue if I type a period, but it now hangs when I type a quote.

----- UPDATE -----

disabling the extension...

IntelliSense for CSS, SCSS class names in HTML, Slim and SCSS

...seems to have resolved the issue.

bkyam avatar Jul 26 '19 21:07 bkyam

Guys, guess we have to ask the VSCode team for a proper API to change status bar instead of the current hack? I'm currently experiencing huge lag about 2~3 sec when switching mode or search which insane.

NStal avatar Aug 02 '19 07:08 NStal

Just to add to the pressure, Vim plugin for Visual Studio Code has become unacceptable in the last months. I type fast, and I constantly get scrambled letters because Vim creates huge latency in responding to commands.

arthakdoo avatar Aug 18 '19 08:08 arthakdoo

Looks like I was blaming it on Vim plugin when actually the "Auto Import" plugin was slowing down my whole Visual Studio Code. Sorry, it wasn't intentional. After uninstalling Auto Import, I still have auto suggestions, Eslint, and Vim Plugin, but no more abnormal slowdown.

arthakdoo avatar Aug 20 '19 02:08 arthakdoo

For anyone who wants the fancy colors without the performance hit here is a custom styling with the Custom UI Style plugin (https://marketplace.visualstudio.com/items?itemName=subframe7536.custom-ui-style).

Image

Put this into your settings.json:

  "vim.statusBarColorControl": false,
  "custom-ui-style.stylesheet": {
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label='-- NORMAL --'])": {
      "background-color": "#005f5f !important",
      "color": "#ffffff !important"
    },
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label='-- INSERT --'])": {
      "background-color": "#5f0000 !important",
      "color": "#ffffff !important"
    },
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label='-- VISUAL --'])": {
      "background-color": "#5f00af !important",
      "color": "#ffffff !important"
    },
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label='-- VISUAL LINE --'])": {
      "background-color": "#005f87 !important",
      "color": "#ffffff !important"
    },
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label^=':'])": {
      "background-color": "#007acc !important",
      "color": "#ffffff !important"
    },
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label^='/'])": {
      "background-color": "#007acc !important",
      "color": "#ffffff !important"
    },
    "[id='workbench.parts.statusbar']:has([id='vscodevim.vim.primary'].statusbar-item[aria-label^='match '])": {
      "background-color": "#007acc !important",
      "color": "#ffffff !important"
    },
  },

Or if you dont want the entire statusbar colored, but just the mode indicator:

Image
	"vim.statusBarColorControl": false,
    "[id='vscodevim.vim.primary']": {
      "transition": "background-color 0.1s ease-in-out" // remove this if you dont want smooth effect
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label='-- NORMAL --']": {
      "background-color": "#005f5f !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label='-- INSERT --']": {
      "background-color": "#5f0000 !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label='-- VISUAL --']": {
      "background-color": "#5f00af !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label='-- VISUAL LINE --']": {
      "background-color": "#005f87 !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label^=':']": {
      "background-color": "#007acc !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label^='/']": {
      "background-color": "#007acc !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label^='match ']": {
      "background-color": "#007acc !important",
      "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item[aria-label$=' written']": {
      // "background-color": "#000000 !important",
      // "color": "#ffffff !important"
    },
    "[id='vscodevim.vim.primary'].statusbar-item>a:hover:not(.disabled)": {
      "color": "#ffffffbb !important"
    }

Edgar-P-yan avatar Feb 22 '25 19:02 Edgar-P-yan