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

auto closing pairs with conflicting patterns problems #72177

Closed
msftrncs opened this issue Apr 12, 2019 · 3 comments · Fixed by #110094
Closed

auto closing pairs with conflicting patterns problems #72177

msftrncs opened this issue Apr 12, 2019 · 3 comments · Fixed by #110094
Labels
editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@msftrncs
Copy link

Version: 1.33.1 (user setup)
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:27:14.102Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

Steps to Reproduce:

  1. Create two auto closing pairs in a language configuration file,
	"autoClosingPairs": [
		{"open": "(", "close": ")"},
		{"open": "(*", "close": "*)",  "notIn": ["string"]},
	],
  1. trying using the two character auto closing pair, (* and you will get (**)).

On the other hand, if you remove the ending ')' from the closing '*)' you almost get normal function, except that in cases where ( doesn't auto close with ), you get (**.

Note this condition exists in #57838, in a reference to the Structured Text Language, though it is not shown in the example on that feature request. Reference the repository https://github.com/Serhioromano/vscode-st for some example.

I think the Auto Closing logic needs to consider when auto closing pairs might conflict with each other. In this case, '(**)' overlaps with '()'.

@rmunn
Copy link
Contributor

rmunn commented Aug 16, 2019

Another example is [<SomeAttribute>] in F#, where typing [< produces >]] where the closing bracket is doubled up because [] is also a bracket.

Sample of doubled brackets

As you can see, the first [ creates a matching ]. Then when the < is typed, which is the second character of [<, the matching >] is inserted without considering the fact that there's already a ] present in the file, which results in a doubled-up right bracket: [<>]] instead of [<>].

This also happens with most F# tokens that are two or more characters, e.g. array syntax [||], anonymous record syntax {||}, comment block syntax (**), and so on.

@vscodebot
Copy link

vscodebot bot commented Jan 15, 2020

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodebot
Copy link

vscodebot bot commented Jan 17, 2020

🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@rmunn @rebornix @alexdima @rzhao271 @msftrncs and others