Skip to content

Commit

Permalink
Merge remote-tracking branch 'dunhamsteve/markdown-code-blocks'
Browse files Browse the repository at this point in the history
  • Loading branch information
srghma committed Oct 25, 2024
2 parents f481a80 + 7b35bf5 commit cc9be42
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"activationEvents": [
"onLanguage:idris",
"onLanguage:lidr"
"onLanguage:lidr",
"workspaceContains:*.ipkg"
],
"main": "./out/main.js",
"contributes": {
Expand Down Expand Up @@ -173,6 +174,14 @@
"language": "lidr",
"scopeName": "source.idris.literate",
"path": "./syntaxes/lidr.tmLanguage.json"
},
{
"path": "./syntaxes/inject.json",
"scopeName": "idris.injection",
"injectTo": ["text.html.markdown"],
"embeddedLanguages": {
"meta.embedded.block.idris": "idris"
}
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function activate(context: ExtensionContext) {
detached: true // let us handle the disposal of the server
});
});
let initializationOptions = {
const initializationOptions = {
logSeverity: extensionConfig.get("logSeverity") || "debug",
logFile: extensionConfig.get("logFile") || "stderr",
longActionTimeout: extensionConfig.get("longActionTimeout") || 5000,
Expand All @@ -66,6 +66,7 @@ export function activate(context: ExtensionContext) {
const clientOptions: LanguageClientOptions = {
documentSelector: [
{ scheme: 'file', language: 'idris' },
{ scheme: 'file', language: 'markdown', pattern: '**/*.{lidr,idr}.md' },
{ scheme: 'file', language: 'lidr' }
],
initializationOptions: initializationOptions,
Expand Down
44 changes: 44 additions & 0 deletions syntaxes/inject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"scopeName": "idris.injection",
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#fenced_code_block_idris"
}
],
"repository": {
"fenced_code_block_idris": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(idris|idris2)((\\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.idris",
"patterns": [
{
"include": "source.idris"
}
]
}
]
}
}
}

0 comments on commit cc9be42

Please sign in to comment.