From b09e1df1068cbb1c101132cfcc0c6c298cfe4d07 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 28 Dec 2016 22:51:46 -0400 Subject: [PATCH] [fsharp] Updated fsharp.json to ionide/ionide-fsgrammar@864bfd9 (2016-12-21). Fixes #17820 --- ThirdPartyNotices.txt | 4 +- extensions/fsharp/OSSREADME.json | 6 +- extensions/fsharp/package.json | 3 + extensions/fsharp/syntaxes/fsharp.json | 1066 +++++++++-------- .../fsharp/test/colorize-results/test_fs.json | 107 +- 5 files changed, 591 insertions(+), 595 deletions(-) diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 1c8706ebb8c..ec35852b4b5 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -19,7 +19,7 @@ This project incorporates components from the projects listed below. The origina 12. freebroccolo/atom-language-swift (https://github.com/freebroccolo/atom-language-swift) 13. HTML 5.1 W3C Working Draft version 08 October 2015 (http://www.w3.org/TR/2015/WD-html51-20151008/) 14. Ionic documentation version 1.2.4 (https://github.com/driftyco/ionic-site) -15. ionide/ionide-fsharp (https://github.com/ionide/ionide-atom-fsharp) +15. ionide/ionide-fsgrammar (https://github.com/ionide/ionide-fsgrammar) 16. js-beautify version 1.6.4 (https://github.com/beautify-web/js-beautify) 17. Jxck/assert version 1.0.0 (https://github.com/Jxck/assert) 18. language-docker (https://github.com/docker/docker) @@ -500,7 +500,7 @@ END OF ionide/ionide-fsharp NOTICES AND INFORMATION ========================================= The MIT License (MIT) -Copyright (c) 2007-2013 Einar Lielmanis and contributors. +Copyright (c) 2007-2017 Einar Lielmanis, Liam Newman, and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/extensions/fsharp/OSSREADME.json b/extensions/fsharp/OSSREADME.json index 6ee0c63a2e4..95d6c5b023c 100644 --- a/extensions/fsharp/OSSREADME.json +++ b/extensions/fsharp/OSSREADME.json @@ -1,8 +1,8 @@ // ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: [{ - "name": "ionide/ionide-fsharp", + "name": "ionide/ionide-fsgrammar", "version": "0.0.0", "license": "MIT", - "repositoryURL": "https://github.com/ionide/ionide-atom-fsharp", - "description": "The file syntaxes/fsharp.json was included from https://github.com/ionide/ionide-atom-fsharp/blob/develop/release/grammars/fsharp.json." + "repositoryURL": "https://github.com/ionide/ionide-fsgrammar", + "description": "The file syntaxes/fsharp.json was included from https://github.com/ionide/ionide-fsgrammar/blob/master/grammar/fsharp.json." }] diff --git a/extensions/fsharp/package.json b/extensions/fsharp/package.json index aae0597f2f7..4426dcbde61 100644 --- a/extensions/fsharp/package.json +++ b/extensions/fsharp/package.json @@ -3,6 +3,9 @@ "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, + "scripts": { + "update-grammar": "node ../../build/npm/update-grammar.js ionide/ionide-fsgrammar grammar/fsharp.json ./syntaxes/fsharp.json" + }, "contributes": { "languages": [{ "id": "fsharp", diff --git a/extensions/fsharp/syntaxes/fsharp.json b/extensions/fsharp/syntaxes/fsharp.json index f65bba136d3..bf542c56e79 100644 --- a/extensions/fsharp/syntaxes/fsharp.json +++ b/extensions/fsharp/syntaxes/fsharp.json @@ -1,533 +1,537 @@ { - "name": "F#", - "scopeName": "source.fsharp", - "fileTypes": [ - "fs" - ], - "foldingStartMarker": "", - "foldingStopMarker": "", - "patterns": [ - { - "include": "#comments" - }, - { - "include": "#constants" - }, - { - "include": "#structure" - }, - { - "include": "#attributes" - }, - { - "include": "#strings" - }, - { - "include": "#chars" - }, - { - "include": "#double_tick" - }, - { - "include": "#definition" - }, - { - "include": "#method_calls" - }, - { - "include": "#modules" - }, - { - "include": "#anonymous_functions" - }, - { - "include": "#keywords" - }, - { - "include": "#records" - }, - { - "include": "#cexprs" - }, - { - "include": "#text" - } - ], - "repository": { - "anonymous_functions": { - "patterns": [ - { - "name": "meta.function.anonymous", - "begin": "\\b(fun)\\b", - "end": "(->)", - "beginCaptures": { - "1": { - "name": "keyword.other.function-definition.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "keyword.other.fsharp" - } - }, - "patterns": [ - { - "include": "#variables" - } - ] - } - ] - }, - "attributes": { - "patterns": [ - { - "name": "support.function.attribute.fsharp", - "begin": "\\[\\<", - "end": "\\>\\]", - "patterns": [ - { - "include": "$self" - } - ] - } - ] - }, - "comments": { - "patterns": [ - { - "name": "comment.block.fsharp", - "begin": "(\\(\\*(?!\\)))", - "end": "(\\*\\))", - "beginCaptures": { - "1": { - "name": "comment.block.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "comment.block.fsharp" - } - } - - }, - { - "name": "comment.line.double-slash.fsharp", - "match": "//.*$" - } - ] - }, - "constants": { - "patterns": [ - { - "name": "constant.language.unit.fsharp", - "match": "\\(\\)" - }, - { - "name": "constant.numeric.floating-point.fsharp", - "match": "\\b-?[0-9][0-9_]*((\\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))" - }, - { - "name": "constant.numeric.integer.nativeint.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.others.fsharp", - "match": "\\b(true|false|null|unit)\\b" - } - ] - }, - "definition": { - "patterns": [ - { - "name": "meta.binding.fsharp", - "begin": "(val mutable|val|let mutable|let|member|static member|override|let!)(\\s+rec|mutable)?(\\s+private|internal|public)?\\s+(\\([^\\s-]*\\)|[_a-zA-Z]([_a-zA-Z0-9,\\.]|(?<=,)\\s)*)", - "end": "((``.*``)|(with)|=|$)", - "beginCaptures": { - "1": { - "name": "keyword.other.binding.fsharp" - }, - "2": { - "name": "keyword.other.function-recursive.fsharp" - }, - "3": { - "name": "keyword.other.access.fsharp" - }, - "4": { - "name": "variable.other.binding.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "keyword.other.fsharp" - }, - "2": { - "name": "variable.other.binding.fsharp" - }, - "3": { - "name": "keyword.other.fsharp" - } - }, - "patterns": [ - { - "include": "#variables" - } - ] - } - ] - }, - "keywords": { - "patterns": [ - { - "name": "keyword.other.fsharp", - "match": "\\b(function|yield!|yield|class|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\\!|return\\!|return|interface|with|member|try|finally|and|when|use|use\\!)\\b" - }, - { - "name": "meta.preprocessor.fsharp", - "begin": "^\\s*#\\s*(light)\\b", - "end": "(\\s|$)" - }, - { - "name": "keyword.other.fsharp", - "match": "(\\|>|\\->|\\<\\-|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|{|}|\\||_|\\.\\.|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\<\\<)" - } - ] - }, - "modules": { - "patterns": [ - { - "name": "entity.name.section.fsharp", - "begin": "\\b(namespace|module)(\\s+public|internal|private)?\\s+([a-zA-Z][a-zA-Z0-9'_. ]*)", - "end": "(\\s|$)", - "beginCaptures": { - "1": { - "name": "keyword.other.fsharp" - }, - "2": { - "name": "keyword.other.fsharp" - }, - "3": { - "name": "entity.name.section.fsharp" - } - }, - "patterns": [ - { - "name": "entity.name.section.fsharp", - "match": "(\\.)([A-Z][a-zA-Z0-9'_]*)", - "captures": { - "1": { - "name": "punctuation.separator.namespace-reference.fsharp" - }, - "2": { - "name": "entity.name.section.fsharp" - } - } - } - ] - }, - { - "name": "meta.namespace.open.fsharp", - "begin": "\\b(open)\\s+([A-Z][a-zA-Z0-9'_]*)(?=(\\.[A-Z][a-zA-Z0-9_]*)*)", - "end": "(\\s|$)", - "beginCaptures": { - "1": { - "name": "keyword.other.fsharp" - }, - "2": { - "name": "entity.name.section.fsharp" - } - }, - "patterns": [ - { - "name": "entity.name.section.fsharp", - "match": "(\\.)([a-zA-Z][a-zA-Z0-9'_]*)", - "captures": { - "1": { - "name": "punctuation.separator.namespace-reference.fsharp" - }, - "2": { - "name": "entity.name.section.fsharp" - } - } - } - ] - }, - { - "name": "meta.namespace.alias.fsharp", - "begin": "^\\s*(module)\\s+([A-Z][a-zA-Z0-9'_]*)\\s*(=)\\s*([A-Z][a-zA-Z0-9'_]*)", - "end": "(\\s|$)", - "beginCaptures": { - "1": { - "name": "keyword.other.namespace-definition.fsharp" - }, - "2": { - "name": "entity.name.type.namespace.fsharp" - }, - "3": { - "name": "punctuation.separator.namespace-definition.fsharp" - }, - "4": { - "name": "entity.name.section.fsharp" - } - }, - "patterns": [ - { - "name": "entity.name.section.fsharp", - "match": "(\\.)([A-Z][a-zA-Z0-9'_]*)", - "captures": { - "1": { - "name": "punctuation.separator.namespace-reference.fsharp" - }, - "2": { - "name": "entity.name.section.fsharp" - } - } - } - ] - } - ] - }, - "strings": { - "patterns": [ - { - "contentName": "string.quoted.literalprintf.fsharp", - "begin": "(sprintf|printf[n]|failwithf)\\s+((?=[^\\\\])(@\"))", - "end": "(\")", - "beginCaptures": { - "2": { - "name": "punctuation.definition.string.begin.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.fsharp" - } - }, - "patterns": [ - { - "name": "constant.character.string.escape.fsharp", - "match": "\"(\")" - }, - { - "name": "constant.character.string.escape.format.fsharp", - "match": "%[0\\-\\+# ]{0,3}(\\*|[0-9]{0,2})(\\.[0-9]{1,2})?([bcsdiuxXoeEfFgGMOAt]|\\+A)" - } - ] - }, - { - "name": "string.quoted.literal.fsharp", - "begin": "(?=[^\\\\])(@\")", - "end": "(\")", - "beginCaptures": { - "1": { - "name": "punctuation.definition.string.begin.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.fsharp" - } - }, - "patterns": [ - { - "name": "constant.character.string.escape.fsharp", - "match": "\"(\")" - } - ] - }, - { - "contentName": "string.quoted.tripleprintf.fsharp", - "begin": "(sprintf|printf[n]|failwithf)\\s+((?=[^\\\\])(\"\"\"))", - "end": "(\"\"\")", - "beginCaptures": { - "2": { - "name": "punctuation.definition.string.begin.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.fsharp" - } - }, - "patterns": [ - { - "name": "constant.character.string.escape.format.fsharp", - "match": "%[0\\-\\+# ]{0,3}(\\*|[0-9]{0,2})(\\.[0-9]{1,2})?([bcsdiuxXoeEfFgGMOAt]|\\+A)" - } - ] - }, - { - "name": "string.quoted.triple.fsharp", - "begin": "(?=[^\\\\])(\"\"\")", - "end": "(\"\"\")", - "beginCaptures": { - "1": { - "name": "punctuation.definition.string.begin.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.fsharp" - } - } - }, - { - "contentName": "string.quoted.doubleprintf.fsharp", - "begin": "(sprintf|printf[n]|failwithf)\\s+((?=[^\\\\])(\"))", - "end": "(\")", - "beginCaptures": { - "2": { - "name": "punctuation.definition.string.begin.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.fsharp" - } - }, - "patterns": [ - { - "name": "punctuation.separator.string.ignore-eol.fsharp", - "match": "\\\\$[ \\t]*" - }, - { - "name": "constant.character.string.escape.format.fsharp", - "match": "%[0\\-\\+# ]{0,3}(\\*|[0-9]{0,2})(\\.[0-9]{1,2})?([bcsdiuxXoeEfFgGMOAt]|\\+A)" - }, - { - "name": "constant.character.string.escape.fsharp", - "match": "\\\\([\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})" - }, - { - "name": "invalid.illeagal.character.string.fsharp", - "match": "\\\\(?![\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})." - } - ] - }, - - { - "name": "string.quoted.double.fsharp", - "begin": "(?=[^\\\\])(\")", - "end": "(\")", - "beginCaptures": { - "1": { - "name": "punctuation.definition.string.begin.fsharp" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end.fsharp" - } - }, - "patterns": [ - { - "name": "punctuation.separator.string.ignore-eol.fsharp", - "match": "\\\\$[ \\t]*" - }, - { - "name": "constant.character.string.escape.fsharp", - "match": "\\\\([\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})" - }, - { - "name": "invalid.illeagal.character.string.fsharp", - "match": "\\\\(?![\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})." - } - ] - } - ] - }, - "variables": { - "patterns": [ - { - "name": "constant.language.unit.fsharp", - "match": "\\(\\)" - }, - { - "name": "variable.parameter.fsharp", - "match": "[a-zA-Z']\\w*" - } - ] - }, - "double_tick": { - "patterns": [ - { - "name": "variable.other.binding.fsharp", - "match": "(``)(.*)(``)", - "captures": { - "1": { - "name": "string.quoted.single.fsharp" - }, - "1": { - "name": "variable.other.binding.fsharp" - }, - "3": { - "name": "string.quoted.single.fsharp" - } - } - } - ] - }, - "records": { - "patterns": [ - { - "name": "record.fsharp", - "match": "(type)[\\s]+(private|internal|public)?[\\s]*([a-zA-Z0-9'<>^:,. ]+)((with)|(=)|(\\(\\)))", - - "captures": { - "1": { - "name": "keyword.other.fsharp" - }, - "2": { - "name": "keyword.other.fsharp" - }, - "3": { - "name": "entity.name.type.fsharp" - }, - "5": { - "name": "keyword.other.fsharp" - }, - "6": { - "name": "keyword.other.fsharp" - }, - "7": { - "name": "constant.language.unit.fsharp" - } - } - } - ] - }, - "cexprs": { - "patterns": [ - { - "name": "cexpr.fsharp", - "match": "\\b([a-zA-Z]*\\s+\\{)", - "captures": { - "1": { - "name": "keyword.other.fsharp" - } - } - } - ] - }, - "chars": { - "patterns": [ - { - "name": "char.fsharp", - "match": "('\\\\?.')", - "captures": { - "1": { - "name": "string.quoted.single.fsharp" - } - } - } - ] - }, - "text": { - "patterns": [ - { - "name": "text.fsharp", - "match": "\\\\" - } - ] - } - } + "name": "fsharp", + "scopeName": "source.fsharp", + "fileTypes": [ + "fs" + ], + "foldingStartMarker": "", + "foldingStopMarker": "", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#constants" + }, + { + "include": "#structure" + }, + { + "include": "#attributes" + }, + { + "include": "#strings" + }, + { + "include": "#chars" + }, + { + "include": "#double_tick" + }, + { + "include": "#definition" + }, + { + "include": "#method_calls" + }, + { + "include": "#modules" + }, + { + "include": "#anonymous_functions" + }, + { + "include": "#keywords" + }, + { + "include": "#records" + }, + { + "include": "#cexprs" + }, + { + "include": "#text" + } + ], + "repository": { + "anonymous_functions": { + "patterns": [ + { + "name": "function.anonymous", + "begin": "\\b(fun)\\b", + "end": "(->)", + "beginCaptures": { + "1": { + "name": "keyword.other.function-definition.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.other.fsharp" + } + }, + "patterns": [ + { + "include": "#variables" + } + ] + } + ] + }, + "attributes": { + "patterns": [ + { + "name": "support.function.attribute.fsharp", + "begin": "\\[\\<", + "end": "\\>\\]", + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.block.fsharp", + "begin": "(\\(\\*(?!\\)))", + "end": "(\\*\\))", + "beginCaptures": { + "1": { + "name": "comment.block.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "comment.block.fsharp" + } + } + }, + { + "name": "comment.line.double-slash.fsharp", + "match": "//.*$" + } + ] + }, + "constants": { + "patterns": [ + { + "name": "constant.language.unit.fsharp", + "match": "\\(\\)" + }, + { + "name": "constant.numeric.floating-point.fsharp", + "match": "\\b-?[0-9][0-9_]*((\\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))" + }, + { + "name": "constant.numeric.integer.nativeint.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.others.fsharp", + "match": "\\b(true|false|null|unit)\\b" + } + ] + }, + "definition": { + "patterns": [ + { + "name": "binding.fsharp", + "begin": "\\b(val mutable|val|let mutable|let inline|let|member|static member|override|let!)(\\s+rec|mutable)?(\\s+private|internal|public)?\\s+(\\([^\\s-]*\\)|[_a-zA-Z]([_a-zA-Z0-9,\\.]|(?<=,)\\s)*)", + "end": "((``.*``)|(with)|=|$)", + "beginCaptures": { + "1": { + "name": "keyword.other.binding.fsharp" + }, + "2": { + "name": "keyword.other.function-recursive.fsharp" + }, + "3": { + "name": "keyword.other.access.fsharp" + }, + "4": { + "name": "variable.other.binding.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.other.fsharp" + }, + "2": { + "name": "variable.other.binding.fsharp" + }, + "3": { + "name": "keyword.other.fsharp" + } + }, + "patterns": [ + { + "include": "#variables" + } + ] + } + ] + }, + "keywords": { + "patterns": [ + { + "name": "keyword.other.fsharp", + "match": "\\b(function|yield!|yield|class|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\\!|return\\!|return|interface|with|abstract|member|try|finally|and|when|use|use\\!|struct|while)\\b" + }, + { + "name": "meta.preprocessor.fsharp", + "begin": "^\\s*#\\s*(light)\\b", + "end": "(\\s|$)" + }, + { + "name": "keyword.other.fsharp", + "match": "(&&&|\\|\\|\\||\\^\\^\\^|~~~|<<<|>>>|\\|>|\\->|\\<\\-|:>|:\\?>|:|\\[|\\]|\\;|<>|=|@|\\|\\||&&|{|}|\\||_|\\.\\.|\\+|\\-|\\*|\\/|\\^|\\!|\\>|\\>\\=|\\>\\>|\\<|\\<\\=|\\<\\<)" + } + ] + }, + "modules": { + "patterns": [ + { + "name": "entity.name.section.fsharp", + "begin": "\\b(namespace|module)(\\s+public|internal|private)?\\s+([a-zA-Z][a-zA-Z0-9'_. ]*)", + "end": "(\\s|$)", + "beginCaptures": { + "1": { + "name": "keyword.other.fsharp" + }, + "2": { + "name": "keyword.other.fsharp" + }, + "3": { + "name": "entity.name.section.fsharp" + } + }, + "patterns": [ + { + "name": "entity.name.section.fsharp", + "match": "(\\.)([A-Z][a-zA-Z0-9'_]*)", + "captures": { + "1": { + "name": "punctuation.separator.namespace-reference.fsharp" + }, + "2": { + "name": "entity.name.section.fsharp" + } + } + } + ] + }, + { + "name": "namespace.open.fsharp", + "begin": "\\b(open)\\s+([A-Z][a-zA-Z0-9'_]*)(?=(\\.[A-Z][a-zA-Z0-9_]*)*)", + "end": "(\\s|$)", + "beginCaptures": { + "1": { + "name": "keyword.other.fsharp" + }, + "2": { + "name": "entity.name.section.fsharp" + } + }, + "patterns": [ + { + "name": "entity.name.section.fsharp", + "match": "(\\.)([a-zA-Z][a-zA-Z0-9'_]*)", + "captures": { + "1": { + "name": "punctuation.separator.namespace-reference.fsharp" + }, + "2": { + "name": "entity.name.section.fsharp" + } + } + } + ] + }, + { + "name": "namespace.alias.fsharp", + "begin": "^\\s*(module)\\s+([A-Z][a-zA-Z0-9'_]*)\\s*(=)\\s*([A-Z][a-zA-Z0-9'_]*)", + "end": "(\\s|$)", + "beginCaptures": { + "1": { + "name": "keyword.other.namespace-definition.fsharp" + }, + "2": { + "name": "entity.name.type.namespace.fsharp" + }, + "3": { + "name": "punctuation.separator.namespace-definition.fsharp" + }, + "4": { + "name": "entity.name.section.fsharp" + } + }, + "patterns": [ + { + "name": "entity.name.section.fsharp", + "match": "(\\.)([A-Z][a-zA-Z0-9'_]*)", + "captures": { + "1": { + "name": "punctuation.separator.namespace-reference.fsharp" + }, + "2": { + "name": "entity.name.section.fsharp" + } + } + } + ] + } + ] + }, + "strings": { + "patterns": [ + { + "contentName": "string.quoted.literalprintf.fsharp", + "begin": "(sprintf|printf[n]|failwithf)\\s+((?=[^\\\\])(@\"))", + "end": "(\")", + "beginCaptures": { + "2": { + "name": "punctuation.definition.string.begin.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.fsharp" + } + }, + "patterns": [ + { + "name": "constant.character.string.escape.fsharp", + "match": "\"(\")" + }, + { + "name": "constant.character.string.escape.format.fsharp", + "match": "%[0\\-\\+# ]{0,3}(\\*|[0-9]{0,2})(\\.[0-9]{1,2})?([bcsdiuxXoeEfFgGMOAt]|\\+A)" + } + ] + }, + { + "name": "string.quoted.literal.fsharp", + "begin": "(?=[^\\\\])(@\")", + "end": "(\")(?!\")", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.fsharp" + } + }, + "patterns": [ + { + "name": "constant.character.string.escape.fsharp", + "match": "\"(\")" + } + ] + }, + { + "contentName": "string.quoted.tripleprintf.fsharp", + "begin": "(sprintf|printf[n]|failwithf)\\s+((?=[^\\\\])(\"\"\"))", + "end": "(\"\"\")", + "beginCaptures": { + "2": { + "name": "punctuation.definition.string.begin.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.fsharp" + } + }, + "patterns": [ + { + "name": "constant.character.string.escape.format.fsharp", + "match": "%[0\\-\\+# ]{0,3}(\\*|[0-9]{0,2})(\\.[0-9]{1,2})?([bcsdiuxXoeEfFgGMOAt]|\\+A)" + } + ] + }, + { + "name": "string.quoted.triple.fsharp", + "begin": "(?=[^\\\\])(\"\"\")", + "end": "(\"\"\")", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.fsharp" + } + } + }, + { + "contentName": "string.quoted.doubleprintf.fsharp", + "begin": "(sprintf|printf[n]|failwithf)\\s+((?=[^\\\\])(\"))", + "end": "(\")", + "beginCaptures": { + "2": { + "name": "punctuation.definition.string.begin.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.fsharp" + } + }, + "patterns": [ + { + "name": "punctuation.separator.string.ignore-eol.fsharp", + "match": "\\\\$[ \\t]*" + }, + { + "name": "constant.character.string.escape.format.fsharp", + "match": "%[0\\-\\+# ]{0,3}(\\*|[0-9]{0,2})(\\.[0-9]{1,2})?([bcsdiuxXoeEfFgGMOAt]|\\+A)" + }, + { + "name": "constant.character.string.escape.fsharp", + "match": "\\\\([\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})" + }, + { + "name": "invalid.illeagal.character.string.fsharp", + "match": "\\\\(?![\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})." + } + ] + }, + { + "name": "string.quoted.double.fsharp", + "begin": "(?=[^\\\\])(\")", + "end": "(\")", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.fsharp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.fsharp" + } + }, + "patterns": [ + { + "name": "punctuation.separator.string.ignore-eol.fsharp", + "match": "\\\\$[ \\t]*" + }, + { + "name": "constant.character.string.escape.fsharp", + "match": "\\\\([\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})" + }, + { + "name": "invalid.illeagal.character.string.fsharp", + "match": "\\\\(?![\\\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})." + } + ] + } + ] + }, + "variables": { + "patterns": [ + { + "name": "constant.language.unit.fsharp", + "match": "\\(\\)" + }, + { + "name": "variable.parameter.fsharp", + "match": "[a-zA-Z']\\w*" + } + ] + }, + "double_tick": { + "patterns": [ + { + "name": "variable.other.binding.fsharp", + "match": "(``)(.*)(``)", + "captures": { + "1": { + "name": "string.quoted.single.fsharp" + }, + "2": { + "name": "variable.other.binding.fsharp" + }, + "3": { + "name": "string.quoted.single.fsharp" + } + } + } + ] + }, + "records": { + "patterns": [ + { + "name": "record.fsharp", + "match": "(type)[\\s]+(private|internal|public)?[\\s]*([a-zA-Z0-9'<>^:,. ]+)[\\s]*(\\([a-zA-Z0-9'<>^:,. ]+\\))?[\\s]*((with)|(as [a-zA-Z0-9']+)|(=)|(\\(\\)))", + "captures": { + "1": { + "name": "keyword.other.fsharp" + }, + "2": { + "name": "keyword.other.fsharp" + }, + "3": { + "name": "entity.name.type.fsharp" + }, + "4": { + "name": "entity.name.type.fsharp" + }, + "6": { + "name": "keyword.other.fsharp" + }, + "7": { + "name": "keyword.other.fsharp" + }, + "8": { + "name": "keyword.other.fsharp" + }, + "9": { + "name": "constant.language.unit.fsharp" + } + } + } + ] + }, + "cexprs": { + "patterns": [ + { + "name": "cexpr.fsharp", + "match": "\\b([a-zA-Z]*\\s+\\{)", + "captures": { + "1": { + "name": "keyword.other.fsharp" + } + } + } + ] + }, + "chars": { + "patterns": [ + { + "name": "char.fsharp", + "match": "('\\\\?.')", + "captures": { + "1": { + "name": "string.quoted.single.fsharp" + } + } + } + ] + }, + "text": { + "patterns": [ + { + "name": "text.fsharp", + "match": "\\\\" + } + ] + } + }, + "version": "https://github.com/ionide/ionide-fsgrammar/commit/864bfd9a6e7f4bfa648eaddba19e16d5a81103a1" } \ No newline at end of file diff --git a/extensions/fsharp/test/colorize-results/test_fs.json b/extensions/fsharp/test/colorize-results/test_fs.json index 68ec1f0fa1e..fd1aad3a6ef 100644 --- a/extensions/fsharp/test/colorize-results/test_fs.json +++ b/extensions/fsharp/test/colorize-results/test_fs.json @@ -22,19 +22,8 @@ } }, { - "c": "type Person(name", - "t": "", - "r": { - "dark_plus": ".vs-dark .token rgb(212, 212, 212)", - "light_plus": ".vs .token rgb(0, 0, 0)", - "dark_vs": ".vs-dark .token rgb(212, 212, 212)", - "light_vs": ".vs .token rgb(0, 0, 0)", - "hc_black": ".hc-black .token rgb(255, 255, 255)" - } - }, - { - "c": ":", - "t": "fsharp.keyword.other", + "c": "type", + "t": "fsharp.keyword.other.record", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -44,8 +33,8 @@ } }, { - "c": "string, age", - "t": "", + "c": " ", + "t": "fsharp.record", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -55,19 +44,19 @@ } }, { - "c": ":", - "t": "fsharp.keyword.other", + "c": "Person(name:string, age:int)", + "t": "entity.fsharp.name.record.type", "r": { - "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", - "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", - "dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword rgb(86, 156, 214)", - "light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword rgb(0, 0, 255)", - "hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword rgb(86, 156, 214)" + "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.type rgb(78, 201, 176)", + "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.type rgb(38, 127, 153)", + "dark_vs": ".vs-dark .token rgb(212, 212, 212)", + "light_vs": ".vs .token rgb(0, 0, 0)", + "hc_black": ".hc-black .token rgb(255, 255, 255)" } }, { - "c": "int) ", - "t": "", + "c": " ", + "t": "fsharp.record", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -78,7 +67,7 @@ }, { "c": "=", - "t": "fsharp.keyword.other", + "t": "fsharp.keyword.other.record", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -100,7 +89,7 @@ }, { "c": "let mutable", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -111,7 +100,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -122,7 +111,7 @@ }, { "c": "internalAge", - "t": "binding.fsharp.meta.other.variable", + "t": "binding.fsharp.other.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", @@ -133,7 +122,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -144,7 +133,7 @@ }, { "c": "=", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -276,7 +265,7 @@ }, { "c": "member", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -287,7 +276,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -298,7 +287,7 @@ }, { "c": "this.Name", - "t": "binding.fsharp.meta.other.variable", + "t": "binding.fsharp.other.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", @@ -309,7 +298,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -320,7 +309,7 @@ }, { "c": "=", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -375,7 +364,7 @@ }, { "c": "member", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -386,7 +375,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -397,7 +386,7 @@ }, { "c": "this.Age", - "t": "binding.fsharp.meta.other.variable", + "t": "binding.fsharp.other.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", @@ -573,7 +562,7 @@ }, { "c": "member", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -584,7 +573,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -595,7 +584,7 @@ }, { "c": "this.HasABirthday", - "t": "binding.fsharp.meta.other.variable", + "t": "binding.fsharp.other.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", @@ -606,7 +595,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -617,7 +606,7 @@ }, { "c": "()", - "t": "binding.constant.fsharp.language.meta.unit", + "t": "binding.constant.fsharp.language.unit", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.constant.language rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.constant.language rgb(0, 0, 255)", @@ -628,7 +617,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -639,7 +628,7 @@ }, { "c": "=", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -727,7 +716,7 @@ }, { "c": "member", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -738,7 +727,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -749,7 +738,7 @@ }, { "c": "this.IsOfAge", - "t": "binding.fsharp.meta.other.variable", + "t": "binding.fsharp.other.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", @@ -760,7 +749,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -771,7 +760,7 @@ }, { "c": "targetAge", - "t": "binding.fsharp.meta.parameter.variable", + "t": "binding.fsharp.parameter.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable.parameter rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable.parameter rgb(0, 16, 128)", @@ -782,7 +771,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -793,7 +782,7 @@ }, { "c": "=", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -848,7 +837,7 @@ }, { "c": "override", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", @@ -859,7 +848,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -870,7 +859,7 @@ }, { "c": "this.ToString", - "t": "binding.fsharp.meta.other.variable", + "t": "binding.fsharp.other.variable", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", @@ -881,7 +870,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -892,7 +881,7 @@ }, { "c": "()", - "t": "binding.constant.fsharp.language.meta.unit", + "t": "binding.constant.fsharp.language.unit", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.constant.language rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.constant.language rgb(0, 0, 255)", @@ -903,7 +892,7 @@ }, { "c": " ", - "t": "binding.fsharp.meta", + "t": "binding.fsharp", "r": { "dark_plus": ".vs-dark .token rgb(212, 212, 212)", "light_plus": ".vs .token rgb(0, 0, 0)", @@ -914,7 +903,7 @@ }, { "c": "=", - "t": "binding.fsharp.keyword.meta.other", + "t": "binding.fsharp.keyword.other", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)",