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

Incorrect brackets match in markdown text #33513

Closed
flily opened this issue Aug 30, 2017 · 2 comments
Closed

Incorrect brackets match in markdown text #33513

flily opened this issue Aug 30, 2017 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded

Comments

@flily
Copy link

flily commented Aug 30, 2017

  • VSCode Version: Code 1.15.1 (41abd21, 2017-08-16T17:15:57.756Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions:
Extension Author (truncated) Version
python don 0.7.0
shell-format fox 1.0.0
MagicPython mag 1.0.12
cpptools ms- 0.12.3
python tht 0.2.3
shellcheck tim 0.1.0

I was writing a markdown file, and found the right bracket matching incorrect to the bracket in a code string. The text i wrote is shown as followed.

By searching code with `pcregrep` (with regex `\bmain\s*\(`)

The last right bracket did not match the first one, but the one in regex.

I have try some similar case in C code but it works well. I think there may be something special that forget to make effect on markdown file.

Reproduces without extensions: Yes/No

@flily flily changed the title Incorrect brackets match in some special context Incorrect brackets match in markdown text Aug 30, 2017
@alexdima
Copy link
Member

In the language agnostic bracket matching algorithm, strings, regular expressions and comments are ignored.

We recognize these syntactical constructs if the scope name contains: string, regex or comment. Currently, these are not configurable. It is implemented here.

In this case, the markdown grammar does not identify the region between `s as either of these and the bracket matching algorithm proceeds to attempt to match brackets inside that region.

screen shot 2017-08-30 at 15 19 07

@mjbvz I leave it up to you if you'd want to sneak in any scope name in the .md grammar that contains the text string in it for the inline markup case. e.g. markup.inline.raw.markdown => markup.inline.raw.string.markdown, etc.

@alexdima alexdima assigned mjbvz and unassigned alexdima Aug 30, 2017
@mjbvz mjbvz added the bug Issue identified by VS Code Team member as probable bug label Sep 1, 2017
@mjbvz mjbvz added this to the September 2017 milestone Sep 1, 2017
@mjbvz
Copy link
Contributor

mjbvz commented Sep 1, 2017

Thanks @alexandrudima! This sounds like a good suggestion. I'll look into this for September

@mjbvz mjbvz closed this as completed in 0ff02b2 Sep 1, 2017
@roblourens roblourens added the verified Verification succeeded label Sep 27, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants