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

Do not auto-close when ending with open autoClosingPair #55314

Closed
MattHardcastle opened this Issue Jul 28, 2018 · 9 comments

Comments

Projects
None yet
4 participants
@MattHardcastle
Contributor

MattHardcastle commented Jul 28, 2018

  • VSCode Version: 1.25.1
  • OS Version: Mac OS X 10.13.6 (17G65)

Steps to Reproduce:

  1. Open new file
  2. Set language mode to Python
  3. type "marry had a little lamb" (w/o quote)
  4. insert cursor anywhere in the string and type " (quote character)

Expected results:

  • A quote character will be added

Actual result:

  • Two quote characters are added

Does this issue occur when all extensions are disabled?: Yes


This bug happens with any line that ends in a character that starts an open autoClosingPair. It's especially prevalent in the Python language mode because Python has so many open autoClosingPairs that begin with a letter, but the bug will present itself in any language mode that has open autoClosingPairs similar to Python's.

@kieferrm

This comment has been minimized.

Contributor

kieferrm commented Jul 30, 2018

Can't reproduce with a vanilla VS Code installation. Can you attach a gif?

@kieferrm

This comment has been minimized.

Contributor

kieferrm commented Jul 30, 2018

/needsMoreInfo

@vscodebot vscodebot bot added the needs more info label Jul 30, 2018

@kieferrm kieferrm self-assigned this Jul 30, 2018

@vscodebot

This comment has been minimized.

vscodebot bot commented Jul 30, 2018

Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

Happy Coding!

@kieferrm kieferrm assigned rebornix and unassigned kieferrm Jul 30, 2018

@MattHardcastle

This comment has been minimized.

Contributor

MattHardcastle commented Jul 30, 2018

I'm happy to provide a gif of the issue:

double-quote-issue

I used version 1.26.0-insider in the gif:

version-info

@kieferrm

This comment has been minimized.

Contributor

kieferrm commented Jul 30, 2018

@MattHardcastle this is what I get in today's insider without any Python related extension.

lcb8nydt8h

Based on your gif I assume you have a python extension installed. Please file the issue against the extension you use. Thanks a ton!

@vscodebot

This comment has been minimized.

vscodebot bot commented Jul 30, 2018

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this Jul 30, 2018

@MattHardcastle

This comment has been minimized.

Contributor

MattHardcastle commented Jul 30, 2018

@kieferrm I'm reproducing the insider version of VSCode w/o any extensions installed. I believe you're failing to replicate the issue because you're not ending the string in the correct character. The bug will only present itself when a line ends in in r, u, f, or b.

The issue is caused by a bug in the way electricCharacters are recognized. It presents itself in the native Python extension because python has multi-character opening autoClosingPairs. For example r" opens a raw string in Python. VSCode is configured to recognize that and closes raw strings with a matching quote. The bug is that the opening character match is checking the end of a string instead of checking the cursor character backward for the open autoClosingPair.

I investigated this over the weekend and got a working fix in PR #55315.

@kieferrm

This comment has been minimized.

Contributor

kieferrm commented Jul 30, 2018

@MattHardcastle got it now. Thanks for explaining.

@MattHardcastle

This comment has been minimized.

Contributor

MattHardcastle commented Jul 30, 2018

No problem, @kieferrm. Thanks for reconsidering the issue.

@rebornix rebornix added the bug label Sep 5, 2018

@rebornix rebornix added this to the September 2018 milestone Sep 5, 2018

@rebornix rebornix closed this in 87fb8da Sep 5, 2018

@jrieken jrieken added the verified label Sep 26, 2018

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 20, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.