shiki 1.11.2 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ declare const bundledLanguagesBase: {
15
15
  declare const bundledLanguagesAlias: {
16
16
  [k: string]: DynamicImportLanguageRegistration;
17
17
  };
18
- type BundledLanguage = 'angular-html' | 'angular-ts' | 'astro' | 'bash' | 'blade' | 'c' | 'c++' | 'coffee' | 'coffeescript' | 'cpp' | 'css' | 'glsl' | 'gql' | 'graphql' | 'haml' | 'handlebars' | 'hbs' | 'html' | 'html-derivative' | 'http' | 'imba' | 'jade' | 'java' | 'javascript' | 'jinja' | 'jison' | 'jl' | 'js' | 'json' | 'json5' | 'jsonc' | 'jsonl' | 'jsx' | 'julia' | 'less' | 'lua' | 'markdown' | 'marko' | 'md' | 'mdc' | 'mdx' | 'php' | 'postcss' | 'pug' | 'py' | 'python' | 'r' | 'rb' | 'regex' | 'regexp' | 'ruby' | 'sass' | 'scss' | 'sh' | 'shell' | 'shellscript' | 'sql' | 'styl' | 'stylus' | 'svelte' | 'toml' | 'ts' | 'tsx' | 'typescript' | 'vue' | 'vue-html' | 'wasm' | 'wgsl' | 'xml' | 'yaml' | 'yml' | 'zsh';
18
+ type BundledLanguage = 'angular-html' | 'angular-ts' | 'astro' | 'bash' | 'blade' | 'c' | 'c++' | 'coffee' | 'coffeescript' | 'cpp' | 'css' | 'glsl' | 'gql' | 'graphql' | 'haml' | 'handlebars' | 'hbs' | 'html' | 'html-derivative' | 'http' | 'imba' | 'jade' | 'java' | 'javascript' | 'jinja' | 'jison' | 'jl' | 'js' | 'json' | 'json5' | 'jsonc' | 'jsonl' | 'jsx' | 'julia' | 'less' | 'lit' | 'lua' | 'markdown' | 'marko' | 'md' | 'mdc' | 'mdx' | 'php' | 'postcss' | 'pug' | 'py' | 'python' | 'r' | 'rb' | 'regex' | 'regexp' | 'ruby' | 'sass' | 'scss' | 'sh' | 'shell' | 'shellscript' | 'sql' | 'styl' | 'stylus' | 'svelte' | 'toml' | 'ts' | 'ts-tags' | 'tsx' | 'typescript' | 'vue' | 'vue-html' | 'wasm' | 'wgsl' | 'xml' | 'yaml' | 'yml' | 'zsh';
19
19
  declare const bundledLanguages: Record<BundledLanguage, DynamicImportLanguageRegistration>;
20
20
 
21
21
  type Highlighter = HighlighterGeneric<BundledLanguage, BundledTheme>;
@@ -278,6 +278,14 @@ const bundledLanguagesInfo = [
278
278
  "name": "TOML",
279
279
  "import": () => import('./langs/toml.mjs')
280
280
  },
281
+ {
282
+ "id": "ts-tags",
283
+ "name": "TypeScript with Tags",
284
+ "aliases": [
285
+ "lit"
286
+ ],
287
+ "import": () => import('./langs/ts-tags.mjs')
288
+ },
281
289
  {
282
290
  "id": "tsx",
283
291
  "name": "TSX",
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1,6 @@
1
+ const lang = Object.freeze({ "displayName": "dotEnv", "name": "dotenv", "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#line-comment" }] } }, "comment": "Full Line Comment", "match": "^\\s?(#.*$)\\n" }, { "captures": { "1": { "patterns": [{ "include": "#key" }] }, "2": { "name": "keyword.operator.assignment.dotenv" }, "3": { "name": "property.value.dotenv", "patterns": [{ "include": "#line-comment" }, { "include": "#double-quoted-string" }, { "include": "#single-quoted-string" }, { "include": "#interpolation" }] } }, "comment": "ENV entry", "match": "^\\s?(.*?)\\s?(\\=)(.*)$" }], "repository": { "double-quoted-string": { "captures": { "1": { "patterns": [{ "include": "#interpolation" }, { "include": "#escape-characters" }] } }, "comment": "Double Quoted String", "match": '"(.*)"', "name": "string.quoted.double.dotenv" }, "escape-characters": { "comment": "Escape characters", "match": `\\\\[nrtfb"'\\\\]|\\\\u[0123456789ABCDEF]{4}`, "name": "constant.character.escape.dotenv" }, "interpolation": { "captures": { "1": { "name": "keyword.interpolation.begin.dotenv" }, "2": { "name": "variable.interpolation.dotenv" }, "3": { "name": "keyword.interpolation.end.dotenv" } }, "comment": "Interpolation (variable substitution)", "match": "(\\$\\{)(.*)(\\})" }, "key": { "captures": { "1": { "name": "keyword.key.export.dotenv" }, "2": { "name": "variable.key.dotenv", "patterns": [{ "include": "#variable" }] } }, "comment": "Key", "match": "(export\\s)?(.*)" }, "line-comment": { "comment": "Comment", "match": "#.*$", "name": "comment.line.dotenv" }, "single-quoted-string": { "comment": "Single Quoted String", "match": "'(.*)'", "name": "string.quoted.single.dotenv" }, "variable": { "comment": "env variable", "match": "[a-zA-Z_]+[a-zA-Z0-9_]*" } }, "scopeName": "source.dotenv" });
2
+ var dotenv = [
3
+ lang
4
+ ];
5
+
6
+ export { dotenv as default };
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1,13 @@
1
+ import typescript from './typescript.mjs';
2
+ import css from './css.mjs';
3
+ import javascript from './javascript.mjs';
4
+
5
+ const lang = Object.freeze({ "fileTypes": ["js", "jsx", "ts", "tsx", "html", "vue", "svelte", "php", "res"], "injectTo": ["source.ts", "source.js"], "injectionSelector": "L:source.js -comment -string, L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string, L:source.vue -comment -string, L:source.svelte -comment -string, L:source.php -comment -string, L:source.rescript -comment -string", "injections": { "L:source": { "patterns": [{ "match": "<", "name": "invalid.illegal.bad-angle-bracket.html" }] } }, "name": "es-tag-css", "patterns": [{ "begin": "(?i)(\\s?\\/\\*\\s?(css|inline-css)\\s?\\*\\/\\s?)(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.css" }, { "include": "inline.es6-htmlx#template" }] }, { "begin": "(?i)(\\s*(css|inline-css))(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.css" }, { "include": "inline.es6-htmlx#template" }, { "include": "string.quoted.other.template.js" }] }, { "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(css|inline-css)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", "beginCaptures": { "1": { "name": "comment.line" } }, "end": "(`).*", "patterns": [{ "begin": "(\\G)", "end": "(`)" }, { "include": "source.ts#template-substitution-element" }, { "include": "source.css" }] }, { "begin": "(\\${)", "beginCaptures": { "1": { "name": "entity.name.tag" } }, "end": "(})", "endCaptures": { "1": { "name": "entity.name.tag" } }, "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.js" }] }], "scopeName": "inline.es6-css", "embeddedLangs": ["typescript", "css", "javascript"] });
6
+ var es_tag_css = [
7
+ ...typescript,
8
+ ...css,
9
+ ...javascript,
10
+ lang
11
+ ];
12
+
13
+ export { es_tag_css as default };
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1,14 @@
1
+ import typescript from './typescript.mjs';
2
+ import glsl from './glsl.mjs';
3
+ import javascript from './javascript.mjs';
4
+ import './c.mjs';
5
+
6
+ const lang = Object.freeze({ "fileTypes": ["js", "jsx", "ts", "tsx", "html", "vue", "svelte", "php", "res"], "injectTo": ["source.ts", "source.js"], "injectionSelector": "L:source.js -comment -string, L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string", "injections": { "L:source": { "patterns": [{ "match": "<", "name": "invalid.illegal.bad-angle-bracket.html" }] } }, "name": "es-tag-glsl", "patterns": [{ "begin": "(?i)(\\s?\\/\\*\\s?(glsl|inline-glsl)\\s?\\*\\/\\s?)(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.glsl" }, { "include": "inline.es6-htmlx#template" }] }, { "begin": "(?i)(\\s*(glsl|inline-glsl))(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.glsl" }, { "include": "inline.es6-htmlx#template" }, { "include": "string.quoted.other.template.js" }] }, { "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(glsl|inline-glsl)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", "beginCaptures": { "1": { "name": "comment.line" } }, "end": "(`).*", "patterns": [{ "begin": "(\\G)", "end": "(`)" }, { "include": "source.ts#template-substitution-element" }, { "include": "source.glsl" }] }, { "begin": "(\\${)", "beginCaptures": { "1": { "name": "entity.name.tag" } }, "end": "(})", "endCaptures": { "1": { "name": "entity.name.tag" } }, "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.js" }] }], "scopeName": "inline.es6-glsl", "embeddedLangs": ["typescript", "glsl", "javascript"] });
7
+ var es_tag_glsl = [
8
+ ...typescript,
9
+ ...glsl,
10
+ ...javascript,
11
+ lang
12
+ ];
13
+
14
+ export { es_tag_glsl as default };
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1,14 @@
1
+ import typescript from './typescript.mjs';
2
+ import html from './html.mjs';
3
+ import javascript from './javascript.mjs';
4
+ import './css.mjs';
5
+
6
+ const lang = Object.freeze({ "fileTypes": ["js", "jsx", "ts", "tsx", "html", "vue", "svelte", "php", "res"], "injectTo": ["source.ts", "source.js"], "injectionSelector": "L:source.js -comment -string, L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string", "injections": { "L:source": { "patterns": [{ "match": "<", "name": "invalid.illegal.bad-angle-bracket.html" }] } }, "name": "es-tag-html", "patterns": [{ "begin": "(?i)(\\s?\\/\\*\\s?(html|template|inline-html|inline-template)\\s?\\*\\/\\s?)(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "text.html.basic" }, { "include": "inline.es6-htmlx#template" }] }, { "begin": "(?i)(\\s*(html|template|inline-html|inline-template))(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "text.html.basic" }, { "include": "inline.es6-htmlx#template" }, { "include": "string.quoted.other.template.js" }] }, { "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(html|template|inline-html|inline-template)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", "beginCaptures": { "1": { "name": "comment.line" } }, "end": "(`).*", "patterns": [{ "begin": "(\\G)", "end": "(`)" }, { "include": "source.ts#template-substitution-element" }, { "include": "text.html.basic" }] }, { "begin": "(\\${)", "beginCaptures": { "1": { "name": "entity.name.tag" } }, "end": "(})", "endCaptures": { "1": { "name": "entity.name.tag" } }, "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.js" }] }, { "begin": "(\\$\\(`)", "beginCaptures": { "1": { "name": "entity.name.tag" } }, "end": "(`\\))", "endCaptures": { "1": { "name": "entity.name.tag" } }, "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.js" }] }], "scopeName": "inline.es6-html", "embeddedLangs": ["typescript", "html", "javascript"] });
7
+ var es_tag_html = [
8
+ ...typescript,
9
+ ...html,
10
+ ...javascript,
11
+ lang
12
+ ];
13
+
14
+ export { es_tag_html as default };
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1,11 @@
1
+ import typescript from './typescript.mjs';
2
+ import sql from './sql.mjs';
3
+
4
+ const lang = Object.freeze({ "fileTypes": ["js", "jsx", "ts", "tsx", "html", "vue", "svelte", "php", "res"], "injectTo": ["source.ts", "source.js"], "injectionSelector": "L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string", "injections": { "L:source": { "patterns": [{ "match": "<", "name": "invalid.illegal.bad-angle-bracket.html" }] } }, "name": "es-tag-sql", "patterns": [{ "begin": "(?i)\\b(\\w+\\.sql)\\s*(`)", "beginCaptures": { "1": { "name": "variable.parameter" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.ts#string-character-escape" }, { "include": "source.sql" }, { "include": "source.plpgsql.postgres" }, { "match": "." }] }, { "begin": "(?i)(\\s?\\/?\\*?\\s?(sql|inline-sql)\\s?\\*?\\/?\\s?)(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "source.ts#template-substitution-element" }, { "include": "source.ts#string-character-escape" }, { "include": "source.sql" }, { "include": "source.plpgsql.postgres" }, { "match": "." }] }, { "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(sql|inline-sql)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", "beginCaptures": { "1": { "name": "comment.line" } }, "end": "(`)", "patterns": [{ "begin": "(\\G)", "end": "(`)" }, { "include": "source.ts#template-substitution-element" }, { "include": "source.ts#string-character-escape" }, { "include": "source.sql" }, { "include": "source.plpgsql.postgres" }, { "match": "." }] }], "scopeName": "inline.es6-sql", "embeddedLangs": ["typescript", "sql"] });
5
+ var es_tag_sql = [
6
+ ...typescript,
7
+ ...sql,
8
+ lang
9
+ ];
10
+
11
+ export { es_tag_sql as default };
@@ -0,0 +1 @@
1
+ import { LanguageRegistration } from '@shikijs/core';declare const reg: LanguageRegistration[];export default reg
@@ -0,0 +1,10 @@
1
+ import xml from './xml.mjs';
2
+ import './java.mjs';
3
+
4
+ const lang = Object.freeze({ "fileTypes": ["js", "jsx", "ts", "tsx", "html", "vue", "svelte", "php", "res"], "injectTo": ["source.ts", "source.js"], "injectionSelector": "L:source.js -comment -string, L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string", "injections": { "L:source": { "patterns": [{ "match": "<", "name": "invalid.illegal.bad-angle-bracket.html" }] } }, "name": "es-tag-xml", "patterns": [{ "begin": "(?i)(\\s?\\/\\*\\s?(xml|svg|inline-svg|inline-xml)\\s?\\*\\/\\s?)(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "text.xml" }] }, { "begin": "(?i)(\\s*(xml|inline-xml))(`)", "beginCaptures": { "1": { "name": "comment.block" } }, "end": "(`)", "patterns": [{ "include": "text.xml" }] }, { "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(xml|svg|inline-svg|inline-xml)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", "beginCaptures": { "1": { "name": "comment.line" } }, "end": "(`).*", "patterns": [{ "begin": "(\\G)", "end": "(`)" }, { "include": "text.xml" }] }], "scopeName": "inline.es6-xml", "embeddedLangs": ["xml"] });
5
+ var es_tag_xml = [
6
+ ...xml,
7
+ lang
8
+ ];
9
+
10
+ export { es_tag_xml as default };
@@ -1,6 +1,6 @@
1
1
  import markdown from './markdown.mjs';
2
2
 
3
- const lang = Object.freeze({ "displayName": "F#", "name": "fsharp", "patterns": [{ "include": "#compiler_directives" }, { "include": "#comments" }, { "include": "#constants" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#double_tick" }, { "include": "#definition" }, { "include": "#abstract_definition" }, { "include": "#attributes" }, { "include": "#modules" }, { "include": "#anonymous_functions" }, { "include": "#du_declaration" }, { "include": "#record_declaration" }, { "include": "#records" }, { "include": "#strp_inlined" }, { "include": "#keywords" }, { "include": "#cexprs" }, { "include": "#text" }], "repository": { "abstract_definition": { "begin": "\\b(static)?\\s+(abstract)\\s+(member)?(\\s+\\[\\<.*\\>\\])?\\s*([_[:alpha:]0-9,\\._`\\s]+)(<)?", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "keyword.fsharp" }, "4": { "name": "support.function.attribute.fsharp" }, "5": { "name": "keyword.symbol.fsharp" } }, "end": "\\s*(with)\\b|=|$", "endCaptures": { "1": { "name": "keyword.fsharp" } }, "name": "abstract.definition.fsharp", "patterns": [{ "include": "#comments" }, { "include": "#common_declaration" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "entity.name.type.fsharp" } }, "match": "(\\?{0,1})([[:alpha:]0-9'`^._ ]+)\\s*(:)((?!with\\b)\\b([\\w0-9'`^._ ]+)){0,1}" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", "match": "(?!with|get|set\\b)\\s*([\\w0-9'`^._]+)" }, { "include": "#keywords" }] }, "anonymous_functions": { "patterns": [{ "begin": "\\b(fun)\\b", "beginCaptures": { "1": { "name": "keyword.fsharp" } }, "end": "(->)", "endCaptures": { "1": { "name": "keyword.symbol.arrow.fsharp" } }, "name": "function.anonymous", "patterns": [{ "include": "#comments" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "\\s*(?=(->))", "endCaptures": { "1": { "name": "keyword.symbol.arrow.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "include": "#variables" }] }] }, "anonymous_record_declaration": { "begin": "(\\{\\|)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\|\\})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "keyword.symbol.fsharp" } }, "match": "[[:alpha:]0-9'`^_ ]+(:)" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^_ ]+)" }, { "include": "#anonymous_record_declaration" }, { "include": "#keywords" }] }, "attributes": { "patterns": [{ "begin": "\\[\\<", "end": "\\>\\]|\\]", "name": "support.function.attribute.fsharp", "patterns": [{ "include": "$self" }] }] }, "cexprs": { "patterns": [{ "captures": { "0": { "name": "keyword.fsharp" } }, "match": "\\b(async|seq|promise|task|maybe|asyncMaybe|controller|scope|application|pipeline)(?=\\s*\\{)", "name": "cexpr.fsharp" }] }, "chars": { "patterns": [{ "captures": { "1": { "name": "string.quoted.single.fsharp" } }, "match": "('\\\\?.')", "name": "char.fsharp" }] }, "comments": { "patterns": [{ "beginCaptures": { "1": { "name": "comment.block.fsharp" } }, "match": "(\\(\\*{3}.*\\*{3}\\))", "name": "comment.literate.command.fsharp" }, { "begin": "^\\s*(\\(\\*\\*(?!\\)))((?!\\*\\)).)*$", "beginCaptures": { "1": { "name": "comment.block.fsharp" } }, "endCaptures": { "1": { "name": "comment.block.fsharp" } }, "name": "comment.block.markdown.fsharp", "patterns": [{ "include": "text.html.markdown" }], "while": "^(?!\\s*(\\*)+\\)\\s*$)" }, { "begin": "(\\(\\*(?!\\)))", "beginCaptures": { "1": { "name": "comment.block.fsharp" } }, "end": "(\\*+\\))", "endCaptures": { "1": { "name": "comment.block.fsharp" } }, "name": "comment.block.fsharp", "patterns": [{ "comments": "Capture // when inside of (* *) like that the rule which capture comments starting by // is not trigger. See https://github.com/ionide/ionide-fsgrammar/issues/155", "match": "//", "name": "fast-capture.comment.line.double-slash.fsharp" }, { "comments": "Capture (*) when inside of (* *) so that it doesn't prematurely end the comment block.", "match": "\\(\\*\\)", "name": "fast-capture.comment.line.mul-operator.fsharp" }, { "include": "#comments" }] }, { "captures": { "1": { "name": "comment.block.fsharp" } }, "match": "((?<!\\()(\\*)+\\))", "name": "comment.block.markdown.fsharp.end" }, { "begin": "(?<![!%&+-.<=>?@^|/])///(?!/)", "name": "comment.line.markdown.fsharp", "patterns": [{ "include": "text.html.markdown" }], "while": "(?<![!%&+-.<=>?@^|/])///(?!/)" }, { "match": "(?<![!%&+-.<=>?@^|/])//(.*$)", "name": "comment.line.double-slash.fsharp" }] }, "common_binding_definition": { "patterns": [{ "include": "#comments" }, { "include": "#attributes" }, { "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "keyword.fsharp" } }, "comments": "SRTP syntax support", "end": "(\\))\\s*((?=,)|(?=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "include": "#variables" }, { "include": "#keywords" }] }, { "begin": "(:)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" } }, "end": "(\\)\\s*(([?[:alpha:]0-9'`^._ ]*)))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "patterns": [{ "include": "#tuple_signature" }] }, { "begin": "(:)\\s*(\\^[[:alpha:]0-9'._]+)\\s*(when)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" }, "3": { "name": "keyword.fsharp" } }, "end": "(?=:)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "match": "\\b(and|when|or)\\b", "name": "keyword.fsharp" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comment": "Because we first capture the keywords, we can capture what looks like a word and assume it's an entity definition", "match": "([[:alpha:]0-9'^._]+)" }, { "match": "(\\(|\\))", "name": "keyword.symbol.fsharp" }] }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "match": "(:)\\s*([?[:alpha:]0-9'`^._ ]+)" }, { "captures": { "1": { "name": "keyword.symbol.arrow.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "entity.name.type.fsharp" } }, "match": "(->)\\s*(\\()?\\s*([?[:alpha:]0-9'`^._ ]+)*" }, { "begin": "(\\*)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" } }, "end": "(\\)\\s*(([?[:alpha:]0-9'`^._ ]+))+)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "patterns": [{ "include": "#tuple_signature" }] }, { "begin": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "end": "(?==)|(?=\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#tuple_signature" }] }, { "begin": "(<+(?![[:space:]]*\\)))", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "beginComment": "The group (?![[:space:]]*\\) is for protection against overload operator. static member (<)", "end": "((?<!:)>|\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "endComment": "The group (?<!:) prevent us from stopping on :> when using SRTP synthax", "patterns": [{ "include": "#generic_declaration" }] }, { "include": "#anonymous_record_declaration" }, { "begin": "({)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#record_signature" }] }, { "include": "#definition" }, { "include": "#variables" }, { "include": "#keywords" }] }, "common_declaration": { "patterns": [{ "begin": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)(<)", "beginCaptures": { "1": { "name": "keyword.symbol.arrow.fsharp" }, "2": { "name": "entity.name.type.fsharp" }, "3": { "name": "keyword.symbol.fsharp" } }, "end": "(>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^._ ]+)" }, { "include": "#keywords" }] }, { "captures": { "1": { "name": "keyword.symbol.arrow.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "match": "\\s*(->)\\s*(?!with|get|set\\b)\\b([\\w0-9'`^._]+)" }, { "include": "#anonymous_record_declaration" }, { "begin": "(\\?{0,1})([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)(<))", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "keyword.symbol.fsharp" }, "5": { "name": "entity.name.type.fsharp" } }, "end": "(>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^._ ]+)" }, { "include": "#keywords" }] }] }, "compiler_directives": { "patterns": [{ "captures": {}, "match": "\\s?(#if|#elif|#elseif|#else|#endif|#light|#nowarn)", "name": "keyword.control.directive.fsharp" }] }, "constants": { "patterns": [{ "match": "\\(\\)", "name": "keyword.symbol.fsharp" }, { "match": "\\b-?[0-9][0-9_]*((\\.(?!\\.)([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))", "name": "constant.numeric.float.fsharp" }, { "match": "\\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))", "name": "constant.numeric.integer.nativeint.fsharp" }, { "match": "\\b(true|false)\\b", "name": "constant.language.boolean.fsharp" }, { "match": "\\b(null|void)\\b", "name": "constant.other.fsharp" }] }, "definition": { "patterns": [{ "begin": "\\b(let mutable|static let mutable|static let|let inline|let|and|member val|member inline|static member inline|static member|default|member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "support.function.attribute.fsharp" }, "4": { "name": "storage.modifier.fsharp" }, "5": { "name": "variable.fsharp" } }, "end": "\\s*((with\\b)|(=|\\n+=|(?<=\\=)))", "endCaptures": { "2": { "name": "keyword.fsharp" }, "3": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "\\b(use|use!|and|and!)\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "1": { "name": "keyword.fsharp" } }, "end": "\\s*(=)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "(?<=with|and)\\s*\\b((get|set)\\s*(?=\\())(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "4": { "name": "variable.fsharp" } }, "end": "\\s*(=|\\n+=|(?<=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "\\b(static val mutable|val mutable|val inline|val)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "support.function.attribute.fsharp" }, "4": { "name": "storage.modifier.fsharp" }, "5": { "name": "variable.fsharp" } }, "end": "\\n$", "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "\\b(new)\\b\\s+(\\()", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }] }, "double_tick": { "patterns": [{ "captures": { "1": { "name": "string.quoted.single.fsharp" }, "2": { "name": "variable.other.binding.fsharp" }, "3": { "name": "string.quoted.single.fsharp" } }, "match": "(``)([^`]*)(``)", "name": "variable.other.binding.fsharp" }] }, "du_declaration": { "patterns": [{ "begin": "\\b(of)\\b", "beginCaptures": { "1": { "name": "keyword.fsharp" } }, "end": "$|(\\|)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "du_declaration.fsharp", "patterns": [{ "include": "#comments" }, { "captures": { "1": { "name": "variable.parameter.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(``([[:alpha:]0-9'^._ ]+)``|[[:alpha:]0-9'`^._]+)" }, { "include": "#anonymous_record_declaration" }, { "include": "#keywords" }] }] }, "generic_declaration": { "patterns": [{ "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "keyword.fsharp" } }, "comments": "SRTP syntax support", "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)[[:alpha:]0-9'._]+)" }, { "include": "#variables" }, { "include": "#keywords" }] }, { "match": "\\b(private|to|public|internal|function|yield!|yield|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\\!|return\\!|return|interface|with|abstract|enum|member|try|finally|and|when|or|use|use\\!|struct|while|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!')\\b", "name": "keyword.fsharp" }, { "match": ":", "name": "keyword.symbol.fsharp" }, { "include": "#constants" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)[[:alpha:]0-9'._]+)" }, { "begin": "(<)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)[[:alpha:]0-9'._]+)" }, { "include": "#tuple_signature" }, { "include": "#generic_declaration" }] }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(([?[:alpha:]0-9'`^._ ]+))+" }, { "include": "#tuple_signature" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comments": "Here we need the \\w modifier in order to check that the words are allowed", "match": "(?!when|and|or\\b)\\b([\\w0-9'`^._]+)" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" } }, "comments": "Prevent captures of `|>` as a keyword when defining custom operator like `<|>`", "match": "(\\|)" }, { "include": "#keywords" }] }, "keywords": { "patterns": [{ "match": "\\b(private|public|internal)\\b", "name": "storage.modifier" }, { "match": "\\b(private|to|public|internal|function|class|exception|delegate|of|new|as|begin|end|inherit|let!|interface|abstract|enum|member|and|when|or|use|use\\!|struct|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!')\\b", "name": "keyword.fsharp" }, { "match": "\\b(match|yield|yield!|with|if|then|else|elif|for|in|return!|return|try|finally|while|do)(?!')\\b", "name": "keyword.control" }, { "match": "(\\->|\\<\\-)", "name": "keyword.symbol.arrow.fsharp" }, { "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|~\\+|~\\-|<<<|>>>|\\|>|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|&|%|{|}|\\||_|\\.\\.|\\,|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\(|\\)|\\<\\<)", "name": "keyword.symbol.fsharp" }] }, "member_declaration": { "patterns": [{ "include": "#comments" }, { "include": "#common_declaration" }, { "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "keyword.fsharp" } }, "comments": "SRTP syntax support", "end": "(\\))\\s*((?=,)|(?=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "include": "#variables" }, { "include": "#keywords" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "match": "\\b(and|when|or)\\b", "name": "keyword.fsharp" }, { "match": "(\\(|\\))", "name": "keyword.symbol.fsharp" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "entity.name.type.fsharp" } }, "match": "(\\?{0,1})([[:alpha:]0-9'`^._]+|``[[:alpha:]0-9'`^:,._ ]+``)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'`<>._ ]+)){0,1}" }, { "include": "#keywords" }] }, "modules": { "patterns": [{ "begin": "\\b(namespace global)|\\b(namespace|module)\\s*(public|internal|private|rec)?\\s+([[:alpha:]|``][[:alpha:]0-9'_. ]*)", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "storage.modifier.fsharp" }, "4": { "name": "entity.name.section.fsharp" } }, "end": "(\\s?=|\\s|$)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "entity.name.section.fsharp", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.namespace-reference.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "match": "(\\.)([A-Z][[:alpha:]0-9'_]*)", "name": "entity.name.section.fsharp" }] }, { "begin": "\\b(open type|open)\\s+([[:alpha:]|``][[:alpha:]0-9'_]*)(?=(\\.[A-Z][[:alpha:]0-9_]*)*)", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "end": "(\\s|$)", "name": "namespace.open.fsharp", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.namespace-reference.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "match": "(\\.)([[:alpha:]][[:alpha:]0-9'_]*)", "name": "entity.name.section.fsharp" }, { "include": "#comments" }] }, { "begin": "^\\s*(module)\\s+([A-Z][[:alpha:]0-9'_]*)\\s*(=)\\s*([A-Z][[:alpha:]0-9'_]*)", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "entity.name.type.namespace.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "entity.name.section.fsharp" } }, "end": "(\\s|$)", "name": "namespace.alias.fsharp", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.namespace-reference.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "match": "(\\.)([A-Z][[:alpha:]0-9'_]*)", "name": "entity.name.section.fsharp" }] }] }, "record_declaration": { "patterns": [{ "begin": "(\\{)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(?<=\\})", "patterns": [{ "include": "#comments" }, { "begin": "(((mutable)\\s[[:alpha:]]+)|[[:alpha:]0-9'`<>^._]*)\\s*((?<!:):(?!:))\\s*", "beginCaptures": { "3": { "name": "keyword.fsharp" }, "4": { "name": "keyword.symbol.fsharp" } }, "end": "$|(;|\\})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#comments" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^_ ]+)" }, { "include": "#keywords" }] }, { "include": "#compiler_directives" }, { "include": "#constants" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#double_tick" }, { "include": "#definition" }, { "include": "#attributes" }, { "include": "#anonymous_functions" }, { "include": "#keywords" }, { "include": "#cexprs" }, { "include": "#text" }] }] }, "record_signature": { "patterns": [{ "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" } }, "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)" }, { "begin": "({)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" } }, "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)" }, { "include": "#record_signature" }] }, { "include": "#keywords" }] }, "records": { "patterns": [{ "begin": "\\b(type)[\\s]+(private|internal|public)?\\s*", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "storage.modifier.fsharp" } }, "end": "\\s*((with)|((as)\\s+([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", "endCaptures": { "2": { "name": "keyword.fsharp" }, "3": { "name": "keyword.fsharp" }, "4": { "name": "keyword.fsharp" }, "5": { "name": "variable.parameter.fsharp" }, "6": { "name": "keyword.symbol.fsharp" }, "7": { "name": "keyword.symbol.fsharp" } }, "name": "record.fsharp", "patterns": [{ "include": "#comments" }, { "include": "#attributes" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'^._]+|``[[:alpha:]0-9'`^:,._ ]+``)" }, { "begin": "(<)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "((?<!:)>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)``[[:alpha:]0-9`^:,._ ]+``|('|\\^)[[:alpha:]0-9`^:._]+)" }, { "match": "\\b(interface|with|abstract|and|when|or|not|struct|equality|comparison|unmanaged|delegate|enum)\\b", "name": "keyword.fsharp" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "keyword.fsharp" } }, "match": "(static member|member|new)" }, { "include": "#common_binding_definition" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", "match": "([\\w0-9'`^._]+)" }, { "include": "#keywords" }] }, { "captures": { "1": { "name": "storage.modifier.fsharp" } }, "match": "\\s*(private|internal|public)" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "\\s*(?=(=)|[\\n=]|(\\(\\))|(as))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "include": "#keywords" }] }] }, "string_formatter": { "patterns": [{ "captures": { "1": { "name": "keyword.format.specifier.fsharp" } }, "match": "(%0?-?(\\d+)?((a|t)|(\\.\\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o|u)|(s|b|O)|(\\+?A)))", "name": "entity.name.type.format.specifier.fsharp" }] }, "strings": { "patterns": [{ "begin": '(?=[^\\\\])(@")', "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.fsharp" } }, "end": '(")(?!")', "endCaptures": { "1": { "name": "punctuation.definition.string.end.fsharp" } }, "name": "string.quoted.literal.fsharp", "patterns": [{ "match": '"(")', "name": "constant.character.string.escape.fsharp" }] }, { "begin": '(?=[^\\\\])(""")', "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.fsharp" } }, "end": '(""")', "endCaptures": { "1": { "name": "punctuation.definition.string.end.fsharp" } }, "name": "string.quoted.triple.fsharp", "patterns": [{ "include": "#string_formatter" }] }, { "begin": '(?=[^\\\\])(")', "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.fsharp" } }, "end": '(")', "endCaptures": { "1": { "name": "punctuation.definition.string.end.fsharp" } }, "name": "string.quoted.double.fsharp", "patterns": [{ "match": "\\\\$[ \\t]*", "name": "punctuation.separator.string.ignore-eol.fsharp" }, { "match": `\\\\(['"\\\\abfnrtv]|([01][0-9][0-9]|2[0-4][0-9]|25[0-5])|(x[0-9a-fA-F]{2})|(u[0-9a-fA-F]{4})|(U00(0[0-9a-fA-F]|10)[0-9a-fA-F]{4}))`, "name": "constant.character.string.escape.fsharp" }, { "match": "\\\\(([0-9]{1,3})|(x[^\\s]{0,2})|(u[^\\s]{0,4})|(U[^\\s]{0,8})|[^\\s])", "name": "invalid.illegal.character.string.fsharp" }, { "include": "#string_formatter" }] }] }, "strp_inlined": { "patterns": [{ "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#strp_inlined_body" }] }] }, "strp_inlined_body": { "patterns": [{ "include": "#comments" }, { "include": "#anonymous_functions" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "match": "\\b(and|when|or)\\b", "name": "keyword.fsharp" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#strp_inlined_body" }] }, { "captures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "variable.fsharp" }, "3": { "name": "keyword.symbol.fsharp" } }, "match": "(static member|member)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)" }, { "include": "#compiler_directives" }, { "include": "#constants" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#double_tick" }, { "include": "#keywords" }, { "include": "#text" }, { "include": "#definition" }, { "include": "#attributes" }, { "include": "#keywords" }, { "include": "#cexprs" }, { "include": "#text" }] }, "text": { "patterns": [{ "match": "\\\\", "name": "text.fsharp" }] }, "tuple_signature": { "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(([?[:alpha:]0-9'`^._ ]+))+" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(([?[:alpha:]0-9'`^._ ]+))+" }, { "include": "#tuple_signature" }] }, { "include": "#keywords" }] }, "variables": { "patterns": [{ "match": "\\(\\)", "name": "keyword.symbol.fsharp" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" } }, "match": "(\\?{0,1})(``[[:alpha:]0-9'`^:,._ ]+``|(?!private|struct\\b)\\b[\\w[:alpha:]0-9'`<>^._ ]+)" }] } }, "scopeName": "source.fsharp", "embeddedLangs": ["markdown"], "aliases": ["f#", "fs"] });
3
+ const lang = Object.freeze({ "displayName": "F#", "name": "fsharp", "patterns": [{ "include": "#compiler_directives" }, { "include": "#comments" }, { "include": "#constants" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#double_tick" }, { "include": "#definition" }, { "include": "#abstract_definition" }, { "include": "#attributes" }, { "include": "#modules" }, { "include": "#anonymous_functions" }, { "include": "#du_declaration" }, { "include": "#record_declaration" }, { "include": "#records" }, { "include": "#strp_inlined" }, { "include": "#keywords" }, { "include": "#cexprs" }, { "include": "#text" }], "repository": { "abstract_definition": { "begin": "\\b(static)?\\s+(abstract)\\s+(member)?(\\s+\\[\\<.*\\>\\])?\\s*([_[:alpha:]0-9,\\._`\\s]+)(<)?", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "keyword.fsharp" }, "4": { "name": "support.function.attribute.fsharp" }, "5": { "name": "keyword.symbol.fsharp" } }, "end": "\\s*(with)\\b|=|$", "endCaptures": { "1": { "name": "keyword.fsharp" } }, "name": "abstract.definition.fsharp", "patterns": [{ "include": "#comments" }, { "include": "#common_declaration" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "entity.name.type.fsharp" } }, "match": "(\\?{0,1})([[:alpha:]0-9'`^._ ]+)\\s*(:)((?!with\\b)\\b([\\w0-9'`^._ ]+)){0,1}" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", "match": "(?!with|get|set\\b)\\s*([\\w0-9'`^._]+)" }, { "include": "#keywords" }] }, "anonymous_functions": { "patterns": [{ "begin": "\\b(fun)\\b", "beginCaptures": { "1": { "name": "keyword.fsharp" } }, "end": "(->)", "endCaptures": { "1": { "name": "keyword.symbol.arrow.fsharp" } }, "name": "function.anonymous", "patterns": [{ "include": "#comments" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "\\s*(?=(->))", "endCaptures": { "1": { "name": "keyword.symbol.arrow.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "include": "#variables" }] }] }, "anonymous_record_declaration": { "begin": "(\\{\\|)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\|\\})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "keyword.symbol.fsharp" } }, "match": "[[:alpha:]0-9'`^_ ]+(:)" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^_ ]+)" }, { "include": "#anonymous_record_declaration" }, { "include": "#keywords" }] }, "attributes": { "patterns": [{ "begin": "\\[\\<", "end": "\\>\\]|\\]", "name": "support.function.attribute.fsharp", "patterns": [{ "include": "$self" }] }] }, "cexprs": { "patterns": [{ "captures": { "0": { "name": "keyword.fsharp" } }, "match": "\\b(async|seq|promise|task|maybe|asyncMaybe|controller|scope|application|pipeline)(?=\\s*\\{)", "name": "cexpr.fsharp" }] }, "chars": { "patterns": [{ "captures": { "1": { "name": "string.quoted.single.fsharp" } }, "match": "('\\\\?.')", "name": "char.fsharp" }] }, "comments": { "patterns": [{ "beginCaptures": { "1": { "name": "comment.block.fsharp" } }, "match": "(\\(\\*{3}.*\\*{3}\\))", "name": "comment.literate.command.fsharp" }, { "begin": "^\\s*(\\(\\*\\*(?!\\)))((?!\\*\\)).)*$", "beginCaptures": { "1": { "name": "comment.block.fsharp" } }, "endCaptures": { "1": { "name": "comment.block.fsharp" } }, "name": "comment.block.markdown.fsharp", "patterns": [{ "include": "text.html.markdown" }], "while": "^(?!\\s*(\\*)+\\)\\s*$)" }, { "begin": "(\\(\\*(?!\\)))", "beginCaptures": { "1": { "name": "comment.block.fsharp" } }, "end": "(\\*+\\))", "endCaptures": { "1": { "name": "comment.block.fsharp" } }, "name": "comment.block.fsharp", "patterns": [{ "comments": "Capture // when inside of (* *) like that the rule which capture comments starting by // is not trigger. See https://github.com/ionide/ionide-fsgrammar/issues/155", "match": "//", "name": "fast-capture.comment.line.double-slash.fsharp" }, { "comments": "Capture (*) when inside of (* *) so that it doesn't prematurely end the comment block.", "match": "\\(\\*\\)", "name": "fast-capture.comment.line.mul-operator.fsharp" }, { "include": "#comments" }] }, { "captures": { "1": { "name": "comment.block.fsharp" } }, "match": "((?<!\\()(\\*)+\\))", "name": "comment.block.markdown.fsharp.end" }, { "begin": "(?<![!%&+-.<=>?@^|/])///(?!/)", "name": "comment.line.markdown.fsharp", "patterns": [{ "include": "text.html.markdown" }], "while": "(?<![!%&+-.<=>?@^|/])///(?!/)" }, { "match": "(?<![!%&+-.<=>?@^|/])//(.*$)", "name": "comment.line.double-slash.fsharp" }] }, "common_binding_definition": { "patterns": [{ "include": "#comments" }, { "include": "#attributes" }, { "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "keyword.fsharp" } }, "comments": "SRTP syntax support", "end": "(\\))\\s*((?=,)|(?=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "include": "#variables" }, { "include": "#keywords" }] }, { "begin": "(:)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" } }, "end": "(\\)\\s*(([?[:alpha:]0-9'`^._ ]*)))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "patterns": [{ "include": "#tuple_signature" }] }, { "begin": "(:)\\s*(\\^[[:alpha:]0-9'._]+)\\s*(when)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" }, "3": { "name": "keyword.fsharp" } }, "end": "(?=:)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "match": "\\b(and|when|or)\\b", "name": "keyword.fsharp" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comment": "Because we first capture the keywords, we can capture what looks like a word and assume it's an entity definition", "match": "([[:alpha:]0-9'^._]+)" }, { "match": "(\\(|\\))", "name": "keyword.symbol.fsharp" }] }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "match": "(:)\\s*([?[:alpha:]0-9'`^._ ]+)" }, { "captures": { "1": { "name": "keyword.symbol.arrow.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "entity.name.type.fsharp" } }, "match": "(->)\\s*(\\()?\\s*([?[:alpha:]0-9'`^._ ]+)*" }, { "begin": "(\\*)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" } }, "end": "(\\)\\s*(([?[:alpha:]0-9'`^._ ]+))*)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "patterns": [{ "include": "#tuple_signature" }] }, { "begin": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "end": "(?==)|(?=\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#tuple_signature" }] }, { "begin": "(<+(?![[:space:]]*\\)))", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "beginComment": "The group (?![[:space:]]*\\) is for protection against overload operator. static member (<)", "end": "((?<!:)>|\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "endComment": "The group (?<!:) prevent us from stopping on :> when using SRTP synthax", "patterns": [{ "include": "#generic_declaration" }] }, { "include": "#anonymous_record_declaration" }, { "begin": "({)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#record_signature" }] }, { "include": "#definition" }, { "include": "#variables" }, { "include": "#keywords" }] }, "common_declaration": { "patterns": [{ "begin": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)(<)", "beginCaptures": { "1": { "name": "keyword.symbol.arrow.fsharp" }, "2": { "name": "entity.name.type.fsharp" }, "3": { "name": "keyword.symbol.fsharp" } }, "end": "(>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^._ ]+)" }, { "include": "#keywords" }] }, { "captures": { "1": { "name": "keyword.symbol.arrow.fsharp" }, "2": { "name": "entity.name.type.fsharp" } }, "match": "\\s*(->)\\s*(?!with|get|set\\b)\\b([\\w0-9'`^._]+)" }, { "include": "#anonymous_record_declaration" }, { "begin": "(\\?{0,1})([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)(<))", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "keyword.symbol.fsharp" }, "5": { "name": "entity.name.type.fsharp" } }, "end": "(>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^._ ]+)" }, { "include": "#keywords" }] }] }, "compiler_directives": { "patterns": [{ "captures": {}, "match": "\\s?(#if|#elif|#elseif|#else|#endif|#light|#nowarn)", "name": "keyword.control.directive.fsharp" }] }, "constants": { "patterns": [{ "match": "\\(\\)", "name": "keyword.symbol.fsharp" }, { "match": "\\b-?[0-9][0-9_]*((\\.(?!\\.)([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))", "name": "constant.numeric.float.fsharp" }, { "match": "\\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))", "name": "constant.numeric.integer.nativeint.fsharp" }, { "match": "\\b(true|false)\\b", "name": "constant.language.boolean.fsharp" }, { "match": "\\b(null|void)\\b", "name": "constant.other.fsharp" }] }, "definition": { "patterns": [{ "begin": "\\b(let mutable|static let mutable|static let|let inline|let|and|member val|member inline|static member inline|static member|default|member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "support.function.attribute.fsharp" }, "4": { "name": "storage.modifier.fsharp" }, "5": { "name": "variable.fsharp" } }, "end": "\\s*((with\\b)|(=|\\n+=|(?<=\\=)))", "endCaptures": { "2": { "name": "keyword.fsharp" }, "3": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "\\b(use|use!|and|and!)\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "1": { "name": "keyword.fsharp" } }, "end": "\\s*(=)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "(?<=with|and)\\s*\\b((get|set)\\s*(?=\\())(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "4": { "name": "variable.fsharp" } }, "end": "\\s*(=|\\n+=|(?<=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "\\b(static val mutable|val mutable|val inline|val)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "support.function.attribute.fsharp" }, "4": { "name": "storage.modifier.fsharp" }, "5": { "name": "variable.fsharp" } }, "end": "\\n$", "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }, { "begin": "\\b(new)\\b\\s+(\\()", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "binding.fsharp", "patterns": [{ "include": "#common_binding_definition" }] }] }, "double_tick": { "patterns": [{ "captures": { "1": { "name": "string.quoted.single.fsharp" }, "2": { "name": "variable.other.binding.fsharp" }, "3": { "name": "string.quoted.single.fsharp" } }, "match": "(``)([^`]*)(``)", "name": "variable.other.binding.fsharp" }] }, "du_declaration": { "patterns": [{ "begin": "\\b(of)\\b", "beginCaptures": { "1": { "name": "keyword.fsharp" } }, "end": "$|(\\|)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "du_declaration.fsharp", "patterns": [{ "include": "#comments" }, { "captures": { "1": { "name": "variable.parameter.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(``([[:alpha:]0-9'^._ ]+)``|[[:alpha:]0-9'`^._]+)" }, { "include": "#anonymous_record_declaration" }, { "include": "#keywords" }] }] }, "generic_declaration": { "patterns": [{ "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "keyword.fsharp" } }, "comments": "SRTP syntax support", "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)[[:alpha:]0-9'._]+)" }, { "include": "#variables" }, { "include": "#keywords" }] }, { "match": "\\b(private|to|public|internal|function|yield!|yield|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\\!|return\\!|return|interface|with|abstract|enum|member|try|finally|and|when|or|use|use\\!|struct|while|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!')\\b", "name": "keyword.fsharp" }, { "match": ":", "name": "keyword.symbol.fsharp" }, { "include": "#constants" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)[[:alpha:]0-9'._]+)" }, { "begin": "(<)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)[[:alpha:]0-9'._]+)" }, { "include": "#tuple_signature" }, { "include": "#generic_declaration" }] }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(([?[:alpha:]0-9'`^._ ]+))+" }, { "include": "#tuple_signature" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comments": "Here we need the \\w modifier in order to check that the words are allowed", "match": "(?!when|and|or\\b)\\b([\\w0-9'`^._]+)" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" } }, "comments": "Prevent captures of `|>` as a keyword when defining custom operator like `<|>`", "match": "(\\|)" }, { "include": "#keywords" }] }, "keywords": { "patterns": [{ "match": "\\b(private|public|internal)\\b", "name": "storage.modifier" }, { "match": "\\b(private|to|public|internal|function|class|exception|delegate|of|new|as|begin|end|inherit|let!|interface|abstract|enum|member|and|when|or|use|use\\!|struct|mutable|assert|base|done|downcast|downto|extern|fixed|global|lazy|upcast|not)(?!')\\b", "name": "keyword.fsharp" }, { "match": "\\b(match|yield|yield!|with|if|then|else|elif|for|in|return!|return|try|finally|while|do)(?!')\\b", "name": "keyword.control" }, { "match": "(\\->|\\<\\-)", "name": "keyword.symbol.arrow.fsharp" }, { "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|~\\+|~\\-|<<<|>>>|\\|>|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|&|%|{|}|\\||_|\\.\\.|\\,|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\(|\\)|\\<\\<)", "name": "keyword.symbol.fsharp" }] }, "member_declaration": { "patterns": [{ "include": "#comments" }, { "include": "#common_declaration" }, { "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "keyword.symbol.fsharp" }, "3": { "name": "keyword.fsharp" } }, "comments": "SRTP syntax support", "end": "(\\))\\s*((?=,)|(?=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "include": "#variables" }, { "include": "#keywords" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "match": "\\b(and|when|or)\\b", "name": "keyword.fsharp" }, { "match": "(\\(|\\))", "name": "keyword.symbol.fsharp" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "entity.name.type.fsharp" } }, "match": "(\\?{0,1})([[:alpha:]0-9'`^._]+|``[[:alpha:]0-9'`^:,._ ]+``)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'`<>._ ]+)){0,1}" }, { "include": "#keywords" }] }, "modules": { "patterns": [{ "begin": "\\b(namespace global)|\\b(namespace|module)\\s*(public|internal|private|rec)?\\s+([[:alpha:]|``][[:alpha:]0-9'_. ]*)", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" }, "3": { "name": "storage.modifier.fsharp" }, "4": { "name": "entity.name.section.fsharp" } }, "end": "(\\s?=|\\s|$)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "name": "entity.name.section.fsharp", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.namespace-reference.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "match": "(\\.)([A-Z][[:alpha:]0-9'_]*)", "name": "entity.name.section.fsharp" }] }, { "begin": "\\b(open type|open)\\s+([[:alpha:]|``][[:alpha:]0-9'_]*)(?=(\\.[A-Z][[:alpha:]0-9_]*)*)", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "end": "(\\s|$)", "name": "namespace.open.fsharp", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.namespace-reference.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "match": "(\\.)([[:alpha:]][[:alpha:]0-9'_]*)", "name": "entity.name.section.fsharp" }, { "include": "#comments" }] }, { "begin": "^\\s*(module)\\s+([A-Z][[:alpha:]0-9'_]*)\\s*(=)\\s*([A-Z][[:alpha:]0-9'_]*)", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "entity.name.type.namespace.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { "name": "entity.name.section.fsharp" } }, "end": "(\\s|$)", "name": "namespace.alias.fsharp", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.namespace-reference.fsharp" }, "2": { "name": "entity.name.section.fsharp" } }, "match": "(\\.)([A-Z][[:alpha:]0-9'_]*)", "name": "entity.name.section.fsharp" }] }] }, "record_declaration": { "patterns": [{ "begin": "(\\{)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(?<=\\})", "patterns": [{ "include": "#comments" }, { "begin": "(((mutable)\\s[[:alpha:]]+)|[[:alpha:]0-9'`<>^._]*)\\s*((?<!:):(?!:))\\s*", "beginCaptures": { "3": { "name": "keyword.fsharp" }, "4": { "name": "keyword.symbol.fsharp" } }, "end": "$|(;|\\})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#comments" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'`^_ ]+)" }, { "include": "#keywords" }] }, { "include": "#compiler_directives" }, { "include": "#constants" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#double_tick" }, { "include": "#definition" }, { "include": "#attributes" }, { "include": "#anonymous_functions" }, { "include": "#keywords" }, { "include": "#cexprs" }, { "include": "#text" }] }] }, "record_signature": { "patterns": [{ "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" } }, "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)" }, { "begin": "({)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(})", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" } }, "match": "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)" }, { "include": "#record_signature" }] }, { "include": "#keywords" }] }, "records": { "patterns": [{ "begin": "\\b(type)[\\s]+(private|internal|public)?\\s*", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "storage.modifier.fsharp" } }, "end": "\\s*((with)|((as)\\s+([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", "endCaptures": { "2": { "name": "keyword.fsharp" }, "3": { "name": "keyword.fsharp" }, "4": { "name": "keyword.fsharp" }, "5": { "name": "variable.parameter.fsharp" }, "6": { "name": "keyword.symbol.fsharp" }, "7": { "name": "keyword.symbol.fsharp" } }, "name": "record.fsharp", "patterns": [{ "include": "#comments" }, { "include": "#attributes" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "([[:alpha:]0-9'^._]+|``[[:alpha:]0-9'`^:,._ ]+``)" }, { "begin": "(<)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "((?<!:)>)", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(('|\\^)``[[:alpha:]0-9`^:,._ ]+``|('|\\^)[[:alpha:]0-9`^:._]+)" }, { "match": "\\b(interface|with|abstract|and|when|or|not|struct|equality|comparison|unmanaged|delegate|enum)\\b", "name": "keyword.fsharp" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "keyword.fsharp" } }, "match": "(static member|member|new)" }, { "include": "#common_binding_definition" }] }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", "match": "([\\w0-9'`^._]+)" }, { "include": "#keywords" }] }, { "captures": { "1": { "name": "storage.modifier.fsharp" } }, "match": "\\s*(private|internal|public)" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "\\s*(?=(=)|[\\n=]|(\\(\\))|(as))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#member_declaration" }] }, { "include": "#keywords" }] }] }, "string_formatter": { "patterns": [{ "captures": { "1": { "name": "keyword.format.specifier.fsharp" } }, "match": "(%0?-?(\\d+)?((a|t)|(\\.\\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o|u)|(s|b|O)|(\\+?A)))", "name": "entity.name.type.format.specifier.fsharp" }] }, "strings": { "patterns": [{ "begin": '(?=[^\\\\])(@")', "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.fsharp" } }, "end": '(")(?!")', "endCaptures": { "1": { "name": "punctuation.definition.string.end.fsharp" } }, "name": "string.quoted.literal.fsharp", "patterns": [{ "match": '"(")', "name": "constant.character.string.escape.fsharp" }] }, { "begin": '(?=[^\\\\])(""")', "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.fsharp" } }, "end": '(""")', "endCaptures": { "1": { "name": "punctuation.definition.string.end.fsharp" } }, "name": "string.quoted.triple.fsharp", "patterns": [{ "include": "#string_formatter" }] }, { "begin": '(?=[^\\\\])(")', "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.fsharp" } }, "end": '(")', "endCaptures": { "1": { "name": "punctuation.definition.string.end.fsharp" } }, "name": "string.quoted.double.fsharp", "patterns": [{ "match": "\\\\$[ \\t]*", "name": "punctuation.separator.string.ignore-eol.fsharp" }, { "match": `\\\\(['"\\\\abfnrtv]|([01][0-9][0-9]|2[0-4][0-9]|25[0-5])|(x[0-9a-fA-F]{2})|(u[0-9a-fA-F]{4})|(U00(0[0-9a-fA-F]|10)[0-9a-fA-F]{4}))`, "name": "constant.character.string.escape.fsharp" }, { "match": "\\\\(([0-9]{1,3})|(x[^\\s]{0,2})|(u[^\\s]{0,4})|(U[^\\s]{0,8})|[^\\s])", "name": "invalid.illegal.character.string.fsharp" }, { "include": "#string_formatter" }] }] }, "strp_inlined": { "patterns": [{ "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#strp_inlined_body" }] }] }, "strp_inlined_body": { "patterns": [{ "include": "#comments" }, { "include": "#anonymous_functions" }, { "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(\\^[[:alpha:]0-9'._]+)" }, { "match": "\\b(and|when|or)\\b", "name": "keyword.fsharp" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "include": "#strp_inlined_body" }] }, { "captures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "variable.fsharp" }, "3": { "name": "keyword.symbol.fsharp" } }, "match": "(static member|member)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)" }, { "include": "#compiler_directives" }, { "include": "#constants" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#double_tick" }, { "include": "#keywords" }, { "include": "#text" }, { "include": "#definition" }, { "include": "#attributes" }, { "include": "#keywords" }, { "include": "#cexprs" }, { "include": "#text" }] }, "text": { "patterns": [{ "match": "\\\\", "name": "text.fsharp" }] }, "tuple_signature": { "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(([?[:alpha:]0-9'`^._ ]+))+" }, { "begin": "(\\()", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" } }, "patterns": [{ "captures": { "1": { "name": "entity.name.type.fsharp" } }, "match": "(([?[:alpha:]0-9'`^._ ]+))+" }, { "include": "#tuple_signature" }] }, { "include": "#keywords" }] }, "variables": { "patterns": [{ "match": "\\(\\)", "name": "keyword.symbol.fsharp" }, { "captures": { "1": { "name": "keyword.symbol.fsharp" }, "2": { "name": "variable.parameter.fsharp" } }, "match": "(\\?{0,1})(``[[:alpha:]0-9'`^:,._ ]+``|(?!private|struct\\b)\\b[\\w[:alpha:]0-9'`<>^._ ]+)" }] } }, "scopeName": "source.fsharp", "embeddedLangs": ["markdown"], "aliases": ["f#", "fs"] });
4
4
  var fsharp = [
5
5
  ...markdown,
6
6
  lang