diff --git a/grammars/textmate/python-markdown/src/python-markdown.tmLanguage.yml b/grammars/textmate/python-markdown/src/python-markdown.tmLanguage.yml index 74bad72..c823bd7 100644 --- a/grammars/textmate/python-markdown/src/python-markdown.tmLanguage.yml +++ b/grammars/textmate/python-markdown/src/python-markdown.tmLanguage.yml @@ -46,23 +46,6 @@ repository: patterns: - include: source.yaml - flow: - patterns: - - include: "#table" - - include: "#admonition" - - include: "#details" - - include: "#tab" - - include: "#footnote_definition" - - include: "#reference_definition" - - include: "#abbreviation" - - include: "#math" - - include: "#fenced_code" - - include: "#heading_atx" - - include: "#thematic_break" - - include: "#block_quote" - - include: "#list_item" - - include: "#paragraph" - snippet: patterns: - name: meta.snippet.section.markdown @@ -189,6 +172,23 @@ repository: captures: 1: { name: punctuation.whitespace.markdown } + flow: + patterns: + - include: "#table" + - include: "#admonition" + - include: "#details" + - include: "#tab" + - include: "#footnote_definition" + - include: "#reference_definition" + - include: "#abbreviation" + - include: "#math" + - include: "#fenced_code" + - include: "#heading_atx" + - include: "#thematic_break" + - include: "#block_quote" + - include: "#list_item" + - include: "#paragraph" + table: patterns: - name: markup.table.markdown diff --git a/integrations/code/src/extension/project.ts b/integrations/code/src/extension/project.ts index 438ac7d..f53e4cc 100644 --- a/integrations/code/src/extension/project.ts +++ b/integrations/code/src/extension/project.ts @@ -35,6 +35,15 @@ import type { ExtensionContext } from "vscode"; */ type Project = "MkDocs" | "Zensical"; +/* ---------------------------------------------------------------------------- + * Data + * ------------------------------------------------------------------------- */ + +/** + * Tagged documents. + */ +const tagged = new Set(); + /* ---------------------------------------------------------------------------- * Functions * ------------------------------------------------------------------------- */ @@ -171,6 +180,9 @@ async function tagDocument( return; } - // Retag the document as Python Markdown - await vscode.languages.setTextDocumentLanguage(document, "python-markdown"); + // Tag the document as Python Markdown + if (!tagged.has(document.uri.toString())) { + tagged.add(document.uri.toString()); + await vscode.languages.setTextDocumentLanguage(document, "python-markdown"); + } } diff --git a/integrations/code/syntaxes/python-markdown.tmLanguage.json b/integrations/code/syntaxes/python-markdown.tmLanguage.json index 4a62335..acfe8f0 100644 --- a/integrations/code/syntaxes/python-markdown.tmLanguage.json +++ b/integrations/code/syntaxes/python-markdown.tmLanguage.json @@ -43,52 +43,6 @@ } ] }, - "flow": { - "patterns": [ - { - "include": "#table" - }, - { - "include": "#admonition" - }, - { - "include": "#details" - }, - { - "include": "#tab" - }, - { - "include": "#footnote_definition" - }, - { - "include": "#reference_definition" - }, - { - "include": "#abbreviation" - }, - { - "include": "#math" - }, - { - "include": "#fenced_code" - }, - { - "include": "#heading_atx" - }, - { - "include": "#thematic_break" - }, - { - "include": "#block_quote" - }, - { - "include": "#list_item" - }, - { - "include": "#paragraph" - } - ] - }, "snippet": { "patterns": [ { @@ -394,6 +348,52 @@ } ] }, + "flow": { + "patterns": [ + { + "include": "#table" + }, + { + "include": "#admonition" + }, + { + "include": "#details" + }, + { + "include": "#tab" + }, + { + "include": "#footnote_definition" + }, + { + "include": "#reference_definition" + }, + { + "include": "#abbreviation" + }, + { + "include": "#math" + }, + { + "include": "#fenced_code" + }, + { + "include": "#heading_atx" + }, + { + "include": "#thematic_break" + }, + { + "include": "#block_quote" + }, + { + "include": "#list_item" + }, + { + "include": "#paragraph" + } + ] + }, "table": { "patterns": [ {