From fd8d4b09e1b1bc2774d990a03e516abed1a2c69a Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 23 Oct 2018 16:13:27 +0200 Subject: [PATCH] Update grammars --- build/npm/update-all-grammars.js | 2 +- build/npm/update-grammar.js | 2 +- .../fsharp/syntaxes/fsharp.tmLanguage.json | 805 ++++++++++++++---- .../fsharp/test/colorize-results/test_fs.json | 13 +- .../syntaxes/JavaScript.tmLanguage.json | 4 +- .../syntaxes/JavaScriptReact.tmLanguage.json | 4 +- extensions/log/syntaxes/log.tmLanguage.json | 6 +- .../test/colorize-results/test_md.json | 2 +- .../syntaxes/MagicPython.tmLanguage.json | 149 ++-- .../test-freeze-56377_py.json | 2 +- .../python/test/colorize-results/test_py.json | 4 +- .../syntaxes/TypeScript.tmLanguage.json | 4 +- .../syntaxes/TypeScriptReact.tmLanguage.json | 4 +- scripts/test-integration.bat | 8 +- 14 files changed, 750 insertions(+), 259 deletions(-) diff --git a/build/npm/update-all-grammars.js b/build/npm/update-all-grammars.js index 3ff7254c3e2..9ca9f85616c 100644 --- a/build/npm/update-all-grammars.js +++ b/build/npm/update-all-grammars.js @@ -39,7 +39,7 @@ extensions.forEach(extension => updateGrammar(`extensions/${extension}`)); // run integration tests if (process.platform === 'win32') { - cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' }); + cp.spawn('.\\scripts\\test-integration.bat', [], { env: process.env, stdio: 'inherit' }); } else { cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' }); } diff --git a/build/npm/update-grammar.js b/build/npm/update-grammar.js index 2ccd808e152..c009e36285c 100644 --- a/build/npm/update-grammar.js +++ b/build/npm/update-grammar.js @@ -119,7 +119,7 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas } try { - fs.writeFileSync(dest, JSON.stringify(result, null, '\t')); + fs.writeFileSync(dest, JSON.stringify(result, null, '\t').replace(/\n/g, '\r\n')); if (info) { console.log('Updated ' + path.basename(dest) + ' to ' + repoId + '@' + info.commitSha.substr(0, 7) + ' (' + info.commitDate.substr(0, 10) + ')'); } else { diff --git a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json b/extensions/fsharp/syntaxes/fsharp.tmLanguage.json index 6b2b4265e54..32bcaa2864b 100644 --- a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json +++ b/extensions/fsharp/syntaxes/fsharp.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/ionide/ionide-fsgrammar/commit/eb210da2bfea65a7dff46d22c97a0e9e410a9469", + "version": "https://github.com/ionide/ionide-fsgrammar/commit/a20d836fa67d6daf81fd63e8baa97aa5e1516006", "name": "fsharp", "scopeName": "source.fsharp", "patterns": [ @@ -48,10 +48,13 @@ "include": "#record_declaration" }, { - "include": "#keywords" + "include": "#records" }, { - "include": "#records" + "include": "#strp_inlined" + }, + { + "include": "#keywords" }, { "include": "#cexprs" @@ -61,10 +64,173 @@ } ], "repository": { + "strp_inlined_body": { + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#anonymous_functions" + }, + { + "match": "(\\^[[:alpha:]0-9'._]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "name": "keyword.fsharp", + "match": "\\b(and|when|or)\\b" + }, + { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#strp_inlined_body" + } + ] + }, + { + "match": "(static member|member)\\s*([[:alpha:]0-9'`<>^._]+|``[[:alpha:]0-9' <>^._]+``)\\s*(:)", + "captures": { + "1": { + "name": "keyword.fsharp" + }, + "2": { + "name": "variable.fsharp" + }, + "3": { + "name": "keyword.symbol.fsharp" + } + } + }, + { + "include": "#constants" + }, + { + "include": "#strings" + }, + { + "include": "#chars" + }, + { + "include": "#double_tick" + }, + { + "include": "#keywords" + }, + { + "include": "#text" + } + ] + }, + "strp_inlined": { + "patterns": [ + { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#strp_inlined_body" + } + ] + } + ] + }, "generic_declaration": { "patterns": [ { - "match": "([^<>,*()-])", + "comments": "SRTP syntax support", + "begin": "(:)\\s*(\\()\\s*(static member|member)", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "keyword.fsharp" + } + }, + "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" + } + ] + }, + { + "match": "(('|\\^)[[:alpha:]0-9'._]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#variables" + }, + { + "include": "#keywords" + } + ] + }, + { + "name": "keyword.fsharp", + "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|property|union|enum|member|try|finally|and|when|use|use\\!|struct|while|mutable)(?!')\\b" + }, + { + "name": "keyword.fsharp", + "match": ":" + }, + { + "include": "#constants" + }, + { + "match": "(('|\\^)[[:alpha:]0-9'._]+)", "captures": { "1": { "name": "entity.name.type.fsharp" @@ -86,7 +252,7 @@ }, "patterns": [ { - "match": "([^<>,*()-])", + "match": "(('|\\^)[[:alpha:]0-9'._]+)", "captures": { "1": { "name": "entity.name.type.fsharp" @@ -101,6 +267,15 @@ } ] }, + { + "match": "(?!when|and|or\\b)\\b([\\w0-9'`^._]+)", + "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, { "include": "#keywords" } @@ -217,18 +392,23 @@ "include": "#comments" }, { - "include": "#member_declaration" - }, - { - "match": "(:)(\\s*([?[:alpha:]0-9'`<>^._ ]+))*", - "captures": { + "begin": "(\\()", + "end": "\\s*(?=(->))", + "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" - }, - "2": { - "name": "entity.name.type.fsharp" } - } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#member_declaration" + } + ] }, { "include": "#variables" @@ -364,15 +544,18 @@ "include": "#common_declaration" }, { - "match": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)){0,1}", + "match": "(\\?{0,1})([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([[:alpha:]0-9'`^._ ]+)){0,1}", "captures": { "1": { - "name": "variable.parameter.fsharp" - }, - "2": { "name": "keyword.symbol.fsharp" }, + "2": { + "name": "variable.parameter.fsharp" + }, "3": { + "name": "keyword.symbol.fsharp" + }, + "4": { "name": "entity.name.type.fsharp" } } @@ -391,11 +574,232 @@ } ] }, + "common_binding_definition": { + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#attributes" + }, + { + "comments": "SRTP syntax support", + "begin": "(:)\\s*(\\()\\s*(static member|member)", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "keyword.fsharp" + } + }, + "end": "(\\))\\s*((?=,)|(?=\\=))", + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "match": "(\\^[[:alpha:]0-9'._]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "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": [ + { + "name": "keyword.fsharp", + "match": "\\b(and|when|or)\\b" + }, + { + "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'^._]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "name": "keyword.symbol.fsharp", + "match": "(\\(|\\))" + } + ] + }, + { + "match": "(:)\\s*([?[:alpha:]0-9'`^._ ]+)", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "match": "(->)\\s*(\\()?\\s*([?[:alpha:]0-9'`^._ ]+)*", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "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" + } + ] + }, + { + "match": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "begin": "(<(?![[:space:]]*\\)))", + "beginComment": "The group (?![[:space:]]*\\) is for protection against overload operator. static member (<)", + "end": "((?)", + "endComment": "The group (? when using SRTP synthax", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#generic_declaration" + } + ] + }, + { + "begin": "({)", + "end": "(})", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#record_signature" + } + ] + }, + { + "include": "#definition" + }, + { + "include": "#variables" + }, + { + "include": "#keywords" + } + ] + }, "definition": { "patterns": [ { "name": "binding.fsharp", - "begin": "\\b(val mutable|val|let mutable|let inline|let|member val|member|static member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?", + "begin": "\\b(let mutable|let inline|let|member val|static member inline|static member|member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?", "end": "\\s*(with\\b|=|\\n+=|(?<=\\=))", "beginCaptures": { "1": { @@ -421,140 +825,34 @@ }, "patterns": [ { - "include": "#comments" + "include": "#common_binding_definition" + } + ] + }, + { + "name": "binding.fsharp", + "begin": "\\b(static val mutable|val mutable|val)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?", + "end": "\\n$", + "beginCaptures": { + "1": { + "name": "keyword.fsharp" }, - { - "include": "#attributes" + "2": { + "name": "keyword.fsharp" }, - { - "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" - } - ] + "3": { + "name": "support.function.attribute.fsharp" }, - { - "match": "(:)\\s*([?[:alpha:]0-9'`^._ ]+)*", - "captures": { - "1": { - "name": "keyword.symbol.fsharp" - }, - "2": { - "name": "entity.name.type.fsharp" - } - } + "4": { + "name": "keyword.fsharp" }, + "5": { + "name": "variable.fsharp" + } + }, + "patterns": [ { - "match": "(->)\\s*(\\()?\\s*([?[:alpha:]0-9'`^._ ]+)*", - "captures": { - "1": { - "name": "keyword.symbol.fsharp" - }, - "2": { - "name": "keyword.symbol.fsharp" - }, - "3": { - "name": "entity.name.type.fsharp" - } - } - }, - { - "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" - } - ] - }, - { - "match": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*", - "captures": { - "1": { - "name": "keyword.symbol.fsharp" - }, - "2": { - "name": "entity.name.type.fsharp" - } - } - }, - { - "begin": "(<(?![[:space:]]*\\)))", - "end": "(>)", - "beginCaptures": { - "1": { - "name": "keyword.symbol.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "keyword.symbol.fsharp" - } - }, - "patterns": [ - { - "include": "#generic_declaration" - } - ] - }, - { - "begin": "({)", - "end": "(})", - "beginCaptures": { - "1": { - "name": "keyword.symbol.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "keyword.symbol.fsharp" - } - }, - "patterns": [ - { - "include": "#record_signature" - } - ] - }, - { - "include": "#variables" - }, - { - "include": "#keywords" + "include": "#common_binding_definition" } ] } @@ -613,7 +911,7 @@ "patterns": [ { "name": "keyword.fsharp", - "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|property|union|enum|member|try|finally|and|when|use|use\\!|struct|while|mutable)(?!')\\b" + "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|property|union|enum|member|try|finally|and|when|or|use|use\\!|struct|while|mutable)(?!')\\b" }, { "name": "keyword.symbol.fsharp", @@ -817,8 +1115,15 @@ "match": "\\(\\)" }, { - "name": "variable.parameter.fsharp", - "match": "``[[:alpha:]0-9'`^:,._ ]+``|[[:alpha:]0-9'`<>^._ ]\\w*" + "match": "(\\?{0,1})(``[[:alpha:]0-9'`^:,._ ]+``|[[:alpha:]0-9'`<>^._ ]\\w*)", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "variable.parameter.fsharp" + } + } } ] }, @@ -869,19 +1174,22 @@ } }, { - "begin": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)(<))", + "begin": "(\\?{0,1})([[:alpha:]0-9'`^._ ]+)\\s*(:)(\\s*([?[:alpha:]0-9'`^._ ]+)(<))", "end": "(>)", "beginCaptures": { "1": { - "name": "variable.parameter.fsharp" + "name": "keyword.symbol.fsharp" }, "2": { - "name": "keyword.symbol.fsharp" + "name": "variable.parameter.fsharp" }, "3": { "name": "keyword.symbol.fsharp" }, "4": { + "name": "keyword.symbol.fsharp" + }, + "5": { "name": "entity.name.type.fsharp" } }, @@ -909,13 +1217,26 @@ "member_declaration": { "patterns": [ { - "begin": "(\\()", - "end": "(\\))", + "include": "#comments" + }, + { + "include": "#common_declaration" + }, + { + "comments": "SRTP syntax support", + "begin": "(:)\\s*(\\()\\s*(static member|member)", "beginCaptures": { "1": { "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "keyword.symbol.fsharp" + }, + "3": { + "name": "keyword.fsharp" } }, + "end": "(\\))\\s*((?=,)|(?=\\=))", "endCaptures": { "1": { "name": "keyword.symbol.fsharp" @@ -923,29 +1244,75 @@ }, "patterns": [ { - "include": "#comments" + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#member_declaration" + } + ] }, { - "include": "#common_declaration" - }, - { - "match": "\\?{0,1}([[:alpha:]0-9'`^._ ]+)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'`<>^._ ]+)){0,1}", + "match": "(\\^[[:alpha:]0-9'._]+)", "captures": { "1": { - "name": "variable.parameter.fsharp" - }, - "2": { - "name": "keyword.symbol.fsharp" - }, - "3": { "name": "entity.name.type.fsharp" } } }, + { + "include": "#variables" + }, { "include": "#keywords" } ] + }, + { + "match": "(\\^[[:alpha:]0-9'._]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "name": "keyword.fsharp", + "match": "\\b(and|when|or)\\b" + }, + { + "name": "keyword.symbol.fsharp", + "match": "(\\(|\\))" + }, + { + "match": "(\\?{0,1})([[:alpha:]0-9'`^._]+|``[[:alpha:]0-9'`^:,._ ]+``)\\s*(:{0,1})(\\s*([?[:alpha:]0-9'`<>._ ]+)){0,1}", + "captures": { + "1": { + "name": "keyword.symbol.fsharp" + }, + "2": { + "name": "variable.parameter.fsharp" + }, + "3": { + "name": "keyword.symbol.fsharp" + }, + "4": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#keywords" } ] }, @@ -973,16 +1340,13 @@ { "name": "record.fsharp", "begin": "\\b(type)[\\s]+(private|internal|public)?\\s*", - "end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", + "end": "\\s*((with)|((as)\\s+([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))", "beginCaptures": { "1": { "name": "keyword.fsharp" }, "2": { "name": "keyword.fsharp" - }, - "3": { - "name": "support.function.attribute.fsharp" } }, "endCaptures": { @@ -1013,18 +1377,82 @@ "include": "#attributes" }, { - "match": "([[:alpha:]0-9'`^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)(<)", + "match": "([[:alpha:]0-9'^._]+|``[[:alpha:]0-9'`^:,._ ]+``)", "captures": { "1": { "name": "entity.name.type.fsharp" - }, - "2": { - "name": "keyword.symbol.fsharp" } } }, { - "match": "\\s*(>)\\s*(private|internal|public)?", + "begin": "(<)", + "end": "((?)", + "beginCaptures": { + "1": { + "name": "keyword.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.fsharp" + } + }, + "patterns": [ + { + "match": "(('|\\^)``[[:alpha:]0-9`^:,._ ]+``|('|\\^)[[:alpha:]0-9`^:._]+)", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "name": "keyword.fsharp", + "match": "\\b(interface|with|abstract|and|when|or|not|struct|equality|comparison|unmanaged|delegate|enum)\\b" + }, + { + "begin": "(\\()", + "end": "(\\))", + "beginCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "match": "(static member|member|new)", + "captures": { + "1": { + "name": "keyword.fsharp" + } + } + }, + { + "include": "#common_binding_definition" + } + ] + }, + { + "match": "([\\w0-9'`^._]+)", + "comments": "Here we need the \\w modifier in order to check that the words isn't blacklisted", + "captures": { + "1": { + "name": "entity.name.type.fsharp" + } + } + }, + { + "include": "#keywords" + } + ] + }, + { + "match": "\\s*(private|internal|public)", "captures": { "1": { "name": "keyword.symbol.fsharp" @@ -1035,15 +1463,23 @@ } }, { - "match": "([[:alpha:]0-9'`^._ ]+)", - "captures": { + "begin": "(\\()", + "end": "\\s*(?=(=)|[\\n=]|(\\(\\))|(as))", + "beginCaptures": { "1": { - "name": "entity.name.type.fsharp" + "name": "keyword.symbol.fsharp" } - } - }, - { - "include": "#member_declaration" + }, + "endCaptures": { + "1": { + "name": "keyword.symbol.fsharp" + } + }, + "patterns": [ + { + "include": "#member_declaration" + } + ] }, { "include": "#keywords" @@ -1099,9 +1535,6 @@ } ] }, - { - "include": "#chars" - }, { "include": "#compiler_directives" }, diff --git a/extensions/fsharp/test/colorize-results/test_fs.json b/extensions/fsharp/test/colorize-results/test_fs.json index 328557e57b3..37c0b61c14a 100644 --- a/extensions/fsharp/test/colorize-results/test_fs.json +++ b/extensions/fsharp/test/colorize-results/test_fs.json @@ -110,7 +110,18 @@ } }, { - "c": " age", + "c": " ", + "t": "source.fsharp record.fsharp", + "r": { + "dark_plus": "default: #D4D4D4", + "light_plus": "default: #000000", + "dark_vs": "default: #D4D4D4", + "light_vs": "default: #000000", + "hc_black": "default: #FFFFFF" + } + }, + { + "c": "age", "t": "source.fsharp record.fsharp variable.parameter.fsharp", "r": { "dark_plus": "variable: #9CDCFE", diff --git a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json index ab11abeb0a6..e6a93b338c5 100644 --- a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/6e8a3830c29b6f29c06d2de091240e1a880f21aa", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/a34cb117a38ac6f6eae0df88db984780c6b3df1e", "name": "JavaScript (with React support)", "scopeName": "source.js", "patterns": [ @@ -2676,7 +2676,7 @@ "name": "keyword.operator.new.js" } }, - "end": "(?<=\\))|(?=[;),}\\]:]|\\|\\||\\&\\&|$|((?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", + "name": "meta.format.brace.python", + "match": "(?x)\n (\n {{ | }}\n | (?:\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", "captures": { - "2": { - "name": "storage.type.format.python" + "1": { + "name": "constant.character.format.placeholder.other.python" }, "3": { "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" } } }, { - "name": "constant.character.format.placeholder.other.python", - "begin": "(?x)\n \\{\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (?=[^'\"}\\n]*\\})\n", - "end": "\\}", - "beginCaptures": { - "2": { - "name": "storage.type.format.python" + "name": "meta.format.brace.python", + "match": "(?x)\n (\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n (:)\n [^'\"{}\\n]* (?:\n \\{ [^'\"}\\n]*? \\} [^'\"{}\\n]*\n )*\n }\n )\n", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" }, "3": { "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" } - }, - "patterns": [ - { - "match": "(?x) \\{ [^'\"}\\n]*? \\} (?=.*?\\})\n" - } - ] + } } ] }, @@ -899,25 +915,43 @@ "match": "(}(?!}))" }, "import": { - "comment": "Import statements\n", + "comment": "Import statements used to correctly mark `from`, `import`, and `as`\n", "patterns": [ { - "match": "(?x)\n \\s* \\b(from)\\b \\s*(\\.+)\\s* (import)?\n", - "captures": { + "begin": "\\b(?