Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text input between quotes is slow #1327

Closed
f111fei opened this issue Feb 23, 2017 · 4 comments
Closed

Text input between quotes is slow #1327

f111fei opened this issue Feb 23, 2017 · 4 comments
Labels

Comments

@f111fei
Copy link

f111fei commented Feb 23, 2017

What did you do?

  1. Install vim extension.

  2. open a large js file. e.g : https://code.jquery.com/jquery-3.1.1.js

  3. Typing I switch to insert mode.

  4. Typing " and other letters (e.g: "Hello") at first line. The other letters takes a long time to appear.

gif

Technical details:

  • VSCode Version: 1.9.0
  • VsCodeVim Version: 0.5.3
  • OS: windows7 and mac
@johnfn
Copy link
Member

johnfn commented Feb 23, 2017

Easy to reproduce. Also very weird.

@xconverge
Copy link
Member

Yep good catch!

@xconverge
Copy link
Member

I think that this is definitely a large document vs small document issue... I can't reproduce it in smaller files, it has to be a larger file

@xconverge
Copy link
Member

xconverge commented Feb 23, 2017

Ok almost 100% sure this is the culprit, related to something I did I think. And if so it is bad. We have a check in modehandler to create undo points when brackets are open/closed. It executes this:

  if (vimState.currentMode === ModeName.Insert) {
      // Check if the keypress is a closing bracket to a corresponding opening bracket right next to it
      let result = PairMatcher.nextPairedChar(vimState.cursorPosition, key, false);
      if (result !== undefined) {
        if (vimState.cursorPosition.compareTo(result) === 0) {
          return true;
        }
      }

      result = PairMatcher.nextPairedChar(vimState.cursorPosition.getLeft(), key, true);
      if (result !== undefined) {
        if (vimState.cursorPosition.getLeftByCount(2).compareTo(result) === 0) {
          return true;
        }
      }
    }

In nextPairedChar we iterate the whole document....only to check if the character is right next to it.

This should be an easy fix to just check the characters adjacent in for the correct match, instead of the whole document THEN comparing location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants