Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This [extension for VSCode](https://marketplace.visualstudio.com/items?itemName=

## Features

- Syntax highlighting grammar for Nushell scripts (`.nu` files)
- Syntax highlighting grammar for Nushell scripts (`.nu` files) and ``nushell`` codeblocks in Markdown files
- Goto definition
- Hover support
- Validation (errors with red squiggly lines)
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
"language": "nushell",
"scopeName": "source.nushell",
"path": "./syntaxes/nushell.tmLanguage.json"
},
{
"scopeName": "markdown.nushell.codeblock",
"path": "./syntaxes/codeblock.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.nushell": "nushell"
}
}
],
"keybindings": [
Expand Down
45 changes: 45 additions & 0 deletions syntaxes/codeblock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"fileTypes": [],
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#nushell-code-block"
}
],
"repository": {
"nushell-code-block": {
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(nushell)(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"4": {
"name": "fenced_code.block.language.markdown"
},
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
"3": {
"name": "punctuation.definition.markdown"
}
},
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.nushell",
"patterns": [
{
"include": "source.nushell"
}
]
}
]
}
},
"scopeName": "markdown.nushell.codeblock"
}