question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grammar Injection doesn't not work on multi-line content

See original GitHub issue

From @zh4ui on October 29, 2017 13:8

I tried to inject TOML grammar into markdown, however the TOML colorizer only works on the first line (i.e. a = “b” in the image), it doesn’t work on the following line (i.e. d = “c” in the image)

begin-toml-end

My tmLanguage.json for the injection is like:

{
	"fileTypes": [],
	"injectionSelector": "text.html.markdown",
	"name": "tomlfrontmatter",
	"patterns": [
		{
			"begin": "\\Abegin\\s*",
			"end": "(^|\\G)end\\s*$",
				
				"patterns": [
					{
						"include": "source.toml"
					}
				]
		}
	],
	"scopeName": "toml.frontmatter.markdown"
}

The complete source code is at: https://github.com/zh4ui/vscode-markdowntoml.git

  • VSCode Version: Version 1.17.2 (1.17.2)
  • OS Version: macOS 10.13 (17A405)

Steps to Reproduce:

  1. install the Better TOML for TOML colorizer
  2. git clone https://github.com/zh4ui/vscode-markdowntoml.git
  3. cd vscode-markdowntoml && code .
  4. F5 to debug the code
  5. Create a markdown file in the [Extension Development Host]
  6. type in the content
begin a = "b"
c = "d"
end

Reproduces without extensions: No

Copied from original issue: Microsoft/vscode#37098

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zh4uicommented, Oct 31, 2017

Okay. Writing a TextMate Grammar: Some Lessons Learned gives a fairly good explanation about “begin…end” and “begin…while”.

I am wondering is there a plan for vscode-textmate to support “begin…while”?

0reactions
zh4uicommented, Nov 26, 2017

@colinfang

Yes, markdown-it only deals with markdown preview. So I gave up trying.

I’ve got an impression that currently grammar injection is just a hack, rather than a useable feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiline comments in VS Code for Raku - github
First off, I presume the [ "/*", "*/" ], line should be deleted. Raku doesn't support that form of block commenting. Next, having...
Read more >
Please, Java. Do Finally Support Multiline String Literals
Yes. I don't understand why Java still doesn't have multiline string literals. How often do you write JDBC code (or whatever other external ......
Read more >
YAML Multiline Strings
They can be in the string, but : cannot appear before a space or newline, and # cannot appear after a space or...
Read more >
How can I filter a view using a blank multi-line field?
For Multiline plain text fields just doing [Field] contains '' won't work. Instead, setup the view with all the columns you want, sorting,...
Read more >
Ruby Style Guide
Indent succeeding lines in multi-line boolean expressions. ... the comment describes the function, it does not tell the function what to do.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found