diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c210468..1c0e6213 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -121,7 +121,7 @@ jobs: - run: name: Install opam dev dependencies command: | - opam install reason.3.6.0 dune.1.11.4 uri --yes | cat + opam install reason.3.6.0 dune.1.11.4 --yes | cat - save-opam-cache - run: name: Build @@ -169,7 +169,7 @@ jobs: - run: name: Install opam dev dependencies command: | - opam install reason.3.6.0 dune.1.11.4 uri --yes | cat + opam install reason.3.6.0 dune.1.11.4 --yes | cat - save-opam-cache - run: name: Build @@ -229,7 +229,7 @@ jobs: command: | cd /cygdrive/c/Users/circleci/project eval $(opam env) - opam install reason.3.6.0 dune.1.11.4 uri --yes | cat + opam install reason.3.6.0 dune.1.11.4 --yes | cat - save_cache: key: v3-opam-cache-{{ arch }} paths: diff --git a/editor-extensions/vscode/.vscodeignore b/editor-extensions/vscode/.vscodeignore deleted file mode 100644 index 3464e907..00000000 --- a/editor-extensions/vscode/.vscodeignore +++ /dev/null @@ -1,3 +0,0 @@ -*.zip -*.vsix -logo.sketch diff --git a/editor-extensions/vscode/LICENSE b/editor-extensions/vscode/LICENSE deleted file mode 100644 index aa2a4897..00000000 --- a/editor-extensions/vscode/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) 2018 Jared Forsyth 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: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/editor-extensions/vscode/Readme.md b/editor-extensions/vscode/Readme.md deleted file mode 100644 index 9f842c4f..00000000 --- a/editor-extensions/vscode/Readme.md +++ /dev/null @@ -1,41 +0,0 @@ -# vscode-reason-language-server - -Based on `vscode-reasonml`, but with a language server backend that's written entirely in reason & compiled natively. - -![screenshot](https://github.com/jaredly/reason-language-server/raw/master/editor-extensions/vscode/screenshot.png) - -## Features - -- hover goodness -- autocomplete -- function signature help -- jump-to-definition & preview-definition -- "Find all references" -- document outline / symbol search -- code lens - - - Show a file's dependencies at the top - - Show what values are used from an `open` - - Per-value type codelens (off by default) - -- highlight all usages of a variable -- rename a variable -- format selection -- format document -- auto-run bsb / dune on file change - -## Configuration -all configuration is prefixed with `reason_language_server.` - -## Debugging configuration -most useful if your developing the language server - -- `.location` - provide a custom binary location for the langauge server -- `.reloadOnChange` - reload the server when the binary is updated -- `.show_debug_errors` - pipe the server's stderr into vscode's output pane - -## Copyright & License - -Copyright © 2018 Jared Forsyth and contributors. - -Distributed under the MIT License (see [LICENSE](./LICENSE)). diff --git a/editor-extensions/vscode/bucklescript.configuration.json b/editor-extensions/vscode/bucklescript.configuration.json deleted file mode 100644 index 57d3dd77..00000000 --- a/editor-extensions/vscode/bucklescript.configuration.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "comments": { - "lineComment": "//", - "blockComment": ["/*", "*/"] - }, - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ], - "autoClosingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""], - ["`", "`"] - ], - "surroundingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""], - ["`", "`"] - ], - "folding": { - "offSide": true - } -} diff --git a/editor-extensions/vscode/bucklescript.json b/editor-extensions/vscode/bucklescript.json deleted file mode 100644 index cfd9da9d..00000000 --- a/editor-extensions/vscode/bucklescript.json +++ /dev/null @@ -1,451 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "BuckleScript", - "scopeName": "source.bucklescript", - "repository": { - "RE_IDENT": { - "match": "[a-z_][0-9a-zA-Z_]*" - }, - "RE_ATTRIBUTE": { - "match": "[A-Za-z_][A-Za-z0-9_\\.]*" - }, - "RE_MODULE_IDENT": { - "name": "entity.name.namespace", - "match": "[A-Z_][0-9a-zA-Z_]*" - }, - "RE_KEYWORDS": { - "name": "keyword.control", - "match": "\\b(and|as|assert|begin|class|constraint|done|downto|exception|external|fun|functor|inherit|lazy|let|pub|mutable|new|nonrec|object|of|or|pri|rec|then|to|val|virtual|try|catch|finally|do|else|for|if|switch|while|import|library|export|module|in|raise|private)\\b" - }, - "RE_LITERAL": { - "name": "constant.language", - "match": "\\b(true|false)\\b" - }, - "commentLine": { - "match": "//.*", - "name": "comment.line" - }, - "commentBlock": { - "name": "comment.block", - "begin": "/\\*", - "end": "\\*/" - }, - "punctuations": { - "patterns": [ - { - "match": "~", - "name": "punctuation.definition.keyword" - }, - { - "match": ";", - "name": "punctuation.terminator" - }, - { - "match": "\\.", - "name": "punctuation.accessor" - }, - { - "match": "\\,", - "name": "punctuation.separator" - }, - { - "match": "\\?|:", - "name": "punctuation.separator" - }, - { - "match": "\\|(?!\\|)", - "name": "punctuation.separator" - }, - { - "match": "\\{", - "name": "punctuation.section.braces.begin" - }, - { - "match": "\\}", - "name": "punctuation.section.braces.end" - }, - { - "match": "\\(", - "name": "punctuation.section.parens.begin" - }, - { - "match": "\\)", - "name": "punctuation.section.parens.end" - } - ] - }, - "storage": { - "patterns": [ - { - "match": "\\btype\\b", - "name": "storage.type" - } - ] - }, - "keyword": { - "patterns": [ - { - "include": "#RE_KEYWORDS" - } - ] - }, - "constant": { - "patterns": [ - { - "include": "#RE_LITERAL" - } - ] - }, - "string": { - "patterns": [ - { - "name": "string.quoted.double", - "begin": "\"", - "end": "\"", - "beginCaptures": { - "1": { - "name": "punctuation.definition.string.begin" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end" - } - }, - "patterns": [ - { - "name": "constant.character.escape", - "match": "\\\\." - } - ] - }, - { - "contentName": "string.quoted.other", - "begin": "([a-z_][0-9a-zA-Z_]*)?(`)", - "end": "`", - "beginCaptures": { - "1": { - "name": "variables.annotation" - }, - "2": { - "name": "string.quoted.other punctuation.definition.string.begin" - } - }, - "endCaptures": { - "1": { - "name": "string.quoted.other punctuation.definition.string.end" - } - } - } - ] - }, - "function": { - "patterns": [ - { - "match": "=>", - "name": "storage.type.function keyword.declaration.function" - } - ] - }, - "character": { - "patterns": [ - { - "match": "'[\\x00-\\x7F]'", - "name": "string.quoted.single" - } - ] - }, - "number": { - "patterns": [ - { - "match": "\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]+)?([eE][-+]?[0-9_]+)?)?)\\b", - "name": "constant.numeric" - } - ] - }, - "operator": { - "patterns": [ - { - "match": "->|\\|\\||&&|\\+\\+|\\*\\*|\\+\\.|\\+|-\\.|-|\\*\\.|\\*|/\\.|/|\\.\\.\\.|\\.\\.|\\|>|===|==|\\^|:=|!|>=|<=", - "name": "keyword.operator" - } - ] - }, - "assignment": { - "patterns": [ - { - "match": "=", - "name": "keyword.operator.assignment" - } - ] - }, - "constructor": { - "patterns": [ - { - "match": "\\b[A-Z][0-9a-zA-Z_]*\\b", - "name": "variable.function variable.other" - }, - { - "match": "(#)[a-zA-Z][0-9a-zA-Z_]*\\b", - "captures": { - "1": { - "name": "punctuation.definition.keyword" - } - } - } - ] - }, - "array": { - "patterns": [ - { - "match": "\\[", - "name": "punctuation.section.brackets.begin" - }, - { - "match": "\\]", - "name": "punctuation.section.brackets.end" - } - ] - }, - "list": { - "patterns": [ - { - "match": "\\b(list)(\\[)", - "captures": { - "1": { - "name": "keyword" - }, - "2": { - "name": "punctuation.section.brackets.begin" - } - } - }, - { - "match": "\\]", - "name": "punctuation.section.brackets.end" - } - ] - }, - "objectAccess": { - "patterns": [ - { - "match": "\\b[a-z_][0-9a-zA-Z_]*(\\[)", - "captures": { - "1": { - "name": "punctuation.section.brackets.begin" - } - } - }, - { - "match": "\\]", - "name": "punctuation.section.brackets.end" - } - ] - }, - "attribute": { - "patterns": [ - { - "match": "(@@?)([A-Za-z_][A-Za-z0-9_\\.]*)", - "captures": { - "1": { - "name": "storage.modifier punctuation.definition.annotation" - }, - "2": { - "name": "variable.annotation" - } - } - }, - { - "match": "(%%?)([A-Za-z_][A-Za-z0-9_\\.]*)", - "captures": { - "1": { - "name": "storage.modifier punctuation.definition.annotation" - }, - "2": { - "name": "variable.annotation" - } - } - } - ] - }, - "jsx": { - "patterns": [ - { - "match": "<>||/>" - }, - { - "match": "|~$])@{1,3}(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\]","beginCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#attributePayload"}]},"attributeIdentifier":{"match":"((?|~$])%(?![#\\-:!?.@*/&%^+<=>|~$]))((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))","captures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"}}},"attributePayload":{"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]%|^%))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"((?|~$])[:\\?](?![#\\-:!?.@*/&%^+<=>|~$]))|(?<=[[:space:]])|(?=\\])","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pathModuleExtended"},{"include":"#pathRecord"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\])","patterns":[{"include":"#signature"},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\])","patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\])|\\bwhen\\b","endCaptures":{"1":{}},"patterns":[{"include":"#pattern"}]},{"begin":"(?:(?<=(?:[^[:word:]]when|^when))(?![[:word:]]))","end":"(?=\\])","patterns":[{"include":"#term"}]}]},{"include":"#term"}]},"bindClassTerm":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])(:)|(=)(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)[[:space:]]*,|[^[:space:][:lower:]%])|(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)|(?=\\btype\\b)","endCaptures":{"0":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#attributeIdentifier"}]},{"begin":"\\[","end":"\\]","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#type"}]},{"include":"#bindTermArgs"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#literalClassType"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#term"}]}]},"bindClassType":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])(:)|(=)(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)[[:space:]]*,|[^[:space:][:lower:]%])|(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)|(?=\\btype\\b)","endCaptures":{"0":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#attributeIdentifier"}]},{"begin":"\\[","end":"\\]","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#type"}]},{"include":"#bindTermArgs"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#literalClassType"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#literalClassType"}]}]},"bindConstructor":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]exception|^exception))(?![[:word:]]))|(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\+=|^\\+=|[^#\\-:!?.@*/&%^+<=>|~$]=|^=|[^#\\-:!?.@*/&%^+<=>|~$]\\||^\\|))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(:)|(\\bof\\b)|((?|~$])\\|(?![#\\-:!?.@*/&%^+<=>|~$]))|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"},"3":{"name":"support.type strong"}},"patterns":[{"include":"#attributeIdentifier"},{"match":"\\.\\.","name":"variable.other.class.js message.error variable.interpolation string.regexp"},{"match":"\\b(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)\\b(?![[:space:]]*(?:\\.|\\([^\\*]))","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]of|^of))(?![[:word:]]))","end":"(?|~$])\\|(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]}]},"bindSignature":{"patterns":[{"include":"#comment"},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#comment"},{"include":"#pathModuleExtended"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#signature"}]}]},"bindStructure":{"patterns":[{"include":"#comment"},{"begin":"(?:(?<=(?:[^[:word:]]and|^and))(?![[:word:]]))|(?=[[:upper:]])","end":"(?|~$])(:(?!=))|(:?=)(?![#\\-:!?.@*/&%^+<=>|~$])|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#comment"},{"match":"\\bmodule\\b","name":"markup.inserted constant.language support.constant.property-value entity.name.filename"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"entity.name.function strong emphasis"},{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}},"patterns":[{"include":"#signature"}]},{"include":"#variableModule"}]},{"include":"#literalUnit"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\b(and)\\b|((?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$]))|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#signature"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:=|^:=|[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\b(?:(and)|(with))\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#structure"}]}]},"bindTerm":{"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]!|^!))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]external|^external|[^[:word:]]let|^let|[^[:word:]]method|^method|[^[:word:]]val|^val))(?![[:word:]]))","end":"(\\bmodule\\b)|(\\bopen\\b)|(?|~$])(:)|((?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$]))(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"4":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]rec|^rec))(?![[:word:]]))","end":"((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(?=[^[:space:][:alpha:]])","endCaptures":{"0":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#bindTermArgs"}]},{"include":"#bindTermArgs"},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]!|^!))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]external|^external|[^[:word:]]let|^let|[^[:word:]]method|^method|[^[:word:]]val|^val))(?![[:word:]]))","end":"(?=\\b(?:module|open)\\b)|(?=(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)[[:space:]]*,|[^[:space:][:lower:]%])|(\\brec\\b)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"}]}]},{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#declModule"}]},{"begin":"(?:(?<=(?:[^[:word:]]open|^open))(?![[:word:]]))","end":"(?=\\bin\\b)|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#pathModuleSimple"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\btype\\b|(?=[^[:space:]])","endCaptures":{"0":{"name":"keyword.control"}}},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pattern"}]},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#term"}]}]},"bindTermArgs":{"patterns":[{"begin":"~|\\?","end":":|(?=[^[:space:]])","applyEndPatternLast":true,"beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]~|^~|[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)|(?<=\\))","endCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#comment"},{"begin":"\\((?!\\*)","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"begin":"(?<=\\()","end":":|=","endCaptures":{"0":{"name":"keyword"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}]},{"begin":"(?<=:)","end":"=|(?=\\))","endCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\))","patterns":[{"include":"#term"}]}]}]}]},{"include":"#pattern"}]},"bindType":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])\\+=|=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#pathType"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"entity.name.function strong"},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\+=|^\\+=|[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#bindConstructor"}]}]},"comment":{"patterns":[{"include":"#attribute"},{"include":"#extension"},{"include":"#commentBlock"},{"include":"#commentDoc"}]},"commentBlock":{"begin":"\\(\\*(?!\\*[^\\)])","end":"\\*\\)","name":"comment constant.regexp meta.separator.markdown","contentName":"emphasis","patterns":[{"include":"#commentBlock"},{"include":"#commentDoc"}]},"commentDoc":{"begin":"\\(\\*\\*","end":"\\*\\)","name":"comment constant.regexp meta.separator.markdown","patterns":[{"match":"\\*"},{"include":"#comment"}]},"decl":{"patterns":[{"include":"#declClass"},{"include":"#declException"},{"include":"#declInclude"},{"include":"#declModule"},{"include":"#declOpen"},{"include":"#declTerm"},{"include":"#declType"}]},"declClass":{"begin":"\\bclass\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"entity.name.class constant.numeric markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"begin":"(?:(?<=(?:[^[:word:]]class|^class))(?![[:word:]]))","end":"\\btype\\b|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|val)\\b)","beginCaptures":{"0":{"name":"entity.name.class constant.numeric markup.underline"}},"endCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#bindClassTerm"}]},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#bindClassType"}]}]},"declException":{"begin":"\\bexception\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"include":"#pragma"},{"include":"#bindConstructor"}]},"declInclude":{"begin":"\\binclude\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"include":"#pragma"},{"include":"#signature"}]},"declModule":{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))|\\bmodule\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"(\\btype\\b)|(?=[[:upper:]])","endCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"match":"\\brec\\b","name":"variable.other.class.js message.error variable.interpolation string.regexp"}]},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#bindSignature"}]},{"begin":"(?=[[:upper:]])","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#bindStructure"}]}]},"declOpen":{"begin":"\\bopen\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"include":"#pragma"},{"include":"#pathModuleExtended"}]},"declTerm":{"begin":"\\b(?:(external|val)|(method)|(let))\\b(!?)","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"1":{"name":"support.type markup.underline"},"2":{"name":"storage.type markup.underline"},"3":{"name":"keyword.control markup.underline"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#pragma"},{"include":"#bindTerm"},{"include":"#comment"}]},"declType":{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))|\\btype\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#bindType"}]},"extension":{"begin":"(\\[)((?|~$])%{1,3}(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\]","beginCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#attributePayload"}]},"literal":{"patterns":[{"include":"#termConstructor"},{"include":"#literalArray"},{"include":"#literalBoolean"},{"include":"#literalCharacter"},{"include":"#literalList"},{"include":"#literalNumber"},{"include":"#literalObjectTerm"},{"include":"#literalString"},{"include":"#literalRecord"},{"include":"#literalUnit"}]},"literalArray":{"begin":"\\[\\|","end":"\\|\\]","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#term"}]},"literalBoolean":{"match":"\\bfalse|true\\b","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"literalCharacter":{"begin":"(?|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"(:)|(=)|(;)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(=)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":";|(?=\\})","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#term"}]}]},"literalString":{"patterns":[{"begin":"\"","end":"\"","name":"string beginning.punctuation.definition.quote.markdown","patterns":[{"include":"#literalStringEscape"}]},{"begin":"(\\{)([_[:lower:]]*?)(\\|)","end":"(\\|)(\\2)(\\})","name":"string beginning.punctuation.definition.quote.markdown","patterns":[{"include":"#literalStringEscape"}]}]},"literalStringEscape":{"match":"\\\\(?:[\\\\\"ntbr]|[[:digit:]][[:digit:]][[:digit:]]|x[[:xdigit:]][[:xdigit:]]|o[0-3][0-7][0-7])"},"literalUnit":{"match":"\\(\\)","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"pathModuleExtended":{"patterns":[{"include":"#pathModulePrefixExtended"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"entity.name.class constant.numeric"}]},"pathModulePrefixExtended":{"begin":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.|$|\\()","end":"(?![[:space:]\\.]|$|\\()","beginCaptures":{"0":{"name":"entity.name.class constant.numeric"}},"patterns":[{"include":"#comment"},{"begin":"\\(","end":"\\)","captures":{"0":{"name":"keyword.control"}},"patterns":[{"match":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\)))","name":"string.other.link variable.language variable.parameter emphasis"},{"include":"#structure"}]},{"begin":"(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","end":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.|$))|((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*(?:$|\\()))|((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\)))|(?![[:space:]\\.[:upper:]]|$|\\()","beginCaptures":{"0":{"name":"keyword strong"}},"endCaptures":{"1":{"name":"entity.name.class constant.numeric"},"2":{"name":"entity.name.function strong"},"3":{"name":"string.other.link variable.language variable.parameter emphasis"}}}]},"pathModulePrefixExtendedParens":{"begin":"\\(","end":"\\)","captures":{"0":{"name":"keyword.control"}},"patterns":[{"match":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\)))","name":"string.other.link variable.language variable.parameter emphasis"},{"include":"#structure"}]},"pathModulePrefixSimple":{"begin":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.)","end":"(?![[:space:]\\.])","beginCaptures":{"0":{"name":"entity.name.class constant.numeric"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","end":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.))|((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*))|(?![[:space:]\\.[:upper:]])","beginCaptures":{"0":{"name":"keyword strong"}},"endCaptures":{"1":{"name":"entity.name.class constant.numeric"},"2":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}}}]},"pathModuleSimple":{"patterns":[{"include":"#pathModulePrefixSimple"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"entity.name.class constant.numeric"}]},"pathRecord":{"patterns":[{"begin":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","end":"(?=[^[:space:]\\.])(?!\\(\\*)","patterns":[{"include":"#comment"},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\.|^\\.))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","end":"((?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$]))|((?:(?!\\b(?:and|'|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|mutable|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(?<=\\))|(?<=\\])","beginCaptures":{"0":{"name":"keyword strong"}},"endCaptures":{"1":{"name":"keyword strong"},"2":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"begin":"\\((?!\\*)","end":"\\)","captures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#term"}]},{"begin":"\\[","end":"\\]","captures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pattern"}]}]}]}]},"pattern":{"patterns":[{"include":"#comment"},{"include":"#patternArray"},{"include":"#patternLazy"},{"include":"#patternList"},{"include":"#patternMisc"},{"include":"#patternModule"},{"include":"#patternRecord"},{"include":"#literal"},{"include":"#patternParens"},{"include":"#patternType"},{"include":"#variablePattern"},{"include":"#termOperator"}]},"patternArray":{"begin":"\\[\\|","end":"\\|\\]","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#pattern"}]},"patternLazy":{"match":"lazy","name":"variable.other.class.js message.error variable.interpolation string.regexp"},"patternList":{"begin":"\\[","end":"\\]","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#pattern"}]},"patternMisc":{"match":"((?|~$]),(?![#\\-:!?.@*/&%^+<=>|~$]))|([#\\-:!?.@*/&%^+<=>|~$]+)|\\b(as)\\b","captures":{"1":{"name":"string.regexp strong"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}}},"patternModule":{"begin":"\\bmodule\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#declModule"}]},"patternParens":{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}},"patterns":[{"include":"#type"}]},{"include":"#pattern"}]},"patternRecord":{"begin":"\\{","end":"\\}","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong strong"}},"patterns":[{"begin":"(?<=\\{|;)","end":"(:)|(=)|(;)|(with)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"(:)|(=)|(;)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(=)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":";|(?=\\})","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pattern"}]}]},"patternType":{"begin":"\\btype\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#declType"}]},"pragma":{"begin":"(?|~$])#(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#literalNumber"},{"include":"#literalString"}]},"signature":{"patterns":[{"include":"#comment"},{"include":"#signatureLiteral"},{"include":"#signatureFunctor"},{"include":"#pathModuleExtended"},{"include":"#signatureParens"},{"include":"#signatureRecovered"},{"include":"#signatureConstraints"}]},"signatureConstraints":{"begin":"\\bwith\\b","end":"(?=\\))|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"\\b(?:(module)|(type))\\b","endCaptures":{"1":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"},"2":{"name":"keyword"}}},{"include":"#declModule"},{"include":"#declType"}]},"signatureFunctor":{"patterns":[{"begin":"\\bfunctor\\b","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]functor|^functor))(?![[:word:]]))","end":"(\\(\\))|(\\((?!\\)))","endCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"punctuation.definition.tag"}}},{"begin":"(?<=\\()","end":"(:)|(\\))","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#variableModule"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\)","endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#signature"}]},{"begin":"(?<=\\))","end":"(\\()|((?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","endCaptures":{"1":{"name":"punctuation.definition.tag"},"2":{"name":"support.type strong"}}},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#signature"}]}]},{"match":"(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$])","name":"support.type strong"}]},"signatureLiteral":{"begin":"\\bsig\\b","end":"\\bend\\b","captures":{"0":{"name":"punctuation.definition.tag emphasis"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#decl"}]},"signatureParens":{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}},"patterns":[{"include":"#signature"}]},{"include":"#signature"}]},"signatureRecovered":{"patterns":[{"begin":"\\(|(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:|[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]include|^include|[^[:word:]]open|^open))(?![[:word:]]))","end":"\\bmodule\\b|(?!$|[[:space:]]|\\bmodule\\b)","endCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}}},{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"\\btype\\b","endCaptures":{"0":{"name":"keyword"}}},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"\\bof\\b","endCaptures":{"0":{"name":"punctuation.definition.tag"}}},{"begin":"(?:(?<=(?:[^[:word:]]of|^of))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#signature"}]}]}]},"structure":{"patterns":[{"include":"#comment"},{"include":"#structureLiteral"},{"include":"#structureFunctor"},{"include":"#pathModuleExtended"},{"include":"#structureParens"}]},"structureFunctor":{"patterns":[{"begin":"\\bfunctor\\b","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]functor|^functor))(?![[:word:]]))","end":"(\\(\\))|(\\((?!\\)))","endCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"punctuation.definition.tag"}}},{"begin":"(?<=\\()","end":"(:)|(\\))","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#variableModule"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\)","endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#signature"}]},{"begin":"(?<=\\))","end":"(\\()|((?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","endCaptures":{"1":{"name":"punctuation.definition.tag"},"2":{"name":"support.type strong"}}},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#structure"}]}]},{"match":"(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$])","name":"support.type strong"}]},"structureLiteral":{"begin":"\\bstruct\\b","end":"\\bend\\b","captures":{"0":{"name":"punctuation.definition.tag emphasis"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#decl"}]},"structureParens":{"begin":"\\(","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#structureUnpack"},{"include":"#structure"}]},"structureUnpack":{"begin":"\\bval\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}}},"term":{"patterns":[{"include":"#termLet"},{"include":"#termAtomic"}]},"termAtomic":{"patterns":[{"include":"#comment"},{"include":"#termConditional"},{"include":"#termConstructor"},{"include":"#termDelim"},{"include":"#termFor"},{"include":"#termFunction"},{"include":"#literal"},{"include":"#termMatch"},{"include":"#termMatchRule"},{"include":"#termPun"},{"include":"#termOperator"},{"include":"#termTry"},{"include":"#termWhile"},{"include":"#pathRecord"}]},"termConditional":{"match":"\\b(?:if|then|else)\\b","name":"keyword.control"},"termConstructor":{"patterns":[{"include":"#pathModulePrefixSimple"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}]},"termDelim":{"patterns":[{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#term"}]},{"begin":"\\bbegin\\b","end":"\\bend\\b","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#term"}]}]},"termFor":{"patterns":[{"begin":"\\bfor\\b","end":"\\bdone\\b","beginCaptures":{"0":{"name":"keyword.control"}},"endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]for|^for))(?![[:word:]]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#pattern"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\b(?:downto|to)\\b","endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},{"begin":"(?:(?<=(?:[^[:word:]]to|^to))(?![[:word:]]))","end":"\\bdo\\b","endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},{"begin":"(?:(?<=(?:[^[:word:]]do|^do))(?![[:word:]]))","end":"(?=\\bdone\\b)","patterns":[{"include":"#term"}]}]}]},"termFunction":{"match":"\\b(?:(fun)|(function))\\b","captures":{"1":{"name":"storage.type"},"2":{"name":"storage.type"}}},"termLet":{"patterns":[{"begin":"(?:(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=|[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?<=;|\\())(?=[[:space:]]|\\blet\\b)|(?:(?<=(?:[^[:word:]]begin|^begin|[^[:word:]]do|^do|[^[:word:]]else|^else|[^[:word:]]in|^in|[^[:word:]]struct|^struct|[^[:word:]]then|^then|[^[:word:]]try|^try))(?![[:word:]]))|(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]@@|^@@))(?![#\\-:!?.@*/&%^+<=>|~$]))[[:space:]]+","end":"\\b(?:(and)|(let))\\b|(?=[^[:space:]])(?!\\(\\*)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"storage.type markup.underline"}},"patterns":[{"include":"#comment"}]},{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]let|^let))(?![[:word:]]))|\\b(let)\\b","end":"\\b(?:(and)|(in))\\b|(?=\\}|\\)|\\]|\\b(?:end|class|exception|external|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"1":{"name":"storage.type markup.underline"}},"endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"storage.type markup.underline"}},"patterns":[{"include":"#bindTerm"}]}]},"termMatch":{"begin":"\\bmatch\\b","end":"\\bwith\\b","captures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},"termMatchRule":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]fun|^fun|[^[:word:]]function|^function|[^[:word:]]with|^with))(?![[:word:]]))","end":"(?|~$])(\\|)|(->)(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"1":{"name":"support.type strong"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#comment"},{"include":"#attributeIdentifier"},{"include":"#pattern"}]},{"begin":"(?:(?<=(?:[^\\[#\\-:!?.@*/&%^+<=>|~$]\\||^\\|))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?|~$])\\|(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?|~$])(\\|)|(->)(?![#\\-:!?.@*/&%^+<=>|~$])","beginCaptures":{"0":{"name":"support.type strong"}},"endCaptures":{"1":{"name":"support.type strong"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#pattern"},{"begin":"\\bwhen\\b","end":"(?=(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#term"}]}]}]},"termOperator":{"patterns":[{"begin":"(?|~$])#(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","beginCaptures":{"0":{"name":"keyword"}},"endCaptures":{"0":{"name":"entity.name.function"}}},{"match":"<-","captures":{"0":{"name":"keyword.control strong"}}},{"match":"(,|[#\\-:!?.@*/&%^+<=>|~$]+)|(;)","captures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}}},{"match":"\\b(?:and|assert|asr|land|lazy|lsr|lxor|mod|new|or)\\b","name":"variable.other.class.js message.error variable.interpolation string.regexp"}]},"termPun":{"begin":"(?|~$])\\?|~(?![#\\-:!?.@*/&%^+<=>|~$])","end":":|(?=[^[:space:]:])","applyEndPatternLast":true,"beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?|[^#\\-:!?.@*/&%^+<=>|~$]~|^~))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","endCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}}}]},"termTry":{"begin":"\\btry\\b","end":"\\bwith\\b","captures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},"termWhile":{"patterns":[{"begin":"\\bwhile\\b","end":"\\bdone\\b","beginCaptures":{"0":{"name":"keyword.control"}},"endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]while|^while))(?![[:word:]]))","end":"\\bdo\\b","endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},{"begin":"(?:(?<=(?:[^[:word:]]do|^do))(?![[:word:]]))","end":"(?=\\bdone\\b)","patterns":[{"include":"#term"}]}]}]},"type":{"patterns":[{"include":"#comment"},{"match":"\\bnonrec\\b","name":"variable.other.class.js message.error variable.interpolation string.regexp"},{"include":"#pathModulePrefixExtended"},{"include":"#typeLabel"},{"include":"#typeObject"},{"include":"#typeOperator"},{"include":"#typeParens"},{"include":"#typePolymorphicVariant"},{"include":"#typeRecord"},{"include":"#typeConstructor"}]},"typeConstructor":{"patterns":[{"begin":"(_)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(')((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(?<=[^\\*]\\)|\\])","end":"(?=\\((?!\\*)|\\*|:|,|=|\\.|>|-|\\{|\\[|\\+|\\}|\\)|\\]|;|\\|)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))[:space:]*(?!\\(\\*|[[:word:]])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"1":{"name":"comment constant.regexp meta.separator.markdown"},"3":{"name":"string.other.link variable.language variable.parameter emphasis strong emphasis"},"4":{"name":"keyword.control emphasis"}},"endCaptures":{"1":{"name":"entity.name.function strong"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixExtended"}]}]},"typeLabel":{"patterns":[{"begin":"(\\??)((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))[[:space:]]*((?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","captures":{"1":{"name":"keyword strong emphasis"},"2":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"},"3":{"name":"keyword"}},"patterns":[{"include":"#type"}]}]},"typeModule":{"begin":"\\bmodule\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#pathModuleExtended"},{"include":"#signatureConstraints"}]},"typeObject":{"begin":"<","end":">","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong strong"}},"patterns":[{"begin":"(?<=<|;)","end":"(:)|(?=>)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(?=>)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]}]},"typeOperator":{"patterns":[{"match":",|;|[#\\-:!?.@*/&%^+<=>|~$]+","name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}]},"typeParens":{"begin":"\\(","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"match":",","name":"variable.other.class.js message.error variable.interpolation string.regexp"},{"include":"#typeModule"},{"include":"#type"}]},"typePolymorphicVariant":{"begin":"\\[","end":"\\]","patterns":[]},"typeRecord":{"begin":"\\{","end":"\\}","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong strong"}},"patterns":[{"begin":"(?<=\\{|;)","end":"(:)|(=)|(;)|(with)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"(:)|(=)|(;)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(=)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":";|(?=\\})","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#type"}]}]},"variableModule":{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","captures":{"0":{"name":"string.other.link variable.language variable.parameter emphasis"}}},"variablePattern":{"match":"(\\b_\\b)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))","captures":{"1":{"name":"comment constant.regexp meta.separator.markdown"},"2":{"name":"string.other.link variable.language variable.parameter emphasis"}}}}} \ No newline at end of file diff --git a/editor-extensions/vscode/package-lock.json b/editor-extensions/vscode/package-lock.json deleted file mode 100644 index 877de6b4..00000000 --- a/editor-extensions/vscode/package-lock.json +++ /dev/null @@ -1,431 +0,0 @@ -{ - "name": "reason-vscode", - "version": "1.7.11", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true - }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dev": true, - "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "typescript": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.1.tgz", - "integrity": "sha512-Ao/f6d/4EPLq0YwzsQz8iXflezpTkQzqAyenTiw4kCUGr1uPiFLC3+fZ+gMZz6eeI/qdRUqvC+HxIJzUAzEFdg==", - "dev": true - }, - "vscode": { - "version": "1.1.37", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.37.tgz", - "integrity": "sha512-vJNj6IlN7IJPdMavlQa1KoFB3Ihn06q1AiN3ZFI/HfzPNzbKZWPPuiU+XkpNOfGU5k15m4r80nxNPlM7wcc0wg==", - "dev": true, - "requires": { - "glob": "^7.1.2", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "mocha": "^5.2.0", - "semver": "^5.4.1", - "source-map-support": "^0.5.0", - "vscode-test": "^0.4.1" - } - }, - "vscode-jsonrpc": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", - "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==", - "dev": true - }, - "vscode-languageclient": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.4.tgz", - "integrity": "sha512-EUOU+bJu6axmt0RFNo3nrglQLPXMfanbYViJee3Fbn2VuQoX0ZOI4uTYhSRvYLP2vfwTP/juV62P/mksCdTZMA==", - "dev": true, - "requires": { - "semver": "^6.3.0", - "vscode-languageserver-protocol": "3.15.3" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "vscode-languageserver-protocol": { - "version": "3.15.3", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz", - "integrity": "sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw==", - "dev": true, - "requires": { - "vscode-jsonrpc": "^5.0.1", - "vscode-languageserver-types": "3.15.1" - }, - "dependencies": { - "vscode-languageserver-types": { - "version": "3.15.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", - "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==", - "dev": true - } - } - }, - "vscode-languageserver-types": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", - "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==", - "dev": true - }, - "vscode-test": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.4.3.tgz", - "integrity": "sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w==", - "dev": true, - "requires": { - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1" - }, - "dependencies": { - "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "http-proxy-agent": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", - "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", - "dev": true, - "requires": { - "agent-base": "4", - "debug": "3.1.0" - } - }, - "https-proxy-agent": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", - "dev": true, - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - } - } -} diff --git a/editor-extensions/vscode/package.json b/editor-extensions/vscode/package.json deleted file mode 100644 index 803c39ab..00000000 --- a/editor-extensions/vscode/package.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "name": "reason-vscode", - "description": "IDE & Syntax support for Reason/OCaml", - "author": "Jared Forsyth", - "license": "ISC", - "version": "1.7.11", - "publisher": "jaredly", - "repository": { - "type": "git", - "url": "https://github.com/jaredly/reason-language-server" - }, - "engines": { - "vscode": "^1.43.0" - }, - "categories": [ - "Other" - ], - "icon": "logo.png", - "activationEvents": [ - "onLanguage:reason", - "onLanguage:ocaml", - "onLanguage:bucklescript" - ], - "main": "./src/index", - "contributes": { - "commands": [ - { - "command": "reason-language-server.restart", - "title": "Restart Reason Language Server" - } - ], - "snippets": [ - { - "language": "reason", - "path": "./snippets/snippets.json" - } - ], - "configuration": { - "type": "object", - "title": "Reason Language Server", - "properties": { - "reason_language_server.location": { - "type": "string", - "description": "Provide a custom location for the language server binary" - }, - "reason_language_server.build_system_override_by_root": { - "type": "object", - "additionalProperties": { - "type": "string", - "enum": [ - "bsb:4.0.7", - "dune:esy", - "dune:opam:/abs/path/to/switch", - "bsb-native:4.0.7:js", - "bsb-native:4.0.7:bytecode", - "bsb-native:4.0.7:native" - ] - }, - "description": "Only specify this if build system autodetection isn't working for you (for example if you have a bsconfig.json, and a dune file in the same project). The keys in this object should be in uri format, e.g. file:///some/path/here" - }, - "reason_language_server.mlfmt": { - "type": "string", - "description": "Provide a location for an .ml/.mli formatter" - }, - "reason_language_server.reloadOnChange": { - "type": "boolean", - "default": false, - "description": "Monitor the language server binary for updates, and restart it (for development)." - }, - "reason_language_server.show_debug_errors": { - "type": "boolean", - "default": false, - "description": "Show errors in the console" - } - } - }, - "grammars": [ - { - "language": "ocaml", - "scopeName": "source.ocaml", - "path": "./ocaml.json" - }, - { - "language": "reason", - "scopeName": "source.reason", - "path": "./reason.json" - }, - { - "scopeName": "markdown.reason.codeblock", - "path": "./reason-markdown-codeblock.json", - "injectTo": [ - "text.html.markdown" - ], - "embeddedLanguages": { - "meta.embedded.block.reason": "reason" - } - }, - { - "language": "bucklescript", - "scopeName": "source.bucklescript", - "path": "./bucklescript.json" - } - ], - "languages": [ - { - "id": "reason", - "aliases": [ - "Reason" - ], - "extensions": [ - ".re", - ".rei" - ], - "configuration": "./reason.configuration.json" - }, - { - "id": "ocaml", - "aliases": [ - "OCaml" - ], - "extensions": [ - ".ml", - ".mli" - ], - "configuration": "./ocaml.configuration.json" - }, - { - "id": "bucklescript", - "aliases": [ - "BuckleScript" - ], - "extensions": [ - ".res", - ".resi" - ], - "configuration": "./bucklescript.configuration.json" - } - ] - }, - "scripts": { - "postinstall": "node ./node_modules/vscode/bin/install", - "build-syntaxes": "tsc -p src/syntaxes && node script/syntax.js" - }, - "devDependencies": { - "vscode": "^1.1.17", - "vscode-languageclient": "^6.1.3", - "vscode-languageserver-types": "^3.14.0", - "typescript": "^2.8.1" - } -} diff --git a/editor-extensions/vscode/reason-markdown-codeblock.json b/editor-extensions/vscode/reason-markdown-codeblock.json deleted file mode 100644 index 46ad0a6e..00000000 --- a/editor-extensions/vscode/reason-markdown-codeblock.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "fileTypes": [], - "injectionSelector": "L:text.html.markdown", - "patterns": [ - { - "include": "#reason-code-block" - } - ], - "repository": { - "reason-code-block": { - "name": "markup.fenced_code.block.markdown", - "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(re|reason|reasonml)(\\s+[^`~]*)?$)", - "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", - "beginCaptures": { - "3": { - "name": "punctuation.definition.markdown" - }, - "5": { - "name": "fenced_code.block.language" - }, - "6": { - "name": "fenced_code.block.language.attributes" - } - }, - "endCaptures": { - "3": { - "name": "punctuation.definition.markdown" - } - }, - "patterns": [ - { - "begin": "(^|\\G)(\\s*)(.*)", - "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", - "contentName": "meta.embedded.block.reason", - "patterns": [ - { - "include": "source.reason" - } - ] - } - ] - } - }, - "scopeName": "markdown.reason.codeblock" -} diff --git a/editor-extensions/vscode/reason.configuration.json b/editor-extensions/vscode/reason.configuration.json deleted file mode 100644 index 107cbfe9..00000000 --- a/editor-extensions/vscode/reason.configuration.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "autoClosingPairs": [ - { "open": "{", "close": "}" }, - { "open": "[", "close": "]" }, - { "open": "(", "close": ")" }, - { "open": "\"", "close": "\"", "notIn": [ "string" ] }, - { "open": "/**", "close": " */", "notIn": [ "string" ] } - ], - "brackets": [ - [ "{", "}" ], - [ "[", "]" ], - [ "(", ")" ] - ], - "comments": { - "lineComment": "//", - "blockComment": [ "/*", "*/" ] - }, - "surroundingPairs": [ - [ "{", "}" ], - [ "[", "]" ], - [ "(", ")" ], - [ "'", "'" ], - [ "\"", "\"" ], - [ "`", "`" ] - ] -} diff --git a/editor-extensions/vscode/reason.json b/editor-extensions/vscode/reason.json deleted file mode 100644 index 8474ba04..00000000 --- a/editor-extensions/vscode/reason.json +++ /dev/null @@ -1,2264 +0,0 @@ -{ - "name": "Reason", - "scopeName": "source.reason", - "fileTypes": [ - "re", - "rei" - ], - "patterns": [ - { "include": "#structure-expression-block-item" }, - { "include": "#value-expression" } - ], - "repository": { - "attribute": { - "begin": "(?=\\[(@{1,3})[[:space:]]*[[:alpha:]])", - "end": "\\]", - "patterns": [ - { - "begin": "\\[(@{1,3})", - "end": "(?=[^_\\.'[:word:]])", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#attribute-identifier" } - ] - }, - { "include": "#attribute-payload" } - ] - }, - "attribute-identifier": { - "patterns": [ - { - "match": "\\b([[:alpha:]][[:word:]]*)\\b[[:space:]]*(?:(\\.))", - "captures": { - "1": { "name": "support.class entity.name.class" }, - "2": { "name": "keyword.control.less" } - } - }, - { - "match": "\\b([[:alpha:]][[:word:]]*)\\b", - "name": "entity.other.attribute-name.css constant.language constant.numeric" - } - ] - }, - "attribute-payload": { - "patterns": [ - { - "begin": "(:)", - "end": "(?=\\])", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#structure-expression" }, - { "include": "#module-item-type" }, - { "include": "#type-expression" } - ] - }, - { - "begin": "([\\?])", - "end": "(?=\\])", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#pattern-guard" }, - { "include": "#pattern" } - ] - }, - { "include": "#structure-expression-block-item" }, - { "include": "#value-expression" } - ] - }, - "class-item-inherit": { - "begin": "\\b(inherit)\\b", - "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.other" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#value-expression" } - ] - }, - "class-item-method": { - "begin": "\\b(method)\\b", - "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "storage.type" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-let-value-bind-name-params-type-body" } - ] - }, - "comment": { - "name": "comment", - "patterns": [ - { "include": "#comment-line" }, - { "include": "#comment-block-doc" }, - { "include": "#comment-block" } - ] - }, - "comment-line": { - "name": "comment.line", - "begin": "(^[ \\t]+)?((//))", - "end": "(?=^)" - }, - "comment-block": { - "begin": "/\\*", - "end": "\\*/", - "name": "comment.block", - "patterns": [ - { "include": "#comment-block-doc" }, - { "include": "#comment-block" } - ] - }, - "comment-block-doc": { - "begin": "/\\*\\*(?!/)", - "end": "\\*/", - "name": "comment.block.documentation", - "patterns": [ - { "include": "#comment-block-doc" }, - { "include": "#comment-block" } - ] - }, - "condition-lhs": { - "begin": "(?|~$\\\\])([\\?])(?![#\\-:!?.@*/&%^+<=>|~$\\\\])", - "end": "(?=[\\)])", - "beginCaptures": { - "1": { "name": "keyword.control message.error variable.interpolation" } - }, - "patterns": [ - { - "match": "(?:\\b|[[:space:]]+)([?])(?:\\b|[[:space:]]+)", - "name": "keyword.control message.error variable.interpolation" - }, - { "include": "#value-expression" } - ] - }, - "extension-node": { - "begin": "(?=\\[(%{1,3})[[:space:]]*[[:alpha:]])", - "end": "\\]", - "patterns": [ - { - "begin": "\\[(%{1,3})", - "end": "(?=[^_\\.'[:word:]])", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#attribute-identifier" } - ] - }, - { "include": "#attribute-payload" } - ] - }, - "jsx": { - "patterns": [ - { "include": "#jsx-head" }, - { "include": "#jsx-tail" } - ] - }, - "jsx-attributes": { - "patterns": [ - { - "begin": "\\b([[:lower:]][[:word:]]*)\\b[[:space:]]*(=)", - "end": "(?[:lower:]])", - "comment": "meta.separator", - "beginCaptures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, - "2": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#value-expression-atomic-with-paths" } - ] - }, - { - "match": "(\\b([[:lower:]][[:word:]]*)\\b[[:space:]]*+)", - "captures": { - "1": { "comment": "meta.separator" }, - "2": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } - } - } - ] - }, - "jsx-body": { - "begin": "((>))", - "end": "(?=))|(?=])[[:space:]]*+", - "comment": "meta.separator", - "patterns": [ - { "include": "#module-path-simple" }, - { - "match": "\\b[[:lower:]][[:word:]]*\\b", - "name": "entity.name.tag.inline.any.html" - } - ] - }, - { "include": "#jsx-attributes" }, - { "include": "#jsx-body" }, - { "include": "#comment" } - ] - }, - "jsx-tail": { - "begin": "\\G(/>)|()", - "applyEndPatternLast": true, - "comment": "meta.separator", - "beginCaptures": { - "1": { "name": "punctuation.definition.tag.end.js" }, - "2": { "name": "punctuation.definition.tag.begin.js" } - }, - "endCaptures": { - "1": { "name": "punctuation.definition.tag.end.js" } - }, - "patterns": [ - { "include": "#module-path-simple" }, - { - "match": "\\b[[:lower:]][[:word:]]*\\b", - "name": "entity.name.tag.inline.any.html" - } - ] - }, - "module-name-extended": { - "patterns": [ - { "include": "#module-name-simple" }, - { - "begin": "([\\(])", - "end": "([\\)])", - "captures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#module-path-extended" } - ] - } - ] - }, - "module-name-simple": { - "match": "\\b[[:upper:]][[:word:]]*\\b", - "name": "support.class entity.name.class" - }, - "module-path-extended": { - "patterns": [ - { "include": "#module-name-extended" }, - { "include": "#comment" }, - { - "comment": "NOTE: end early to avoid too much reparsing", - "begin": "([\\.])", - "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { - "begin": "(?<=[\\.])", - "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", - "patterns": [ - { "include": "#comment" }, - { "include": "#module-name-extended" } - ] - } - ] - } - ] - }, - "module-path-extended-prefix": { - "begin": "(?=\\b[[:upper:]])", - "end": "([\\.])|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-path-extended" } - ] - }, - "module-path-simple": { - "patterns": [ - { "include": "#module-name-simple" }, - { "include": "#comment" }, - { - "comment": "NOTE: end early to avoid too much reparsing", - "begin": "([\\.])", - "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { - "begin": "(?<=[\\.])", - "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", - "patterns": [ - { "include": "#comment" }, - { "include": "#module-name-simple" } - ] - } - ] - } - ] - }, - "module-path-simple-prefix": { - "begin": "(?=\\b[[:upper:]])", - "end": "([\\.])|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-path-simple" } - ] - }, - "module-item-class-type": { - "comment": "FIXME: proper parsing", - "begin": "\\b(class)\\b", - "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.other" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { - "begin": "(?:\\G|^)[[:space:]]*\\b(type)\\b", - "end": "(?==)", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#module-item-type-bind-name-tyvars" } - ] - }, - { - "begin": "(=)", - "end": "(?=;)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#attribute" }, - { "include": "#comment" }, - { "include": "#class-item-inherit" }, - { "include": "#class-item-method" } - ] - } - ] - }, - "module-item-exception": { - "begin": "\\b(exception)\\b", - "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.other" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-type-bind-body-item" } - ] - }, - "module-item-external": { - "begin": "\\b(external)\\b", - "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "storage.type" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-let-value-bind-name-or-pattern" }, - { "include": "#module-item-let-value-bind-type" }, - { - "begin": "(=)", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#attribute" }, - { - "begin": "\"", - "end": "\"", - "name": "string.double string.regexp", - "patterns": [ - { "include": "#value-literal-string-escape" }, - { - "match": "(?:(%)(.*?)|(caml.*?))(?=\"|(?:[^\\\\\\n]$))", - "captures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" }, - "2": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error"} - } - } - ] - } - ] - } - ] - }, - "module-item-include": { - "begin": "\\b(include)\\b", - "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.include" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#signature-expression" } - ] - }, - "module-item-let": { - "begin": "\\b(let)((%)([[:word:]\\.]+))?\\b", - "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "storage.type" }, - "3": { "name": "keyword.control.less" }, - "4": { "name": "entity.name.class" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-let-module" }, - { "include": "#module-item-let-value" } - ] - }, - "module-item-let-module": { - "begin": "(?:\\G|^)[[:space:]]*\\b(module)\\b", - "end": "(?=[;}]|\\b(class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.control storage.type message.error" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#module-item-let-module-and" }, - { "include": "#module-item-let-module-rec" }, - { "include": "#module-item-let-module-bind-name-params-type-body" } - ] - }, - "module-item-let-module-and": { - "begin": "\\b(and)\\b", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "storage.type" } - }, - "patterns": [ - { "include": "#module-item-let-module-bind-name-params-type-body" } - ] - }, - "module-item-let-module-bind-body": { - "begin": "(=>?)", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#structure-expression" } - ] - }, - "module-item-let-module-bind-name-params": { - "begin": "\\b([[:upper:]][[:word:]]*)\\b", - "end": "(?=[;:}=]|\\b(class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "support.class entity.name.class" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#module-item-let-module-param" } - ] - }, - "module-item-let-module-bind-name-params-type-body": { - "begin": "(?:\\G|^)", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { "include": "#comment" }, - { "include": "#module-item-let-module-bind-name-params" }, - { "include": "#module-item-let-module-bind-type" }, - { "include": "#module-item-let-module-bind-body" } - ] - }, - "module-item-let-module-bind-type": { - "begin": "(:)", - "end": "(?=[;}=]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#signature-expression" } - ] - }, - "module-item-let-module-param": { - "begin": "(?=\\()", - "end": "\\)", - "patterns": [ - { - "begin": "\\(", - "end": "(?=[:])", - "patterns": [ - { "include": "#comment" }, - { "include": "#module-name-simple" } - ] - }, - { - "begin": "(:)", - "end": "(?=\\))", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#signature-expression" } - ] - } - ] - }, - "module-item-let-module-rec": { - "begin": "(?:\\G|^)[[:space:]]*\\b(rec)\\b", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control storage.modifier.rec" } - }, - "patterns": [ - { "include": "#module-item-let-module-bind-name-params-type-body" } - ] - }, - "module-item-let-value": { - "patterns": [ - { "include": "#module-item-let-value-and" }, - { "include": "#module-item-let-value-rec" }, - { "include": "#module-item-let-value-bind-name-params-type-body" } - ] - }, - "module-item-let-value-and": { - "begin": "\\b(and)\\b", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "storage.type" } - }, - "patterns": [ - { "include": "#module-item-let-value-bind-name-params-type-body" } - ] - }, - "module-item-let-value-bind-body": { - "begin": "(=>?)", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#value-expression" } - ] - }, - "module-item-let-value-bind-name-or-pattern": { - "end": "(?<=[^[:space:]])|(?=[[:space:]]|[;:}=]|\\b(and|as|class|constraint|exception|external|for|include|inherit|let|method|module|nonrec|open|private|rec|switch|try|type|val|while|with)\\b)", - "patterns": [ - { "include": "#comment" }, - { - "match": "\\b(?:([_][[:word:]]+)|([[:lower:]][[:word:]]*))\\b", - "captures": { - "1": { "name": "comment" }, - "2": { "name": "entity.name.function" } - } - }, - { "include": "#module-item-let-value-bind-parens-params" }, - { "include": "#pattern" } - ] - }, - "module-item-let-value-bind-name-params-type-body": { - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { "include": "#module-item-let-value-bind-name-or-pattern" }, - { "include": "#module-item-let-value-bind-params-type" }, - { "include": "#module-item-let-value-bind-type" }, - { "include": "#module-item-let-value-bind-body" } - ] - }, - "module-item-let-value-bind-params-type": { - "begin": "(?=[^[:space:]:=])", - "end": "(?=[;}=]|\\b(class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { "include": "#comment" }, - { "include": "#module-item-let-value-param" }, - { - "begin": "(?]|[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { - "begin": "\\b(type)\\b", - "end": "([\\.])", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "endCaptures": { - "1": { "name": "entity.name.function" } - }, - "patterns": [ - { "include": "#pattern-variable" } - ] - }, - { "include": "#type-expression" } - ] - }, - "module-item-let-value-param": { - "patterns": [ - { "include": "#module-item-let-value-param-label" }, - { "include": "#module-item-let-value-param-type" }, - { "include": "#module-item-let-value-param-module" }, - { "include": "#pattern" } - ] - }, - "module-item-let-value-param-label": { - "patterns": [ - { - "begin": "(\\b[[:lower:]][[:word:]]*\\b)?[[:space:]]*(::)", - "end": "(?<=[[:space:]])", - "beginCaptures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, - "2": { "name": "keyword.control" } - }, - "patterns": [ - { "include": "#pattern" }, - { - "begin": "(=)", - "end": "(\\?)|(?<=[^[:space:]=][[:space:]])(?=[[:space:]]*+[^\\.])", - "beginCaptures": { - "1": { "name": "markup.inserted keyword.control.less message.error" } - }, - "endCaptures": { - "1": { "name": "storage.type" } - }, - "patterns": [ - { "include": "#value-expression-atomic-with-paths" } - ] - } - ] - } - ] - }, - "module-item-let-value-param-module": { - "comment": "FIXME: merge with pattern-parens", - "begin": "\\([[:space:]]*(?=\\b(module)\\b)", - "end": "\\)", - "patterns": [ - { - "begin": "\\b(module)\\b", - "end": "(?=\\))", - "beginCaptures": { - "1": { "name": "keyword.other message.error" } - }, - "patterns": [ - { - "match": "\\b[[:upper:]][[:word:]]*\\b", - "name": "support.class entity.name.class" - } - ] - } - ] - }, - "module-item-let-value-param-type": { - "comment": "FIXME: merge with pattern-parens", - "begin": "\\((?=\\b(type)\\b)", - "end": "\\)", - "patterns": [ - { - "begin": "\\b(type)\\b", - "end": "(?=\\))", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#pattern-variable" } - ] - } - ] - }, - "module-item-let-value-rec": { - "begin": "(?:\\G|^)[[:space:]]*\\b(rec)\\b", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control storage.modifier message.error" } - }, - "patterns": [ - { "include": "#module-item-let-value-bind-name-params-type-body" } - ] - }, - "module-item-module": { - "comment": "NOTE: this is to support the let-module case without the let prefix", - "begin": "\\b(module)\\b[[:space:]]*(?!\\b(type)\\b|$)", - "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "storage.type message.error" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-let-module-and" }, - { "include": "#module-item-let-module-rec" }, - { "include": "#module-item-let-module-bind-name-params-type-body" } - ] - }, - "module-item-module-type": { - "begin": "\\b(module)\\b[[:space:]]*(?=\\b(type)\\b|$)", - "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control message.error" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { - "begin": "(?:\\G|^)[[:space:]]*\\b(type)\\b", - "end": "(?==)", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#comment" }, - { - "match": "([[:upper:]][[:word:]]*)", - "captures": { - "1": { "name": "support.class entity.name.class" } - } - } - ] - }, - { - "begin": "(=)", - "end": "(?=;)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#signature-expression" } - ] - } - ] - }, - "module-item-open": { - "begin": "\\b(open)\\b", - "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.open" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#module-path-simple" } - ] - }, - "module-item-type": { - "comment": "FIXME: the semi-colon is optional so we can re-use this for hover, which does not print the trailing ;", - "begin": "\\b(type)\\b", - "end": "(;)|(?=[\\)}]|\\b(class|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.other" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-type-and" }, - { "include": "#module-item-type-constraint" }, - { "include": "#module-item-type-bind" } - ] - }, - "module-item-type-and": { - "comment": "FIXME: the optional `type` is for module constraints", - "begin": "\\b(and)\\b([[:space:]]*type)?", - "end": "(?=[;\\)}]|\\b(class|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.other" }, - "2": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#module-item-type-bind-name-tyvars-body" } - ] - }, - "module-item-type-bind": { - "comment": "FIXME: only allow module paths before type variables", - "patterns": [ - { "include": "#module-item-type-bind-nonrec" }, - { "include": "#module-item-type-bind-name-tyvars-body" } - ] - }, - "module-item-type-bind-body": { - "comment": "FIXME: parsing", - "begin": "(\\+?=)", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#module-item-type-bind-body-item" } - ] - }, - "module-item-type-bind-body-item": { - "patterns": [ - { - "match": "(=)(?!>)|\\b(private)\\b", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } - } - }, - { - "comment": "FIXME: specialized version of variant rule that also scans for (", - "match": "\\b([[:upper:]][[:word:]]*)\\b(?![[:space:]]*[\\.\\(])", - "captures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - } - }, - { - "begin": "(\\.\\.)", - "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - } - }, - { - "begin": "(\\|)(?![#\\-:!?.@*/&%^+<=>|~$\\\\])[[:space:]]*", - "end": "(?=[;\\)}]|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\])|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#value-expression-constructor" }, - { - "match": "([:])|\\b(of)\\b", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "keyword.other" } - } - }, - { "include": "#type-expression" } - ] - }, - { - "comment": "FIXME: remove this once the pretty printer no longer outputs 'of'", - "match": "(:)|(\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|\\b(of)\\b", - "captures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "2": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "3": { "name": "keyword.other" } - } - }, - { "include": "#type-expression" } - ] - }, - "module-item-type-bind-name-tyvars": { - "begin": "(?<=\\G|^|\\.)[[:space:]]*\\b([[:lower:]][[:word:]]*)\\b", - "end": "(?=\\+?=|[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "entity.name.function" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#attribute" }, - { - "match": "_", - "name": "comment" - }, - { - "comment": "FIXME: add separate type-variable rule", - "match": "([+\\-])?(?:(_)|(')([[:lower:]][[:word:]]*)\\b)(?!\\.[[:upper:]])", - "captures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "2": { "name": "comment" }, - "3": { "name": "comment" }, - "4": { "name": "variable.parameter string.other.link variable.language" } - } - } - ] - }, - "module-item-type-bind-name-tyvars-body": { - "begin": "(?=(\\G|^)[[:space:]]*\\b[[:alpha:]])", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { "include": "#module-path-simple-prefix" }, - { "include": "#module-item-type-bind-name-tyvars" }, - { "include": "#module-item-type-bind-body" } - ] - }, - "module-item-type-bind-nonrec": { - "begin": "(?:\\G|^)[[:space:]]*\\b(nonrec)\\b", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control storage.modifier message.error" } - }, - "patterns": [ - { "include": "#module-item-type-bind-name-tyvars-body" } - ] - }, - "module-item-type-constraint": { - "comment": "FIXME: proper parsing", - "begin": "\\b(constraint)\\b", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } - }, - "patterns": [ - { - "comment": "FIXME: add separate type-variable rule", - "match": "([+\\-])?(')([_[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", - "captures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "2": { "name": "comment" }, - "3": { "name": "variable.parameter string.other.link variable.language" } - } - }, - { - "match": "=", - "name": "keyword.control.less" - }, - { "include": "#type-expression" } - ] - }, - "object-item": { - "begin": "\\G|(;)", - "end": "(?=[;}]|\\b(class|constraint|exception|external|include|let|module|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#class-item-method" } - ] - }, - "operator": { - "patterns": [ - { "include": "#operator-infix" }, - { "include": "#operator-prefix" } - ] - }, - "operator-infix": { - "patterns": [ - { - "match": ";", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" - }, - { "include": "#operator-infix-assign" }, - { "include": "#operator-infix-builtin" }, - { "include": "#operator-infix-custom" }, - { "comment": "#operator-infix-custom-hash" } - ] - }, - "operator-infix-assign": { - "match": "(?|~$\\\\])(=)(?![#\\-:!?.@*/&%^+<=>|~$\\\\])", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control.less message.error" - }, - "operator-infix-builtin": { - "match": ":=", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control.less message.error" - }, - "operator-infix-custom": { - "match": "(?:(?|~$\\\\])((<>))(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|([#\\-@*/&%^+<=>$\\\\][#\\-:!?.@*/&%^+<=>|~$\\\\]*|[|][#\\-:!?.@*/&%^+<=>|~$\\\\]+)", - "captures": { - "1": { "comment": "meta.separator" }, - "2": { "name": "punctuation.definition.tag.begin.js" }, - "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - } - }, - "operator-infix-custom-hash": { - "match": "#[\\-:!?.@*/&%^+<=>|~$]+", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" - }, - "operator-prefix": { - "patterns": [ - { "include": "#operator-prefix-bang" }, - { "include": "#operator-prefix-label-token" } - ] - }, - "operator-prefix-bang": { - "match": "![\\-:!?.@*/&%^+<=>|~$]*", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" - }, - "operator-prefix-label-token": { - "match": "[?~][\\-:!?.@*/&%^+<=>|~$]+", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" - }, - "pattern": { - "patterns": [ - { "include": "#attribute" }, - { "include": "#comment" }, - { "include": "#pattern-atomic" }, - { - "match": "[[:space:]]*+(?:(\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|\\b(as)\\b|(\\.\\.\\.?))[[:space:]]*+", - "captures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "2": { "name": "keyword.other" }, - "3": { "name": "keyword.control" } - } - } - ] - }, - "pattern-atomic": { - "patterns": [ - { - "match": "\\b(exception)\\b", - "name": "keyword.other" - }, - { "include": "#value-expression-literal" }, - { "include": "#module-path-simple-prefix" }, - { "include": "#pattern-list-or-array" }, - { "include": "#pattern-record" }, - { "include": "#pattern-variable" }, - { "include": "#pattern-parens" } - ] - }, - "pattern-guard": { - "begin": "\\b(when)\\b", - "end": "(?==>)", - "beginCaptures": { - "1": { "name": "keyword.other" } - }, - "patterns": [ - { "include": "#value-expression" } - ] - }, - "pattern-list-or-array": { - "begin": "(\\[\\|?)(?![@%])", - "end": "(\\|?\\])", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "endCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#value-expression-literal-list-or-array-separator" }, - { "include": "#pattern" } - ] - }, - "pattern-parens": { - "begin": "(?=\\()", - "end": "\\)|(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { "include": "#pattern-parens-lhs" }, - { "include": "#type-annotation-rhs" } - ] - }, - "pattern-parens-lhs": { - "begin": "\\(|(,)", - "end": "(?=(?:[,:\\)]))|(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#pattern" } - ] - }, - "record-path": { - "begin": "\\b[[:lower:]][[:word:]]*\\b", - "end": "(?=[^[:space:]\\.])(?!/\\*)", - "patterns": [ - { "include": "#comment" }, - { "include": "#record-path-suffix" } - ] - }, - "record-path-suffix": { - "begin": "(\\.)", - "end": "(\\))|\\b([[:upper:]][[:word:]]*)\\b|\\b([[:lower:]][[:word:]]*)\\b|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "endCaptures": { - "1": { "name": "keyword.control" }, - "2": { "name": "support.class entity.name.class" }, - "3": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } - }, - "patterns": [ - { "include": "#comment" }, - { - "begin": "([\\(])", - "end": "(?=[\\)])", - "beginCaptures": { - "1": { "name": "keyword.control" } - }, - "patterns": [ - { "include": "#comment" }, - { - "match": "\\b([[:lower:]][[:word:]]*)\\b(?=[^\\)]*([\\.]))", - "captures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, - "2": { "name": "keyword.other" } - } - }, - { - "match": "([\\.])", - "name": "keyword.control.less" - }, - { - "match": "\\b([[:lower:]][[:word:]]*)\\b[[:space:]]*", - "captures": { - "1": { "name": "variable.parameter string.other.link variable.language" } - } - }, - { "include": "#value-expression" } - ] - } - ] - }, - "pattern-record": { - "begin": "{", - "end": "}", - "patterns": [ - { "include": "#comment" }, - { "include": "#pattern-record-item" } - ] - }, - "pattern-record-field": { - "begin": "\\b([_][[:word:]]*)\\b|\\b([[:lower:]][[:word:]]*)\\b", - "end": "(,)|(?=})", - "beginCaptures": { - "1": { "name": "comment" }, - "2": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#comment" }, - { - "begin": "\\G(:)", - "end": "(?=[,}])", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#pattern" } - ] - } - ] - }, - "pattern-record-item": { - "patterns": [ - { "include": "#module-path-simple-prefix" }, - { "include": "#pattern-record-field" } - ] - }, - "pattern-variable": { - "patterns": [ - { - "match": "\\b(_(?:[[:lower:]][[:word:]]*)?)\\b(?!\\.[[:upper:]])", - "captures": { - "1": { "name": "comment" } - } - }, - { - "match": "\\b([[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", - "captures": { - "1": { "name": "variable.language string.other.link" } - } - } - ] - }, - "signature-expression": { - "patterns": [ - { - "comment": "FIXME: scan for :upper: to disambiguate type/signature in hover", - "begin": "(?=\\([[:space:]]*[[:upper:]][[:word:]]*[[:space:]]*:)", - "end": "(?=[;])", - "patterns": [ - { - "begin": "(?=\\()", - "end": "(?=[;]|=>)", - "patterns": [ - { "include": "#module-item-let-module-param" } - ] - }, - { - "begin": "(=>)", - "end": "(?=[;\\(])", - "beginCaptures": { - "1": { "name": "markup.inserted keyword.control.less" } - }, - "patterns": [ - { "include": "#structure-expression" } - ] - } - ] - }, - { - "begin": "\\b(module)\\b[[:space:]]*\\b(type)\\b([[:space:]]*\\b(of)\\b)?", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "markup.inserted keyword.other variable.other.readwrite.instance" }, - "2": { "name": "entity.other.attribute-name.css constant.language constant.numeric" }, - "3": { "name": "markup.inserted keyword.other variable.other.readwrite.instance" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#module-path-simple" }, - { - "match": "\\b([[:upper:]][[:word:]]*)\\b", - "name": "support.class entity.name.class" - } - ] - }, - { "include": "#signature-expression-constraints" }, - { "include": "#structure-expression" } - ] - }, - "signature-expression-constraints": { - "begin": "(?=\\b(with))", - "end": "(?=[;\\)}]|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val)\\b)", - "patterns": [ - { - "begin": "\\b(and|with)\\b", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } - }, - "patterns": [ - { "include": "#comment" }, - { - "comment": "FIXME: special version of #module-item-type with non-consuming `;`. Atom seems to need this to work.", - "begin": "\\b(type)\\b", - "end": "(?=[;\\)}]|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val|with)\\b)", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - }, - "patterns": [ - { "include": "#module-item-type-and" }, - { "include": "#module-item-type-constraint" }, - { "include": "#module-item-type-bind" } - ] - }, - { - "begin": "(?=\\b(module)\\b)", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val|with)\\b)", - "patterns": [ - { - "begin": "\\b(module)\\b", - "end": "(?=:?=|[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "markup.inserted keyword.control storage.type variable.other.readwrite.instance" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#module-path-simple" }, - { - "match": "[[:upper:]][[:word:]]*", - "name": "support.class entity.name.class" - } - ] - }, - { - "begin": "(:=)|(=)", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "markup.inserted keyword.control.less message.error" }, - "2": { "name": "markup.inserted keyword.control.less" } - }, - "patterns": [ - { "include": "#structure-expression" } - ] - } - ] - } - ] - } - ] - }, - "structure-expression": { - "patterns": [ - { "include": "#comment" }, - { - "comment": "FIXME: scan for :upper: or `val` to disambiguate types from signatures for hover", - "begin": "\\((?=[[:space:]]*(\\b(val)\\b|[^'\\[<[:lower:]]))", - "end": "\\)|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|with)\\b)", - "patterns": [ - { "include": "#comment" }, - { - "comment": "FIXME: might need to refactor this or include more expressions", - "include": "#structure-expression-block" - }, - { - "begin": "\\b(val)\\b", - "end": "(?=\\))|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.other" } - }, - "patterns": [ - { "include": "#comment" }, - { - "match": "\\b([[:lower:]][[:word:]]*)\\b", - "name": "support.class entity.name.class" - } - ] - }, - { "include": "#module-path-simple" }, - { - "begin": "(:)", - "end": "(?=[\\)])|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#signature-expression" } - ] - } - ] - }, - { "include": "#module-path-simple" }, - { "include": "#structure-expression-block" } - ] - }, - "structure-expression-block": { - "begin": "{", - "end": "}", - "patterns": [ - { "include": "#structure-expression-block-item" } - ] - }, - "structure-expression-block-item": { - "patterns": [ - { "include": "#attribute" }, - { "include": "#comment" }, - { "include": "#module-item-exception" }, - { "include": "#module-item-external" }, - { "include": "#module-item-include" }, - { "include": "#module-item-let" }, - { "include": "#module-item-class-type" }, - { "include": "#module-item-module-type" }, - { "include": "#module-item-module" }, - { "include": "#module-item-open" }, - { "include": "#module-item-type" } - ] - }, - "type-annotation-rhs": { - "begin": "(?|~$\\\\])([:])(?![#\\-:!?.@*/&%^+<=>|~$\\\\])", - "end": "(?=\\))|(?=[,;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#type-expression" } - ] - }, - "type-expression": { - "patterns": [ - { - "match": "([\\.])", - "name": "entity.name.function" - }, - { "include": "#type-expression-atomic" }, - { "include": "#type-expression-arrow" } - ] - }, - "type-expression-atomic": { - "patterns": [ - { "include": "#attribute" }, - { "include": "#comment" }, - { "include": "#module-path-extended-prefix" }, - { "include": "#type-expression-label" }, - { - "match": "\\b(as)\\b", - "name": "variable.other.class.js variable.interpolation storage.modifier message.error" - }, - { "include": "#type-expression-constructor" }, - { "include": "#type-expression-object" }, - { "include": "#type-expression-parens" }, - { "include": "#type-expression-polymorphic-variant" }, - { "include": "#type-expression-record" }, - { "include": "#type-expression-variable" } - ] - }, - "type-expression-arrow": { - "match": "=>", - "name": "markup.inserted keyword.control.less" - }, - "type-expression-constructor": { - "match": "(_)(?![[:alnum:]])|\\b([_[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", - "captures": { - "1": { "name": "comment" }, - "2": { "name": "support.type string.regexp" } - } - }, - "type-expression-label": { - "begin": "\\b([_[:lower:]][[:word:]]*)\\b(::)", - "end": "(?<==>)", - "beginCaptures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, - "2": { "name": "keyword.control" } - }, - "patterns": [ - { "include": "#type-expression" }, - { - "match": "(\\?)", - "captures": { - "1": { "name": "keyword.control.less" } - } - } - ] - }, - "type-expression-object": { - "comment": "FIXME: separate sub-rules", - "begin": "(<)", - "end": "(>)", - "captures": { - "1": { "name": "entity.name.function" } - }, - "patterns": [ - { - "begin": "(\\.\\.)", - "end": "(?=>)", - "beginCaptures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - } - }, - { - "comment": "FIXME: method item", - "begin": "(?=[_[:lower:]])", - "end": "(,)|(?=>)", - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { - "comment": "FIXME: method name", - "begin": "(?=[_[:lower:]])", - "end": "(?=:)", - "patterns": [ - { - "match": "\\b([_[:lower:]][[:word:]]*)\\b", - "captures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } - } - } - ] - }, - { - "comment": "FIXME: method type", - "begin": "(:)", - "end": "(?=[,>])", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#type-expression" } - ] - } - ] - } - ] - }, - "type-expression-parens": { - "comment": "FIXME: proper tuple types", - "begin": "\\(", - "end": "\\)", - "patterns": [ - { - "begin": "\\b(module)\\b", - "end": "(?=[\\)])", - "beginCaptures": { - "1": { "name": "keyword.other message.error" } - }, - "patterns": [ - { "include": "#module-path-extended" }, - { "include": "#signature-expression-constraints" } - ] - }, - { - "match": ",", - "name": "keyword.control.less" - }, - { "include": "#type-expression" } - ] - }, - "type-expression-polymorphic-variant": { - "comment": "FIXME: proper parsing", - "begin": "(\\[)([<>])?", - "end": "(\\])", - "captures": { - "1": { "name": "entity.name.function" }, - "2": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { - "begin": "(\\|)?(?![#\\-:!?.@*/&%^+<=>|~$\\\\])[[:space:]]*", - "end": "(?=[;)}\\]]|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\])|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#value-expression-constructor" }, - { - "match": "([:])|\\b(of)\\b|([&])", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "keyword.other" }, - "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - } - }, - { "include": "#value-expression-constructor-polymorphic" }, - { "include": "#type-expression" } - ] - } - ] - }, - "type-expression-record": { - "begin": "{", - "end": "}", - "patterns": [ - { "include": "#type-expression-record-item" } - ] - }, - "type-expression-record-field-sans-modifier": { - "begin": "\\b([_[:lower:]][[:word:]]*)\\b", - "end": "(,)|(?=[,}])", - "beginCaptures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#comment" }, - { - "begin": "(:)", - "end": "(?=[,}])", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#type-expression" } - ] - } - ] - }, - "type-expression-record-field": { - "patterns": [ - { - "begin": "\\b(mutable)\\b", - "end": "(?<=[,])|(?=})", - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } - }, - "patterns": [ - { "include": "#type-expression-record-field-sans-modifier" } - ] - }, - { "include": "#type-expression-record-field-sans-modifier" } - ] - }, - "type-expression-record-item": { - "patterns": [ - { "include": "#comment" }, - { "include": "#module-path-simple-prefix" }, - { "include": "#type-expression-record-field" } - ] - }, - "type-expression-variable": { - "match": "(')([_[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", - "captures": { - "1": { "name": "comment" }, - "2": { "name": "variable.parameter string.other.link variable.language" } - } - }, - "value-expression": { - "patterns": [ - { "include": "#attribute" }, - { "include": "#comment" }, - { "include": "#extension-node" }, - { "include": "#jsx" }, - { "include": "#operator" }, - { "include": "#value-expression-builtin" }, - { "include": "#value-expression-if-then-else" }, - { "include": "#value-expression-atomic" }, - { "include": "#module-path-simple-prefix" }, - { - "match": "[:?]", - "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" - }, - { "include": "#record-path" } - ] - }, - "value-expression-atomic": { - "patterns": [ - { "include": "#value-expression-literal" }, - { "include": "#value-expression-literal-list-or-array" }, - { "include": "#value-expression-for" }, - { "include": "#value-expression-fun" }, - { "include": "#value-expression-block-or-record-or-object" }, - { "include": "#value-expression-label" }, - { "include": "#value-expression-parens" }, - { "include": "#value-expression-switch" }, - { "include": "#value-expression-try" }, - { "include": "#value-expression-while" } - ] - }, - "value-expression-atomic-with-paths": { - "patterns": [ - { "include": "#value-expression-atomic" }, - { "include": "#module-path-simple-prefix" }, - { "include": "#record-path-suffix" } - ] - }, - "value-expression-block": { - "begin": "{", - "end": "}", - "patterns": [ - { "include": "#value-expression-block-item" } - ] - }, - "value-expression-block-item": { - "patterns": [ - { "include": "#module-item-let" }, - { "include": "#module-item-open" }, - { "include": "#value-expression" } - ] - }, - "value-expression-block-look": { - "begin": "(?![[:space:]]*($|\\.\\.\\.|([[:upper:]][[:word:]]*\\.)*([[:lower:]][[:word:]]*)[[:space:]]*(?:,|:(?![=]))))", - "end": "(?=})", - "patterns": [ - { "include": "#value-expression-block-item" } - ] - }, - "value-expression-block-or-record-or-object": { - "begin": "{", - "end": "}", - "patterns": [ - { "include": "#comment" }, - { "include": "#module-path-simple-prefix" }, - { "include": "#value-expression-object-look" }, - { "include": "#value-expression-record-look" }, - { "include": "#value-expression-block-look" } - ] - }, - "value-expression-builtin": { - "match": "\\b(assert|decr|failwith|fprintf|ignore|incr|land|lazy|lor|lsl|lsr|lxor|mod|new|not|printf|ref)\\b|\\b(raise)\\b", - "captures": { - "1": { "name": "keyword.control message.error" }, - "2": { "name": "keyword.control.trycatch" } - } - }, - "value-expression-constructor": { - "match": "\\b([[:upper:]][[:word:]]*)\\b(?![[:space:]]*[\\.])", - "captures": { - "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - } - }, - "value-expression-constructor-polymorphic": { - "match": "(`)([[:alpha:]][[:word:]]*)\\b(?!\\.)", - "captures": { - "1": { "name": "constant.other.symbol keyword.control.less variable.parameter" }, - "2": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } - } - }, - "value-expression-for": { - "begin": "(?=\\b(for)\\b)", - "end": "(?<=})|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { "include": "#value-expression-for-head" }, - { "include": "#value-expression-block" } - ] - }, - "value-expression-for-head": { - "begin": "(?=\\b(for)\\b)", - "end": "(?={)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", - "patterns": [ - { - "begin": "\\b(for)\\b", - "end": "(?=\\b(in)\\b)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.loop" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#pattern-variable" } - ] - }, - { - "begin": "\\b(in)\\b", - "end": "(?=\\b(to)\\b)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.loop" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#value-expression-atomic-with-paths" } - ] - }, - { - "begin": "\\b(to)\\b", - "end": "(?={)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.loop" } - }, - "patterns": [ - { "include": "#comment" }, - { "include": "#value-expression-atomic-with-paths" } - ] - }, - { "include": "#value-expression-block" } - ] - }, - "value-expression-fun": { - "begin": "\\b(fun)\\b", - "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control" } - }, - "patterns": [ - { "include": "#value-expression-fun-pattern-match-rule-lhs" }, - { "include": "#value-expression-fun-pattern-match-rule-rhs" } - ] - }, - "value-expression-fun-pattern-match-rule-lhs": { - "begin": "(?=\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|(?<=fun)", - "end": "(\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|(?==>)|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", - "applyEndPatternLast": true, - "beginCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "endCaptures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } - }, - "patterns": [ - { "include": "#module-item-let-value-param" } - ] - }, - "value-expression-fun-pattern-match-rule-rhs": { - "begin": "(=>)", - "end": "(?=[;\\)}]|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\])|\\b(and)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#value-expression" } - ] - }, - "value-expression-if-then-else": { - "begin": "\\b(if)\\b", - "end": "(?=[;\\)\\]}])", - "applyEndPatternLast": true, - "beginCaptures": { - "1": { "name": "keyword.control.conditional" } - }, - "patterns": [ - { "include": "#comment" }, - { - "begin": "\\b(else)\\b", - "end": "(?=[;\\)\\]}])", - "beginCaptures": { - "1": { "name": "keyword.control.conditional" } - }, - "patterns": [ - { "include": "#value-expression" } - ] - }, - { "include": "#value-expression-atomic-with-paths" } - ] - }, - "value-expression-lazy": { - "comment": "FIXME", - "match": "\\b(lazy)\\b", - "captures": { - "1": { "name": "keyword.other" } - } - }, - "value-expression-label": { - "begin": "\\b([_[:lower:]][[:word:]]*)\\b[[:space:]]*(::)(\\?)?", - "end": "(?![[:space:]])", - "beginCaptures": { - "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, - "2": { "name": "keyword.control" }, - "3": { "name": "storage.type" } - }, - "patterns": [ - { "include": "#value-expression" } - ] - }, - "value-expression-literal": { - "patterns": [ - { "include": "#value-expression-literal-boolean" }, - { "include": "#value-expression-literal-character" }, - { "include": "#value-expression-constructor" }, - { "include": "#value-expression-constructor-polymorphic" }, - { "include": "#value-expression-lazy" }, - { "include": "#value-expression-literal-numeric" }, - { "include": "#value-expression-literal-string" }, - { "include": "#value-expression-literal-unit" } - ] - }, - "value-expression-literal-boolean": { - "match": "\\b(false|true)\\b", - "name": "entity.other.attribute-name.css constant.language constant.numeric" - }, - "value-expression-literal-character": { - "match": "(')([[:space:]]|[[:graph:]]|\\\\[\\\\\"'ntbr]|\\\\[[:digit:]][[:digit:]][[:digit:]]|\\\\x[[:xdigit:]][[:xdigit:]]|\\\\o[0-3][0-7][0-7])(')", - "name": "constant.character" - }, - "value-expression-literal-list-or-array": { - "begin": "(\\[\\|?)(?![@%])", - "end": "(\\|?\\])", - "beginCaptures": { - "1": { "name": "constant.language.list" } - }, - "endCaptures": { - "1": { "name": "constant.language.list" } - }, - "patterns": [ - { "include": "#value-expression-literal-list-or-array-separator" }, - { "include": "#value-expression" }, - { "include": "#value-expression-literal-list-or-array" } - ] - }, - "value-expression-literal-list-or-array-separator": { - "match": "(,)|(\\.\\.\\.)", - "captures": { - "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "2": { "name": "keyword.control" } - } - }, - "value-expression-literal-numeric": { - "patterns": [ - { - "match": "([-])?([[:digit:]][_[:digit:]]*)(?:(\\.)([_[:digit:]]*))?(?:([eE])([\\-\\+])?([[:digit:]][_[:digit:]]*))?(?![bBoOxX])", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "constant.numeric" }, - "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "4": { "name": "constant.numeric" }, - "5": { "name": "keyword.control.less" }, - "6": { "name": "keyword.control.less" }, - "7": { "name": "constant.numeric" } - } - }, - { - "match": "([-])?(0[xX])([[:xdigit:]][_[:xdigit:]]*)(?:(\\.)([_[:xdigit:]]*))?(?:([pP])([\\-\\+])?([[:digit:]][_[:digit:]]*))?", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "keyword.control.less" }, - "3": { "name": "constant.numeric" }, - "4": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, - "5": { "name": "constant.numeric" }, - "6": { "name": "keyword.control.less" }, - "7": { "name": "keyword.control.less" }, - "8": { "name": "constant.numeric" } - } - }, - { - "match": "([-])?(0[oO])([0-7][_0-7]*)", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "keyword.control.less" }, - "3": { "name": "constant.numeric" } - } - }, - { - "match": "([-])?(0[bB])([0-1][_0-1]*)", - "captures": { - "1": { "name": "keyword.control.less" }, - "2": { "name": "keyword.control.less" }, - "3": { "name": "constant.numeric" } - } - } - ] - }, - "value-expression-literal-string": { - "patterns": [ - { - "begin": "(?|~$\\\\]))", - "end": "(?==>|[;\\)}])", - "patterns": [ - { "include": "#pattern-guard" }, - { "include": "#pattern" } - ] - }, - "value-expression-switch-pattern-match-rule-rhs": { - "begin": "(=>)", - "end": "(?=}|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))", - "beginCaptures": { - "1": { "name": "keyword.control.less" } - }, - "patterns": [ - { "include": "#value-expression-block-item" } - ] - }, - "value-expression-try": { - "begin": "\\b(try)\\b", - "end": "(?<=})|(?=[;\\)]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", - "beginCaptures": { - "1": { "name": "keyword.control.trycatch" } - }, - "patterns": [ - { "include": "#value-expression-try-head" }, - { "include": "#value-expression-switch-body" } - ] - }, - "value-expression-try-head": { - "begin": "(?<=try)", - "end": "(? $0;" - ] - }, - "function (block)": { - "prefix": "let", - "body": [ - "let ${1:f} = (${2:args}) => {", - "\t$0;", - "};" - ] - }, - "module (block)": { - "prefix": "module", - "body": [ - "module ${1:M} = {", - "\t$0", - "};" - ] - }, - "switch": { - "prefix": "switch", - "body": [ - "switch ${1:scrutinee} {", - "| ${2:pattern} => ${3:${2:pattern}}", - "};" - ] - } -} \ No newline at end of file diff --git a/editor-extensions/vscode/src/index.js b/editor-extensions/vscode/src/index.js deleted file mode 100644 index d3932b4c..00000000 --- a/editor-extensions/vscode/src/index.js +++ /dev/null @@ -1,190 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -const vscode = require("vscode"); -const {Uri} = vscode; -const {LanguageClient, RevealOutputChannelOn} = require("vscode-languageclient"); -const {TextDocument} = require('vscode-languageserver-types'); -const path = require('path') -const fs = require('fs') - -const getLocation = (context) => { - let binaryLocation = vscode.workspace.getConfiguration('reason_language_server').get('location') - - if (!binaryLocation) { - // see if it's bundled with the extension - // hmm actually I could bundle one for each platform & probably be fine - // I guess it's 9mb binary. I wonder if I can cut that down? - const ext = process.platform === 'win32' - ? '.exe' - : (process.platform === 'linux' ? '.linux' : ''); - - binaryLocation = path.join(vscode.workspace.rootPath, 'node_modules', '@jaredly', 'reason-language-server', 'lib', 'bs', 'native', 'bin.native' + ext) - if (!fs.existsSync(binaryLocation)) { - binaryLocation = context.asAbsolutePath('bin.native' + ext) - if (!fs.existsSync(binaryLocation)) { - vscode.window.showErrorMessage('Reason Language Server not found! Please install the npm package @jaredly/reason-language-server to enable IDE functionality'); - return null - } - } - } else { - if (!binaryLocation.startsWith('/')) { - binaryLocation = path.join(vscode.workspace.rootPath, binaryLocation) - } - if (!fs.existsSync(binaryLocation)) { - vscode.window.showErrorMessage('Reason Language Server not found! You specified ' + binaryLocation); - return null - } - } - return binaryLocation -} - -const shouldReload = () => vscode.workspace.getConfiguration('reason_language_server').get('reloadOnChange') - -/** - * Taken from https://github.com/rust-lang/rls-vscode/blob/master/src/extension.ts - * - * Sets up additional language configuration that's impossible to do via a - * separate language-configuration.json file. See [1] for more information. - * - * [1]: https://github.com/Microsoft/vscode/issues/11514#issuecomment-244707076 - */ -function configureLanguage() { - return vscode.languages.setLanguageConfiguration('reason', { - onEnterRules: [ - { - // Begins an auto-closed multi-line comment (standard or parent doc) - // e.g. /** | */ or /*! | */ - beforeText: /^\s*\/\*(\*|\!)(?!\/)([^\*]|\*(?!\/))*$/, - afterText: /^\s*\*\/$/, - action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: ' * ' }, - }, - { - // Begins a multi-line comment (standard or parent doc) - // e.g. /** ...| or /*! ...| - beforeText: /^\s*\/\*(\*|\!)(?!\/)([^\*]|\*(?!\/))*$/, - action: { indentAction: vscode.IndentAction.None, appendText: ' * ' }, - }, - { - // Continues a multi-line comment - // e.g. * ...| - beforeText: /^(\ \ )*\ \*(\ ([^\*]|\*(?!\/))*)?$/, - action: { indentAction: vscode.IndentAction.None, appendText: '* ' }, - }, - { - // Dedents after closing a multi-line comment - // e.g. */| - beforeText: /^(\ \ )*\ \*\/\s*$/, - action: { indentAction: vscode.IndentAction.None, removeText: 1 }, - }, - ], - }); -} - -function activate(context) { - // The server is implemented in reason - - let clientOptions = { - documentSelector: [ - {scheme: 'file', language: 'reason'}, - {scheme: 'file', language: 'ocaml'}, - {scheme: 'file', language: 'bucklescript'} - ], - synchronize: { - // Synchronize the setting section 'reason_language_server' to the server - configurationSection: 'reason_language_server', - fileEvents: [ - vscode.workspace.createFileSystemWatcher('**/bsconfig.json'), - vscode.workspace.createFileSystemWatcher('**/.merlin') - ] - }, - revealOutputChannelOn: RevealOutputChannelOn.Never, - }; - - let client = null - let lastStartTime = null - let interval = null - - const startChecking = (location) => { - vscode.window.showInformationMessage('DEBUG MODE: Will auto-restart the reason language server if it recompiles'); - interval = setInterval(() => { - try { - const stat = fs.statSync(location) - const mtime = stat.mtime.getTime() - if (mtime > lastStartTime) { - restart() - } - } catch (e) { - console.warn('Failed to check binary mtime ' + e.message) - } - }, 500); - context.subscriptions.push({dispose: () => clearInterval(checkForBinaryChange)}) - } - - /** - * client.sendRequest(...).then(response => { - * }) - * - * client.sendNotification().... - * that could be a way to implement the code actions that I want to do. - * - * alsooo I think I want - */ - - const restart = () => { - if (client) { - client.stop(); - } - const location = getLocation(context) - if (!location) return - const binLocation = process.platform === 'win32' ? location + '.hot.exe' : location - if (binLocation != location) { - fs.writeFileSync(binLocation, fs.readFileSync(location)) - } - client = new LanguageClient( - 'reason-language-server', - 'Reason Language Server', - { - command: binLocation, - args: [], - }, - Object.assign({}, clientOptions, { - revealOutputChannelOn: vscode.workspace.getConfiguration('reason_language_server').get('show_debug_errors') - ? RevealOutputChannelOn.Error - : RevealOutputChannelOn.Never - }), - ); - lastStartTime = Date.now() - context.subscriptions.push(client.start()); - if (shouldReload()) { - vscode.window.showInformationMessage('Reason language server restarted'); - if (!interval) { - startChecking(location) - } - } else if (interval) { - vscode.window.showInformationMessage('DEBUG MODE OFF - no longer monitoring reason-language-server binary'); - clearInterval(interval) - interval = null - } - } - - vscode.workspace.onDidChangeConfiguration(evt => { - if (evt.affectsConfiguration('reason_language_server.location')) { - restart() - } - }) - - vscode.commands.registerCommand('reason-language-server.restart', restart); - - context.subscriptions.push(configureLanguage()); - - restart(); - - // vscode.commands.registerCommand('reason-language-server.expand_switch', () => { - // }); - - return { getClient: () => client }; -} -exports.activate = activate; diff --git a/editor-extensions/vscode/src/syntaxes/basis.ts b/editor-extensions/vscode/src/syntaxes/basis.ts deleted file mode 100644 index 3de7fed3..00000000 --- a/editor-extensions/vscode/src/syntaxes/basis.ts +++ /dev/null @@ -1,480 +0,0 @@ -// tslint:disable object-literal-sort-keys - -import * as schema from "./schema"; - -export function ref(f: (...args: any[]) => schema.Rule): string { - return `#${f.name}`; -} - -export function include(f: (...args: any[]) => schema.Rule): { include: string } { - return { include: ref(f) }; -} - -export const alt = (...rest: string[]) => rest.join("|"); -export const capture = (arg: string) => `(${arg})`; -export const complement = (...rest: string[]) => `[^${rest.join("")}]`; -export const group = (arg: string) => `(?:${arg})`; -export const lookBehind = (arg: string) => `(?<=${arg})`; -export const negativeLookBehind = (arg: string) => `(? `${arg}*`; -export const manyOne = (arg: string) => `${arg}+`; -export const opt = (arg: string) => `${arg}?`; -export const words = (arg: string) => `\\b${arg}\\b`; -export const lookAhead = (arg: string) => `(?=${arg})`; -export const negativeLookAhead = (arg: string) => `(?!${arg})`; -export const seq = (...rest: string[]) => rest.join(""); -export const set = (...rest: string[]) => `[${rest.join("")}]`; - -export const Class = { - alnum: "[:alnum:]", - alpha: "[:alpha:]", - ascii: "[:ascii:]", - blank: "[:blank:]", - cntrl: "[:cntrl:]", - digit: "[:digit:]", - graph: "[:graph:]", - lower: "[:lower:]", - print: "[:print:]", - punct: "[:punct:]", - space: "[:space:]", - upper: "[:upper:]", - word: "[:word:]", - xdigit: "[:xdigit:]", -}; - -export const Token = { - AND: "and", - APOSTROPHE: "'", - AS: "as", - ASR: "asr", - ASSERT: "assert", - ASTERISK: "\\*", - BEGIN: "begin", - CLASS: "class", - COLON: ":", - COMMA: ",", - COMMERCIAL_AT: "@", - CONSTRAINT: "constraint", - DO: "do", - DONE: "done", - DOWNTO: "downto", - ELSE: "else", - END: "end", - EQUALS_SIGN: "=", - EXCEPTION: "exception", - EXTERNAL: "external", - FALSE: "false", - FOR: "for", - FULL_STOP: "\\.", - FUN: "fun", - FUNCTION: "function", - FUNCTOR: "functor", - GREATER_THAN_SIGN: ">", - HYPHEN_MINUS: "-", - IF: "if", - IN: "in", - INCLUDE: "include", - INHERIT: "inherit", - INITIALIZER: "initializer", - LAND: "land", - LAZY: "lazy", - LEFT_CURLY_BRACKET: "\\{", - LEFT_PARENTHESIS: "\\(", - LEFT_SQUARE_BRACKET: "\\[", - LESS_THAN_SIGN: "<", - LET: "let", - LOR: "lor", - LOW_LINE: "_", - LSL: "lsl", - LSR: "lsr", - LXOR: "lxor", - MATCH: "match", - METHOD: "method", - MOD: "mod", - MODULE: "module", - MUTABLE: "mutable", - NEW: "new", - NONREC: "nonrec", - NUMBER_SIGN: "#", - OBJECT: "object", - OF: "of", - OPEN: "open", - OR: "or", - PERCENT_SIGN: "%", - PLUS_SIGN: "\\+", - PRIVATE: "private", - QUESTION_MARK: "\\?", - QUOTATION_MARK: '"', - REC: "rec", - REVERSE_SOLIDUS: "\\\\", - RIGHT_CURLY_BRACKET: "\\}", - RIGHT_PARENTHESIS: "\\)", - RIGHT_SQUARE_BRACKET: "\\]", - SEMICOLON: ";", - SIG: "sig", - SOLIDUS: "/", - STRUCT: "struct", - THEN: "then", - TILDE: "~", - TO: "to", - TRUE: "true", - TRY: "try", - TYPE: "type", - VAL: "val", - VERTICAL_LINE: "\\|", - VIRTUAL: "virtual", - WHEN: "when", - WHILE: "while", - WITH: "with", -}; - -export class Scope { - public static ITEM_AND(): string { - return `${this.STYLE_OPERATOR()} ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_CLASS(): string { - return `entity.name.class constant.numeric ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_EXTERNAL(): string { - return `entity.name.class constant.numeric ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_INCLUDE(): string { - return this.STYLE_OPERATOR(); - } - - public static ITEM_LET(): string { - return `${this.STYLE_CONTROL()} ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_METHOD(): string { - return `${this.STYLE_BINDER()} ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_MODULE(): string { - return `markup.inserted constant.language support.constant.property-value entity.name.filename ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_OPEN(): string { - return this.STYLE_OPERATOR(); - } - - public static ITEM_TYPE(): string { - return `${this.STYLE_KEYWORD()} ${this.STYLE_UNDERLINE()}`; - } - - public static ITEM_VAL(): string { - return `support.type ${this.STYLE_UNDERLINE()}`; - } - - public static KEYWORD_AS(): string { - return this.STYLE_OPERATOR(); - } - - public static KEYWORD_REC(): string { - return this.STYLE_OPERATOR(); - } - - public static KEYWORD_WHEN(): string { - return this.STYLE_OPERATOR(); - } - - public static LITERAL_OBJECT(): string { - return `${this.STYLE_DELIMITER()} ${this.STYLE_ITALICS()}`; - } - - public static LITERAL_SIGNATURE(): string { - return `${this.STYLE_DELIMITER()} ${this.STYLE_ITALICS()}`; - } - - public static LITERAL_STRUCTURE(): string { - return `${this.STYLE_DELIMITER()} ${this.STYLE_ITALICS()}`; - } - - public static META_COMMENT(): string { - return "comment constant.regexp meta.separator.markdown"; - } - - public static MODULE_FUNCTOR(): string { - return "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error"; - } - - public static MODULE_SIG(): string { - return this.STYLE_DELIMITER(); - } - - public static MODULE_STRUCT(): string { - return this.STYLE_DELIMITER(); - } - - public static NAME_FIELD(): string { - return `markup.inserted constant.language support.constant.property-value entity.name.filename`; - } - - public static NAME_FUNCTION(): string { - return `entity.name.function ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; - } - - public static NAME_METHOD(): string { - return "entity.name.function"; - } - - public static NAME_MODULE(): string { - return "entity.name.class constant.numeric"; - } - - public static PUNCTUATION_QUOTE(): string { - return `markup.punctuation.quote.beginning ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; - } - - public static SIGNATURE_WITH(): string { - return `${this.STYLE_OPERATOR()} ${this.STYLE_UNDERLINE()}`; - } - - public static NAME_TYPE(): string { - return `entity.name.function ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; - } - - public static OPERATOR_TYPE(): string { - return `${this.STYLE_OPERATOR()} ${this.STYLE_BOLD()}`; - } - - public static PUNCTUATION_APOSTROPHE(): string { - return `${this.VARIABLE_PATTERN()} ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; - } - - public static PUNCTUATION_COLON(): string { - return `${this.STYLE_OPERATOR()} ${this.STYLE_BOLD()}`; - } - - public static PUNCTUATION_COMMA(): string { - return `string.regexp ${this.STYLE_BOLD()}`; - } - - public static PUNCTUATION_DOT(): string { - return `${this.STYLE_KEYWORD()} ${this.STYLE_BOLD()}`; - } - - public static PUNCTUATION_EQUALS(): string { - return `support.type ${this.STYLE_BOLD()}`; - } - - public static PUNCTUATION_PERCENT_SIGN(): string { - return `${this.STYLE_OPERATOR()} ${this.STYLE_BOLD()}`; - } - - public static STYLE_BINDER(): string { - return "storage.type"; - } - - public static STYLE_BOLD(): string { - return "strong"; - } - - public static STYLE_CONTROL(): string { - return "keyword.control"; - } - - public static STYLE_DELIMITER(): string { - return "punctuation.definition.tag"; - } - - public static STYLE_ITALICS(): string { - return "emphasis"; - } - - public static STYLE_KEYWORD(): string { - return "keyword"; - } - - public static STYLE_OPERATOR(): string { - return "variable.other.class.js message.error variable.interpolation string.regexp"; - } - - public static STYLE_PUNCTUATION(): string { - return "string.regexp"; - } - - public static STYLE_UNDERLINE(): string { - return "markup.underline"; - } - - public static TERM_BUILTIN(): string { - return this.STYLE_OPERATOR(); - } - - public static TERM_CHARACTER(): string { - return "markup.punctuation.quote.beginning"; - } - - public static TERM_CONSTRUCTOR(): string { - return `constant.language constant.numeric entity.other.attribute-name.id.css ${this.STYLE_BOLD()}`; - } - - public static TERM_FUN(): string { - return this.STYLE_BINDER(); - } - - public static TERM_FUNCTION(): string { - return this.STYLE_BINDER(); - } - - public static TERM_IF(): string { - return this.STYLE_CONTROL(); - } - - public static TERM_IN(): string { - return `${this.STYLE_BINDER()} ${this.STYLE_UNDERLINE()}`; - } - - public static TERM_LET(): string { - return `${this.STYLE_BINDER()} ${this.STYLE_UNDERLINE()}`; - } - - public static TERM_MODULE(): string { - return "markup.inserted constant.language support.constant.property-value entity.name.filename"; - } - - public static TERM_NUMBER(): string { - return "constant.numeric"; - } - - public static TERM_STRING(): string { - return "string beginning.punctuation.definition.quote.markdown"; - } - - public static TYPE_CONSTRUCTOR(): string { - return `entity.name.function ${this.STYLE_BOLD()}`; - } - - public static VARIABLE_PATTERN(): string { - return `string.other.link variable.language variable.parameter ${this.STYLE_ITALICS()}`; - } - - public static VARIABLE_TYPE(): string { - return `${this.STYLE_CONTROL()} ${this.STYLE_ITALICS()}`; - } - - public static VERTICAL_LINE(): string { - return `support.type ${this.STYLE_BOLD()}`; - } -} - -export interface IGrammar { - bindClassTerm(): schema.Rule; - bindClassType(): schema.Rule; - bindConstructor(): schema.Rule; - bindSignature(): schema.Rule; - bindStructure(): schema.Rule; - bindTerm(): schema.Rule; - bindTermArgs(): schema.Rule; - bindType(): schema.Rule; - boundary(): string; - comment(): schema.Rule; - commentBlock(): schema.Rule; - commentDoc(): schema.Rule; - decl(): schema.Rule; - declClass(): schema.Rule; - declEnd(): string; - declEndItem(): string; - declEndItemWith(...rest: string[]): string; - declEndSans(...rest: string[]): string; - declEndTokens(): string[]; - declException(): schema.Rule; - declInclude(): schema.Rule; - declModule(): schema.Rule; - declOpen(): schema.Rule; - declStartTokens(): string[]; - declTerm(): schema.Rule; - declType(): schema.Rule; - escapes(...rest: string[]): schema.Rule; - expEnd(): string; - functor(ruleBody: () => schema.Rule): schema.Rule[]; - ident(): string; - identLower(): string; - identUpper(): string; - lastOps(...rest: string[]): string; - literal(): schema.Rule; - literalArray(): schema.Rule; - literalBoolean(): schema.Rule; - literalCharacter(): schema.Rule; - literalCharacterEscape(): schema.Rule; - literalList(): schema.Rule; - literalNumber(): schema.Rule; - literalObjectTerm(): schema.Rule; - literalClassType(): schema.Rule; - literalRecord(): schema.Rule; - literalString(): schema.Rule; - literalStringEscape(): schema.Rule; - literalUnit(): schema.Rule; - operator(): string; - operatorTokens(): string[]; - ops(arg: string): string; - parens(ruleLHS: string, ruleRHS: string): schema.Rule; - pathModuleExtended(): schema.Rule; - pathModulePrefixExtended(): schema.Rule; - pathModulePrefixExtendedParens(): schema.Rule; - pathModulePrefixSimple(): schema.Rule; - pathModuleSimple(): schema.Rule; - pathRecord(): schema.Rule; - pathType(): schema.Rule; - pattern(): schema.Rule; - patternArray(): schema.Rule; - patternLazy(): schema.Rule; - patternList(): schema.Rule; - patternMisc(): schema.Rule; - patternModule(): schema.Rule; - patternParens(): schema.Rule; - patternRecord(): schema.Rule; - patternType(): schema.Rule; - pragma(): schema.Rule; - signature(): schema.Rule; - signatureConstraints(): schema.Rule; - signatureFunctor(): schema.Rule; - signatureLiteral(): schema.Rule; - signatureParens(): schema.Rule; - signatureRecovered(): schema.Rule; - structure(): schema.Rule; - structureFunctor(): schema.Rule; - structureLiteral(): schema.Rule; - structureParens(): schema.Rule; - structureUnpack(): schema.Rule; - term(): schema.Rule; - termAtomic(): schema.Rule; - termConditional(): schema.Rule; - termConstructor(): schema.Rule; - termDelim(): schema.Rule; - termFor(): schema.Rule; - termFunction(): schema.Rule; - termLet(): schema.Rule; - termMatch(): schema.Rule; - termMatchRule(): schema.Rule; - termOperator(): schema.Rule; - termPun(): schema.Rule; - termTry(): schema.Rule; - termWhile(): schema.Rule; - type(): schema.Rule; - typeConstructor(): schema.Rule; - typeLabel(): schema.Rule; - typeModule(): schema.Rule; - typeObject(): schema.Rule; - typeOperator(): schema.Rule; - typeParens(): schema.Rule; - typePolymorphicVariant(): schema.Rule; - typeRecord(): schema.Rule; - variableModule(): schema.Rule; - variablePattern(): schema.Rule; -} - -export interface IRender { - render(): schema.IGrammar; -} - -export interface ILanguage extends IGrammar, IRender {} diff --git a/editor-extensions/vscode/src/syntaxes/ocaml.ts b/editor-extensions/vscode/src/syntaxes/ocaml.ts deleted file mode 100644 index e49cc6a7..00000000 --- a/editor-extensions/vscode/src/syntaxes/ocaml.ts +++ /dev/null @@ -1,2317 +0,0 @@ -// tslint:disable object-literal-sort-keys trailing-comma - -import * as basis from "./basis"; -import * as schema from "./schema"; - -const { - Class, - Scope, - Token, - alt, - capture, - complement, - group, - include, - lastWords, - lookAhead, - lookBehind, - many, - manyOne, - negativeLookAhead, - negativeLookBehind, - opt, - ref, - seq, - set, - words, -} = basis; - -export class OCaml implements basis.ILanguage { - constructor() { - return this; - } - - public boundary(): string { - return `\\b`; - } - - public declEnd(): string { - return lookAhead( - alt( - seq(Token.SEMICOLON, Token.SEMICOLON), - Token.RIGHT_CURLY_BRACKET, - Token.RIGHT_PARENTHESIS, - Token.RIGHT_SQUARE_BRACKET, - words(group(alt(...this.declEndTokens()))), - ), - ); - } - - public declEndItem(): string { - return this.declEndItemWith(seq(Token.SEMICOLON, Token.SEMICOLON)); - } - - public declEndItemWith(...rest: string[]): string { - return alt( - ...rest, - lookAhead( - alt( - Token.RIGHT_CURLY_BRACKET, - Token.RIGHT_PARENTHESIS, - Token.RIGHT_SQUARE_BRACKET, - words(group(alt(...this.declEndTokens()))), - ), - ), - ); - } - - public declEndSans(...elems: string[]): string { - return lookAhead( - alt( - Token.RIGHT_CURLY_BRACKET, - Token.RIGHT_PARENTHESIS, - Token.RIGHT_SQUARE_BRACKET, - words(group(alt(...this.declEndTokens().filter(x => !elems.includes(x))))), - ), - ); - } - - public declEndTokens(): string[] { - return [Token.END, ...this.declStartTokens()]; - } - - public declStartTokens(): string[] { - return [ - Token.AND, - Token.CLASS, - Token.EXCEPTION, - Token.EXTERNAL, - Token.IN, - Token.INCLUDE, - Token.INHERIT, - Token.INITIALIZER, - Token.LET, - Token.METHOD, - Token.MODULE, - Token.OPEN, - Token.TYPE, - Token.VAL, - ]; - } - - public attribute(): schema.Rule { - return { - begin: seq( - capture(Token.LEFT_SQUARE_BRACKET), - many(set(Class.space)), - capture(this.ops(`${Token.COMMERCIAL_AT}{1,3}`)), - ), - end: Token.RIGHT_SQUARE_BRACKET, - beginCaptures: { - 1: { name: Scope.TERM_CONSTRUCTOR() }, - 2: { name: Scope.STYLE_OPERATOR() }, - }, - endCaptures: { - 0: { name: Scope.TERM_CONSTRUCTOR() }, - }, - patterns: [include(this.attributePayload)], - }; - } - - public attributeIdentifier(): schema.Rule { - return { - match: seq(capture(this.ops(Token.PERCENT_SIGN)), capture(this.identLower())), - captures: { - 1: { name: Scope.PUNCTUATION_PERCENT_SIGN() }, - 2: { name: Scope.STYLE_DELIMITER() }, - }, - }; - } - - public attributePayload(): schema.Rule { - return { - patterns: [ - { - begin: this.lastOps(Token.PERCENT_SIGN), - end: alt( - capture(this.ops(set(Token.COLON, Token.QUESTION_MARK))), - lookBehind(set(Class.space)), - lookAhead(Token.RIGHT_SQUARE_BRACKET), - ), - endCaptures: { - 1: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [include(this.pathModuleExtended), include(this.pathRecord)], - }, - { - begin: this.lastOps(Token.COLON), - end: lookAhead(Token.RIGHT_SQUARE_BRACKET), - patterns: [include(this.signature), include(this.type)], - }, - { - begin: this.lastOps(Token.QUESTION_MARK), - end: lookAhead(Token.RIGHT_SQUARE_BRACKET), - patterns: [ - { - begin: this.lastOps(Token.QUESTION_MARK), - end: alt(lookAhead(Token.RIGHT_SQUARE_BRACKET), words(Token.WHEN)), - endCaptures: { - 1: { name: Scope.STYLE_OPERATOR }, - }, - patterns: [include(this.pattern)], - }, - { - begin: lastWords(Token.WHEN), - end: lookAhead(Token.RIGHT_SQUARE_BRACKET), - patterns: [include(this.term)], - }, - ], - }, - include(this.term), - ], - }; - } - - public escapes(...rest: string[]): schema.Rule { - return { - match: seq( - Token.REVERSE_SOLIDUS, - group( - alt( - set(Token.REVERSE_SOLIDUS, Token.QUOTATION_MARK, ...rest, ...["n", "t", "b", "r"]), - seq(set(Class.digit), set(Class.digit), set(Class.digit)), - seq("x", set(Class.xdigit), set(Class.xdigit)), - seq("o", set("0-3"), set("0-7"), set("0-7")), - ), - ), - ), - }; - } - - public expEnd(): string { - return lookAhead( - alt( - Token.COMMA, - Token.RIGHT_CURLY_BRACKET, - Token.RIGHT_PARENTHESIS, - Token.RIGHT_SQUARE_BRACKET, - words(group(alt(...this.declEndTokens()))), - ), - ); - } - - public functor(ruleBody: (...args: any[]) => schema.Rule): schema.Rule[] { - return [ - { - begin: words(Token.FUNCTOR), - end: this.declEnd(), - beginCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [ - { - begin: lastWords(Token.FUNCTOR), - end: alt( - capture(seq(Token.LEFT_PARENTHESIS, Token.RIGHT_PARENTHESIS)), - capture(seq(Token.LEFT_PARENTHESIS, negativeLookAhead(Token.RIGHT_PARENTHESIS))), - ), - endCaptures: { - 1: { name: Scope.TERM_CONSTRUCTOR() }, - 2: { name: Scope.STYLE_DELIMITER() }, - }, - }, - { - begin: lookBehind(Token.LEFT_PARENTHESIS), - end: alt(capture(Token.COLON), capture(Token.RIGHT_PARENTHESIS)), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 2: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.variableModule)], - }, - { - begin: this.lastOps(Token.COLON), - end: Token.RIGHT_PARENTHESIS, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.signature)], - }, - { - begin: lookBehind(Token.RIGHT_PARENTHESIS), - end: alt( - capture(Token.LEFT_PARENTHESIS), - capture(this.ops(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN))), - ), - endCaptures: { - 1: { name: Scope.STYLE_DELIMITER() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - }, - }, - { - begin: this.lastOps(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN)), - end: this.declEnd(), - patterns: [include(ruleBody)], - }, - ], - }, - { - match: this.ops(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN)), - name: Scope.PUNCTUATION_EQUALS(), - }, - ]; - } - - public ident(): string { - return seq(set(Class.alpha, `_`), many(set(Class.word, `'`))); - } - - public identLower(): string { - return group( - seq( - negativeLookAhead( - seq( - words( - group( - alt( - ...Object.keys(Token) - .filter(key => key !== "LOW_LINE") - .map(key => (Token as any)[key]), - ), - ), - ), - group(alt(complement(Token.APOSTROPHE), `$`)), - ), - ), - seq(this.boundary(), lookAhead(set(Class.lower, `_`)), this.ident()), - ), - ); - } - - // FIXME: This is a duplicate version of identLower that allows more keywords - // as path components. For instance, we need this to be able to parse - // [@@bs.new] and [@@bs.module] properly. - public identLowerPath(): string { - return group( - seq( - negativeLookAhead( - seq( - words( - group( - alt( - ...Object.keys(Token) - .filter(key => key !== "LOW_LINE" && key !== "NEW" && key !== "MODULE" && key !== "AS") - .map(key => (Token as any)[key]), - ), - ), - ), - group(alt(complement(Token.APOSTROPHE), `$`)), - ), - ), - seq(this.boundary(), lookAhead(set(Class.lower, `_`)), this.ident()), - ), - ); - } - - public identUpper(): string { - return group(seq(seq(this.boundary(), lookAhead(set(Class.upper)), this.ident()))); - } - - public parens(ruleLHS: string, ruleRHS: string): schema.Rule { - return { - begin: seq(Token.LEFT_PARENTHESIS, negativeLookAhead(Token.RIGHT_PARENTHESIS)), - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - { include: `#comment` }, - { - begin: this.ops(Token.COLON), - end: lookAhead(Token.RIGHT_PARENTHESIS), - beginCaptures: { - 0: { name: Scope.PUNCTUATION_COLON() }, - }, - patterns: [{ include: ruleRHS }], - }, - { include: ruleLHS }, - ], - }; - } - - public bindClassWith(...rest: schema.Rule[]): schema.Rule { - return { - patterns: [ - { - begin: lastWords(Token.AND, Token.CLASS, Token.TYPE), - end: alt(this.ops(alt(capture(Token.COLON), capture(Token.EQUALS_SIGN))), this.declEnd()), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [ - { - begin: lastWords(Token.AND, Token.CLASS, Token.TYPE), - end: alt( - lookAhead( - alt( - seq(this.identLower(), many(set(Class.space)), Token.COMMA), - complement(Class.space, Class.lower, Token.PERCENT_SIGN), - ), - ), - this.identLower(), - lookAhead(words(Token.TYPE)), - ), - endCaptures: { - 0: { name: Scope.NAME_FUNCTION() }, - }, - patterns: [include(this.attributeIdentifier)], - }, - { - begin: Token.LEFT_SQUARE_BRACKET, - end: Token.RIGHT_SQUARE_BRACKET, - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.type)], - }, - include(this.bindTermArgs), - ], - }, - { - begin: this.lastOps(Token.COLON), - end: alt(this.ops(Token.EQUALS_SIGN), this.declEndSans(Token.TYPE)), - endCaptures: { - 0: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [include(this.literalClassType)], - }, - { - begin: this.lastOps(Token.EQUALS_SIGN), - end: alt(words(Token.AND), this.declEnd()), - endCaptures: { - 0: { name: Scope.ITEM_AND() }, - }, - patterns: [...rest], - }, - ], - }; - } - - public bindClassTerm(): schema.Rule { - return this.bindClassWith(include(this.term)); - } - - public bindClassType(): schema.Rule { - return this.bindClassWith(include(this.literalClassType)); - } - - public bindConstructor(): schema.Rule { - return { - patterns: [ - { - begin: alt( - lastWords(Token.EXCEPTION), - this.lastOps(seq(Token.PLUS_SIGN, Token.EQUALS_SIGN), Token.EQUALS_SIGN, Token.VERTICAL_LINE), - ), - end: alt( - capture(Token.COLON), - capture(words(Token.OF)), - capture(this.ops(Token.VERTICAL_LINE)), - this.declEnd(), - ), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 2: { name: Scope.STYLE_DELIMITER() }, - 3: { name: Scope.VERTICAL_LINE() }, - }, - patterns: [ - include(this.attributeIdentifier), - { - match: seq(Token.FULL_STOP, Token.FULL_STOP), - name: Scope.STYLE_OPERATOR(), - }, - { - match: seq( - words(this.identUpper()), - negativeLookAhead( - seq( - many(set(Class.space)), - group(alt(Token.FULL_STOP, seq(Token.LEFT_PARENTHESIS, complement(Token.ASTERISK)))), - ), - ), - ), - name: Scope.TERM_CONSTRUCTOR(), - }, - include(this.type), - ], - }, - { - begin: alt(this.lastOps(Token.COLON), lastWords(Token.OF)), - end: alt(this.ops(Token.VERTICAL_LINE), this.declEnd()), - endCaptures: { - 0: { name: Scope.VERTICAL_LINE() }, - }, - patterns: [include(this.type)], - }, - ], - }; - } - - public bindSignature(): schema.Rule { - return { - patterns: [ - include(this.comment), - { - begin: lastWords(Token.TYPE), - end: this.ops(Token.EQUALS_SIGN), - endCaptures: { - 0: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [include(this.comment), include(this.pathModuleExtended)], - }, - { - begin: this.lastOps(Token.EQUALS_SIGN), - end: alt(words(Token.AND), this.declEnd()), - endCaptures: { - 0: { name: Scope.ITEM_AND() }, - }, - patterns: [include(this.signature)], - }, - ], - }; - } - - public bindStructure(): schema.Rule { - return { - patterns: [ - include(this.comment), - { - begin: alt(lastWords(Token.AND), lookAhead(set(Class.upper))), - end: alt( - this.ops( - alt( - capture(seq(Token.COLON, negativeLookAhead(Token.EQUALS_SIGN))), - capture(seq(opt(Token.COLON), Token.EQUALS_SIGN)), - ), - ), - this.declEndSans(Token.MODULE), - ), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - }, - // FIXME: parse in order - patterns: [ - include(this.comment), - { - match: words(Token.MODULE), - name: Scope.TERM_MODULE(), - }, - { - match: this.identUpper(), - name: Scope.NAME_FUNCTION(), - }, - this.parens(ref(this.variableModule), ref(this.signature)), - include(this.literalUnit), - ], - }, - { - begin: this.lastOps(Token.COLON), - end: alt(words(capture(Token.AND)), capture(this.ops(Token.EQUALS_SIGN)), this.declEnd()), - endCaptures: { - 1: { name: Scope.ITEM_AND() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [include(this.signature)], - }, - { - begin: this.lastOps(seq(Token.COLON, Token.EQUALS_SIGN), Token.EQUALS_SIGN), - end: alt(words(group(alt(capture(Token.AND), capture(Token.WITH)))), this.declEnd()), - endCaptures: { - 1: { name: Scope.ITEM_AND() }, - 2: { name: Scope.SIGNATURE_WITH() }, - }, - patterns: [include(this.structure)], - }, - ], - }; - } - - public bindTerm(): schema.Rule { - return this.bindTermWith(Token.EQUALS_SIGN); - } - - public bindTermWith(...startBody: string[]): schema.Rule { - return { - patterns: [ - { - begin: alt(this.lastOps("!"), lastWords(Token.AND, Token.EXTERNAL, Token.LET, Token.METHOD, Token.VAL)), - end: alt( - capture(words(Token.MODULE)), - capture(words(Token.OPEN)), - this.ops(alt(capture(Token.COLON), capture(this.ops(alt(...startBody))))), - this.declEnd(), - ), - endCaptures: { - 1: { name: Scope.TERM_MODULE() }, - 2: { name: Scope.ITEM_OPEN() }, - 3: { name: Scope.PUNCTUATION_COLON() }, - 4: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [ - { - begin: lastWords(Token.REC), - end: alt(capture(this.identLower()), lookAhead(complement(Class.space, Class.alpha))), - endCaptures: { - 0: { name: Scope.NAME_FUNCTION() }, - }, - patterns: [include(this.bindTermArgs)], - }, - include(this.bindTermArgs), - { - begin: alt(this.lastOps("!"), lastWords(Token.AND, Token.EXTERNAL, Token.LET, Token.METHOD, Token.VAL)), - end: alt( - lookAhead(words(group(alt(Token.MODULE, Token.OPEN)))), - lookAhead( - alt( - seq(this.identLower(), many(set(Class.space)), Token.COMMA), - complement(Class.space, Class.lower, Token.PERCENT_SIGN), - ), - ), - capture(words(Token.REC)), - capture(this.identLower()), - ), - endCaptures: { - 1: { name: Scope.KEYWORD_REC() }, - 2: { name: Scope.NAME_FUNCTION() }, - }, - patterns: [include(this.attributeIdentifier), include(this.comment)], - }, - ], - }, - { - begin: lastWords(Token.MODULE), - end: this.declEnd(), - patterns: [include(this.declModule)], - }, - { - begin: lastWords(Token.OPEN), - end: this.declEndItemWith(lookAhead(words(Token.IN))), - patterns: [include(this.pathModuleSimple)], - }, - { - begin: this.lastOps(Token.COLON), - end: alt(this.ops(alt(...startBody)), this.declEnd()), - endCaptures: { - 0: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [ - { - begin: this.lastOps(Token.COLON), - end: alt(words(Token.TYPE), lookAhead(complement(Class.space))), - endCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - }, - { - begin: lastWords(Token.TYPE), - end: this.ops(Token.FULL_STOP), - endCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [include(this.pattern)], - }, - include(this.type), - ], - }, - { - begin: this.lastOps(...startBody), - end: alt(words(Token.AND), this.declEnd()), - endCaptures: { - 0: { name: Scope.ITEM_AND() }, - }, - patterns: [include(this.term)], - }, - ], - }; - } - - public bindTermArgs(): schema.Rule { - return { - patterns: [ - { - begin: alt(Token.TILDE, Token.QUESTION_MARK), - end: alt(Token.COLON, lookAhead(complement(Class.space))), - applyEndPatternLast: true, - beginCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [ - { - begin: this.lastOps(Token.TILDE, Token.QUESTION_MARK), - end: alt(this.identLower(), lookBehind(Token.RIGHT_PARENTHESIS)), - endCaptures: { - 0: { name: Scope.NAME_FIELD() }, - }, - patterns: [ - include(this.comment), - { - begin: seq(Token.LEFT_PARENTHESIS, negativeLookAhead(Token.ASTERISK)), - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - { - begin: lookBehind(Token.LEFT_PARENTHESIS), - end: alt(Token.COLON, Token.EQUALS_SIGN), - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [ - { - match: this.identLower(), - name: Scope.NAME_FIELD(), - }, - ], - }, - { - begin: lookBehind(Token.COLON), - end: alt(Token.EQUALS_SIGN, lookAhead(Token.RIGHT_PARENTHESIS)), - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [include(this.type)], - }, - { - begin: this.lastOps(Token.EQUALS_SIGN), - end: lookAhead(Token.RIGHT_PARENTHESIS), - patterns: [include(this.term)], - }, - ], - }, - ], - }, - ], - }, - include(this.pattern), - ], - }; - } - - public bindType(): schema.Rule { - return { - patterns: [ - { - begin: lastWords(Token.AND, Token.TYPE), - end: alt(this.ops(alt(seq(Token.PLUS_SIGN, Token.EQUALS_SIGN), Token.EQUALS_SIGN)), this.declEnd()), - endCaptures: { - 0: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [ - include(this.attributeIdentifier), - include(this.pathType), - { - match: this.identLower(), - name: Scope.TYPE_CONSTRUCTOR(), - }, - include(this.type), - ], - }, - { - begin: this.lastOps(seq(Token.PLUS_SIGN, Token.EQUALS_SIGN), Token.EQUALS_SIGN), - end: alt(words(Token.AND), this.declEnd()), - endCaptures: { - 0: { name: Scope.ITEM_AND() }, - }, - patterns: [include(this.bindConstructor)], - }, - ], - }; - } - - public comment(): schema.Rule { - return { - patterns: [ - include(this.attribute), - include(this.extension), - include(this.commentBlock), - include(this.commentDoc), - ], - }; - } - - public commentBlock(): schema.Rule { - return this.commentBlockWith(Token.LEFT_PARENTHESIS, Token.RIGHT_PARENTHESIS); - } - - public commentBlockWith(begin: string, end: string): schema.Rule { - return { - begin: seq(begin, Token.ASTERISK, negativeLookAhead(seq(Token.ASTERISK, complement(end)))), - end: seq(Token.ASTERISK, end), - name: Scope.META_COMMENT(), - contentName: Scope.STYLE_ITALICS(), - patterns: [include(this.commentBlock), include(this.commentDoc)], - }; - } - - public commentDoc(): schema.Rule { - return this.commentDocWith(Token.LEFT_PARENTHESIS, Token.RIGHT_PARENTHESIS); - } - - public commentDocWith(begin: string, end: string): schema.Rule { - return { - begin: seq(begin, Token.ASTERISK, Token.ASTERISK), - end: seq(Token.ASTERISK, end), - name: Scope.META_COMMENT(), - contentName: Scope.STYLE_ITALICS, - patterns: [{ match: Token.ASTERISK }, include(this.comment)], - }; - } - - public decl(): schema.Rule { - return { - patterns: [ - include(this.declClass), - include(this.declException), - include(this.declInclude), - include(this.declModule), - include(this.declOpen), - include(this.declTerm), - include(this.declType), - ], - }; - } - - public declClass(): schema.Rule { - return { - begin: words(Token.CLASS), - end: this.declEndItem(), - beginCaptures: { - 0: { name: Scope.ITEM_CLASS() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - include(this.comment), - include(this.pragma), - { - begin: lastWords(Token.CLASS), - end: alt(words(Token.TYPE), this.declEndSans(Token.TYPE)), - beginCaptures: { - 0: { name: Scope.ITEM_CLASS() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [include(this.bindClassTerm)], - }, - { - begin: lastWords(Token.TYPE), - end: this.declEnd(), - patterns: [include(this.bindClassType)], - }, - ], - }; - } - - // FIXME: support `exception CONSTR-NAME = CONSTR` - public declException(): schema.Rule { - return { - begin: words(Token.EXCEPTION), - end: this.declEndItem(), - beginCaptures: { - 0: { name: `keyword ${Scope.STYLE_UNDERLINE()}` }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - include(this.attributeIdentifier), - include(this.comment), - include(this.pragma), - include(this.bindConstructor), - ], - }; - } - - public declInclude(): schema.Rule { - return { - begin: words(Token.INCLUDE), - end: this.declEndItem(), - beginCaptures: { - 0: { name: Scope.ITEM_INCLUDE() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - include(this.attributeIdentifier), - include(this.comment), - include(this.pragma), - include(this.signature), - ], - }; - } - - public declInherit(...rest: schema.Rule[]): schema.Rule { - return { - begin: words(Token.INHERIT), - end: this.declEndItem(), - beginCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - { - begin: words(Token.AS), - end: this.declEndItem(), - beginCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [include(this.variablePattern)], - }, - ...rest, - ], - }; - } - - public declModule(): schema.Rule { - return { - begin: alt(lastWords(Token.MODULE), words(Token.MODULE)), - end: this.declEndItem(), - beginCaptures: { - 0: { name: Scope.ITEM_MODULE() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - include(this.comment), - include(this.pragma), - { - begin: lastWords(Token.MODULE), - end: alt(capture(words(Token.TYPE)), lookAhead(set(Class.upper))), - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [ - include(this.attributeIdentifier), - include(this.comment), - { - match: words(Token.REC), - name: Scope.KEYWORD_REC(), - }, - ], - }, - { - begin: lastWords(Token.TYPE), - end: this.declEnd(), - patterns: [include(this.bindSignature)], - }, - { - begin: lookAhead(set(Class.upper)), - end: this.declEnd(), - patterns: [include(this.bindStructure)], - }, - ], - }; - } - - public declOpen(): schema.Rule { - return { - begin: words(Token.OPEN), - end: this.declEndItem(), - beginCaptures: { - 0: { name: Scope.ITEM_OPEN() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - include(this.attributeIdentifier), - include(this.comment), - include(this.pragma), - include(this.pathModuleExtended), - ], - }; - } - - public declTerm(): schema.Rule { - return { - begin: seq( - words(group(alt(capture(alt(Token.EXTERNAL, Token.VAL)), capture(Token.METHOD), capture(Token.LET)))), - capture(opt("!")), - ), - end: this.declEndItem(), - beginCaptures: { - 1: { name: Scope.ITEM_VAL() }, - 2: { name: Scope.ITEM_METHOD() }, - 3: { name: Scope.ITEM_LET() }, - 4: { name: Scope.STYLE_OPERATOR() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.pragma), include(this.bindTerm), include(this.comment)], - }; - } - - public declType(): schema.Rule { - return { - begin: alt(lastWords(Token.TYPE), words(Token.TYPE)), - end: this.declEndItem(), - beginCaptures: { - 0: { name: `keyword ${Scope.STYLE_UNDERLINE()}` }, - }, - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.comment), include(this.pragma), include(this.bindType)], - }; - } - - public extension(): schema.Rule { - return { - begin: seq(capture(Token.LEFT_SQUARE_BRACKET), capture(this.ops(`${Token.PERCENT_SIGN}{1,3}`))), - end: Token.RIGHT_SQUARE_BRACKET, - beginCaptures: { - 1: { name: Scope.TERM_CONSTRUCTOR() }, - 2: { name: Scope.STYLE_OPERATOR() }, - }, - endCaptures: { - 0: { name: Scope.TERM_CONSTRUCTOR() }, - }, - patterns: [include(this.attributePayload)], - }; - } - - public lastOps(...rest: string[]): string { - const result: string[] = []; - for (const token of rest) { - result.push(`[^${seq(...this.operatorTokens())}]${token}`, `^${token}`); - } - return group(seq(lookBehind(group(alt(...result))), negativeLookAhead(set(...this.operatorTokens())))); - } - - public literal(): schema.Rule { - return { - patterns: [ - include(this.termConstructor), - include(this.literalArray), - include(this.literalBoolean), - include(this.literalCharacter), - include(this.literalList), - include(this.literalNumber), - include(this.literalObjectTerm), - include(this.literalString), // NOTE: string before record because of {| … |} - include(this.literalRecord), - include(this.literalUnit), - ], - }; - } - - public literalArray(): schema.Rule { - return { - begin: seq(Token.LEFT_SQUARE_BRACKET, Token.VERTICAL_LINE), - end: seq(Token.VERTICAL_LINE, Token.RIGHT_SQUARE_BRACKET), - captures: { - 0: { name: Scope.TERM_CONSTRUCTOR() }, - }, - patterns: [include(this.term)], - }; - } - - public literalBoolean(): schema.Rule { - return { - match: words(alt(Token.FALSE, Token.TRUE)), - name: Scope.TERM_CONSTRUCTOR(), - }; - } - - public literalCharacter(): schema.Rule { - return { - begin: seq(negativeLookBehind(set(Class.word)), Token.APOSTROPHE), - end: Token.APOSTROPHE, - name: Scope.TERM_CHARACTER(), - patterns: [include(this.literalCharacterEscape)], - }; - } - - public literalCharacterEscape(): schema.Rule { - return this.escapes(Token.APOSTROPHE); - } - - public literalClassType(): schema.Rule { - return this.literalObjectWith(this.declInherit(include(this.type))); - } - - public literalList(): schema.Rule { - return { - patterns: [ - { - begin: Token.LEFT_SQUARE_BRACKET, - end: Token.RIGHT_SQUARE_BRACKET, - captures: { - 0: { name: Scope.TERM_CONSTRUCTOR() }, - }, - patterns: [include(this.term)], - }, - ], - }; - } - - public literalNumber(): schema.Rule { - return { - match: seq( - negativeLookBehind(set(Class.alpha)), - seq(set(Class.digit), many(set(Class.digit))), - opt(capture(seq(Token.FULL_STOP, set(Class.digit), many(set(Class.digit))))), - ), - name: Scope.TERM_NUMBER(), - }; - } - - public literalRecord(): schema.Rule { - return this.recordWith(include(this.term)); - } - - public literalString(): schema.Rule { - return { - patterns: [ - { - begin: Token.QUOTATION_MARK, - end: Token.QUOTATION_MARK, - name: Scope.TERM_STRING(), - patterns: [include(this.literalStringEscape)], - }, - { - begin: seq( - capture(Token.LEFT_CURLY_BRACKET), - capture(opt(many(set(Token.LOW_LINE, Class.lower)))), - capture(Token.VERTICAL_LINE), - ), - end: seq(capture(Token.VERTICAL_LINE), capture("\\2"), capture(Token.RIGHT_CURLY_BRACKET)), - name: Scope.TERM_STRING(), - patterns: [include(this.literalStringEscape)], - }, - ], - }; - } - - public literalStringEscape(): schema.Rule { - return this.escapes(); - } - - public literalUnit(): schema.Rule { - return { - match: seq(Token.LEFT_PARENTHESIS, Token.RIGHT_PARENTHESIS), - name: Scope.TERM_CONSTRUCTOR(), - }; - } - - public literalObjectWith(...rest: schema.Rule[]): schema.Rule { - return { - patterns: [ - include(this.comment), - { - begin: words(Token.OBJECT), - end: words(Token.END), - captures: { - 0: { name: Scope.LITERAL_OBJECT() }, - }, - patterns: [...rest, include(this.pattern), include(this.declTerm)], - }, - { - begin: Token.LEFT_SQUARE_BRACKET, - end: Token.RIGHT_SQUARE_BRACKET, - }, - ], - }; - } - - public literalObjectTerm(): schema.Rule { - return this.literalObjectWith(this.declInherit(include(this.term))); - } - - public operator(): string { - return basis.manyOne(set(...this.operatorTokens())); - } - - public operatorTokens(): string[] { - return ["#", "\\-", ":", "!", "?", ".", "@", "*", "/", "&", "%", "^", "+", "<", "=", ">", "|", "~", "$"]; - } - - public ops(arg: string): string { - return seq( - negativeLookBehind(set(...this.operatorTokens())), - arg, - negativeLookAhead(set(...this.operatorTokens())), - ); - } - - public pathModuleExtended(): schema.Rule { - return { - patterns: [ - include(this.pathModulePrefixExtended), - { - match: this.identUpper(), - name: Scope.NAME_MODULE(), - }, - ], - }; - } - - public pathModuleSimple(): schema.Rule { - return { - patterns: [ - include(this.pathModulePrefixSimple), - { - match: this.identUpper(), - name: Scope.NAME_MODULE(), - }, - ], - }; - } - - public pathModulePrefix(continueWith: string[], ...rest: schema.Rule[]): schema.Rule { - return { - begin: seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), alt(Token.FULL_STOP, ...continueWith)))), - end: negativeLookAhead(alt(set(Class.space, Token.FULL_STOP), ...continueWith)), - beginCaptures: { - 0: { name: Scope.NAME_MODULE() }, - }, - patterns: [ - include(this.comment), - ...rest, - { - begin: this.ops(Token.FULL_STOP), - end: alt( - capture(seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), alt(Token.FULL_STOP, "$"))))), - capture(seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), group(alt(...continueWith)))))), - capture(seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), Token.RIGHT_PARENTHESIS)))), - negativeLookAhead(alt(set(Class.space, Token.FULL_STOP, Class.upper), ...continueWith)), - ), - beginCaptures: { - 0: { name: Scope.PUNCTUATION_DOT() }, - }, - endCaptures: { - 1: { name: Scope.NAME_MODULE() }, - 2: { name: Scope.TYPE_CONSTRUCTOR() }, - 3: { name: Scope.VARIABLE_PATTERN() }, - }, - }, - ], - }; - } - - public pathModulePrefixSimple(): schema.Rule { - return { - begin: seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), Token.FULL_STOP))), - end: negativeLookAhead(set(Class.space, Token.FULL_STOP)), - beginCaptures: { - 0: { name: Scope.NAME_MODULE() }, - }, - patterns: [ - include(this.comment), - { - begin: this.ops(Token.FULL_STOP), - end: alt( - capture(seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), Token.FULL_STOP)))), - capture(seq(this.identUpper(), lookAhead(seq(many(set(Class.space)))))), - negativeLookAhead(set(Class.space, Token.FULL_STOP, Class.upper)), - ), - beginCaptures: { - 0: { name: Scope.PUNCTUATION_DOT() }, - }, - endCaptures: { - 1: { name: Scope.NAME_MODULE() }, - 2: { name: Scope.TERM_CONSTRUCTOR() }, - }, - }, - ], - }; - } - - public pathModulePrefixExtended(): schema.Rule { - return this.pathModulePrefix(["$", Token.LEFT_PARENTHESIS], this.pathModulePrefixExtendedParens()); - } - - public pathModulePrefixExtendedParens(): schema.Rule { - return { - begin: Token.LEFT_PARENTHESIS, - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [ - { - match: capture(seq(this.identUpper(), lookAhead(seq(many(set(Class.space)), Token.RIGHT_PARENTHESIS)))), - name: Scope.VARIABLE_PATTERN(), - }, - include(this.structure), - ], - }; - } - - public pathRecord(): schema.Rule { - return { - patterns: [ - { - begin: this.identLower(), - end: seq( - lookAhead(complement(Class.space, Token.FULL_STOP)), - negativeLookAhead(seq(Token.LEFT_PARENTHESIS, Token.ASTERISK)), - ), - patterns: [ - include(this.comment), - { - begin: alt(this.lastOps(Token.FULL_STOP), this.ops(Token.FULL_STOP)), - end: alt( - capture(this.ops(Token.FULL_STOP)), - capture(this.identLowerPath()), - lookBehind(Token.RIGHT_PARENTHESIS), - lookBehind(Token.RIGHT_SQUARE_BRACKET), - ), - beginCaptures: { - 0: { name: Scope.PUNCTUATION_DOT() }, - }, - endCaptures: { - 1: { name: Scope.PUNCTUATION_DOT() }, - 2: { name: Scope.NAME_FIELD() }, - }, - patterns: [ - include(this.comment), - include(this.pathModulePrefixSimple), - { - begin: seq(Token.LEFT_PARENTHESIS, negativeLookAhead(Token.ASTERISK)), - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [include(this.term)], - }, - { - begin: Token.LEFT_SQUARE_BRACKET, - end: Token.RIGHT_SQUARE_BRACKET, - captures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [include(this.pattern)], - }, - ], - }, - ], - }, - ], - }; - } - - public pathType(): schema.Rule { - return { - patterns: [ - include(this.pathModulePrefix), - { - match: this.identLower(), - name: Scope.NAME_TYPE(), - }, - ], - }; - } - - public pattern(): schema.Rule { - return { - patterns: [ - include(this.comment), - include(this.patternArray), - include(this.patternLazy), - include(this.patternList), - include(this.patternMisc), - include(this.patternModule), - include(this.patternRecord), - include(this.literal), - include(this.patternParens), - include(this.patternType), - include(this.variablePattern), - include(this.termOperator), - ], - }; - } - - public patternArray(): schema.Rule { - return { - begin: seq(Token.LEFT_SQUARE_BRACKET, Token.VERTICAL_LINE), - end: seq(Token.VERTICAL_LINE, Token.RIGHT_SQUARE_BRACKET), - captures: { - 0: { name: Scope.TERM_CONSTRUCTOR() }, - }, - patterns: [include(this.pattern)], - }; - } - - public patternLazy(): schema.Rule { - return { - match: Token.LAZY, - name: Scope.STYLE_OPERATOR(), - }; - } - - public patternList(): schema.Rule { - return { - begin: Token.LEFT_SQUARE_BRACKET, - end: Token.RIGHT_SQUARE_BRACKET, - captures: { - 0: { name: Scope.TERM_CONSTRUCTOR() }, - }, - patterns: [include(this.pattern)], - }; - } - - public patternMisc(): schema.Rule { - return { - match: alt(capture(this.ops(Token.COMMA)), capture(this.operator()), words(capture(Token.AS))), - captures: { - 1: { name: Scope.PUNCTUATION_COMMA() }, - 2: { name: Scope.STYLE_OPERATOR() }, - 3: { name: Scope.KEYWORD_AS() }, - }, - }; - } - - public patternModule(): schema.Rule { - return { - begin: words(Token.MODULE), - end: lookAhead(Token.RIGHT_PARENTHESIS), - beginCaptures: { - 0: { name: Scope.TERM_MODULE() }, - }, - patterns: [include(this.declModule)], - }; - } - - public patternParens(): schema.Rule { - return this.parens(ref(this.pattern), ref(this.type)); - } - - public patternRecord(): schema.Rule { - return this.recordWith(include(this.pattern)); - } - - public patternType(): schema.Rule { - return { - begin: words(Token.TYPE), - end: lookAhead(Token.RIGHT_PARENTHESIS), - beginCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [include(this.declType)], - }; - } - - public pragma(): schema.Rule { - return { - begin: this.ops(Token.NUMBER_SIGN), - end: this.declEnd(), - beginCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.comment), include(this.literalNumber), include(this.literalString)], - }; - } - - public recordWith(...definiens: schema.Rule[]): schema.Rule { - return { - begin: Token.LEFT_CURLY_BRACKET, - end: Token.RIGHT_CURLY_BRACKET, - captures: { - 0: { name: `${Scope.TERM_CONSTRUCTOR()} ${Scope.STYLE_BOLD()}` }, - }, - patterns: [ - { - begin: lookBehind(alt(Token.LEFT_CURLY_BRACKET, Token.SEMICOLON)), - end: alt( - capture(Token.COLON), - capture(Token.EQUALS_SIGN), - capture(Token.SEMICOLON), - capture(Token.WITH), - lookAhead(Token.RIGHT_CURLY_BRACKET), - ), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - 3: { name: Scope.STYLE_OPERATOR() }, - 4: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [ - include(this.comment), - include(this.pathModulePrefixSimple), - { - match: this.identLower(), - name: `${Scope.NAME_FIELD()} ${Scope.STYLE_ITALICS()}`, - }, - ], - }, - { - begin: lastWords(Token.WITH), - end: alt( - capture(Token.COLON), - capture(Token.EQUALS_SIGN), - capture(Token.SEMICOLON), - lookAhead(Token.RIGHT_CURLY_BRACKET), - ), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - 3: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [ - { - match: this.identLower(), - name: `${Scope.NAME_FIELD()} ${Scope.STYLE_ITALICS()}`, - }, - ], - }, - { - begin: this.lastOps(Token.COLON), - end: alt(capture(Token.SEMICOLON), capture(Token.EQUALS_SIGN), lookAhead(Token.RIGHT_CURLY_BRACKET)), - endCaptures: { - 1: { name: Scope.STYLE_OPERATOR() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [include(this.type)], - }, - { - begin: this.lastOps(Token.EQUALS_SIGN), - end: alt(Token.SEMICOLON, lookAhead(Token.RIGHT_CURLY_BRACKET)), - endCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: definiens, - }, - ], - }; - } - - public signature(): schema.Rule { - return { - patterns: [ - include(this.comment), - include(this.signatureLiteral), - include(this.signatureFunctor), - include(this.pathModuleExtended), - include(this.signatureParens), - include(this.signatureRecovered), - include(this.signatureConstraints), - ], - }; - } - - public signatureConstraints(): schema.Rule { - return { - begin: words(Token.WITH), - end: alt(lookAhead(Token.RIGHT_PARENTHESIS), this.declEnd()), - beginCaptures: { - 0: { name: Scope.SIGNATURE_WITH() }, - }, - patterns: [ - { - begin: lastWords(Token.WITH), - end: words(group(alt(capture(Token.MODULE), capture(Token.TYPE)))), - endCaptures: { - 1: { name: Scope.TERM_MODULE() }, - 2: { name: Scope.STYLE_KEYWORD() }, - }, - }, - include(this.declModule), - include(this.declType), - ], - }; - } - - public signatureFunctor(): schema.Rule { - return { - patterns: [...this.functor(this.signature)], - }; - } - - public signatureLiteral(): schema.Rule { - return this.signatureLiteralWith(words(Token.SIG), words(Token.END)); - } - - public signatureLiteralWith(begin: string, end: string): schema.Rule { - return { - begin, - end, - captures: { - 0: { name: Scope.LITERAL_SIGNATURE() }, - }, - patterns: [include(this.comment), include(this.pragma), include(this.decl)], - }; - } - - public signatureParens(): schema.Rule { - return this.parens(ref(this.signature), ref(this.signature)); - } - - public signatureRecovered(): schema.Rule { - return { - patterns: [ - { - begin: alt( - Token.LEFT_PARENTHESIS, - this.lastOps(Token.COLON, seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN)), - lastWords(Token.INCLUDE, Token.OPEN), - ), - end: alt(words(Token.MODULE), negativeLookAhead(alt("$", set(Class.space), words(Token.MODULE)))), - endCaptures: { - 0: { name: Scope.TERM_MODULE() }, - }, - }, - { - begin: lastWords(Token.MODULE), - end: this.declEnd(), - patterns: [ - { - begin: lastWords(Token.MODULE), - end: words(Token.TYPE), - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - }, - { - begin: lastWords(Token.TYPE), - end: words(Token.OF), - endCaptures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - }, - { - begin: lastWords(Token.OF), - end: this.declEnd(), - patterns: [include(this.signature)], - }, - ], - }, - ], - }; - } - - public structure(): schema.Rule { - return { - patterns: [ - include(this.comment), - include(this.structureLiteral), - include(this.structureFunctor), - include(this.pathModuleExtended), - include(this.structureParens), - ], - }; - } - - public structureFunctor(): schema.Rule { - return { - patterns: [...this.functor(this.structure)], - }; - } - - public structureLiteral(): schema.Rule { - return this.structureLiteralWith(words(Token.STRUCT), words(Token.END)); - } - - public structureLiteralWith(begin: string, end: string): schema.Rule { - return { - begin, - end, - captures: { - 0: { name: Scope.LITERAL_STRUCTURE() }, - }, - patterns: [include(this.comment), include(this.pragma), include(this.decl)], - }; - } - - public structureParens(): schema.Rule { - return { - begin: Token.LEFT_PARENTHESIS, - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.structureUnpack), include(this.structure)], - }; - } - - public structureUnpack(): schema.Rule { - return { - begin: words(Token.VAL), - end: lookAhead(Token.RIGHT_PARENTHESIS), - beginCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - }; - } - - public term(): schema.Rule { - return { - patterns: [include(this.termLet), include(this.termAtomic)], - }; - } - - public termAtomic(): schema.Rule { - return { - patterns: [ - include(this.comment), - include(this.termConditional), - include(this.termConstructor), - include(this.termDelim), - include(this.termFor), - include(this.termFunction), - include(this.literal), - include(this.termMatch), - include(this.termMatchRule), - include(this.termPun), - include(this.termOperator), - include(this.termTry), - include(this.termWhile), - include(this.pathRecord), - ], - }; - } - - public termConditional(): schema.Rule { - return { - match: words(group(alt(Token.IF, Token.THEN, Token.ELSE))), - name: Scope.TERM_IF(), - }; - } - - public termConstructor(): schema.Rule { - return { - patterns: [ - include(this.pathModulePrefixSimple), - { - match: this.identUpper(), - name: Scope.TERM_CONSTRUCTOR(), - }, - ], - }; - } - - public termDelim(): schema.Rule { - return { - patterns: [ - { - begin: seq(Token.LEFT_PARENTHESIS, negativeLookAhead(Token.RIGHT_PARENTHESIS)), - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.term)], - }, - { - begin: words(Token.BEGIN), - end: words(Token.END), - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [include(this.attributeIdentifier), include(this.term)], - }, - ], - }; - } - - public termFor(): schema.Rule { - return { - patterns: [ - { - begin: words(Token.FOR), - end: words(Token.DONE), - beginCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [ - { - begin: lastWords(Token.FOR), - end: this.ops(Token.EQUALS_SIGN), - endCaptures: { - 0: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [include(this.pattern)], - }, - { - begin: this.lastOps(Token.EQUALS_SIGN), - end: words(group(alt(Token.DOWNTO, Token.TO))), - endCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [include(this.term)], - }, - { - begin: lastWords(Token.TO), - end: words(Token.DO), - endCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [include(this.term)], - }, - { - begin: lastWords(Token.DO), - end: lookAhead(words(Token.DONE)), - patterns: [include(this.term)], - }, - ], - }, - ], - }; - } - - public termFunction(): schema.Rule { - return { - match: words(group(alt(capture(Token.FUN), capture(Token.FUNCTION)))), - captures: { - 1: { name: Scope.TERM_FUN() }, - 2: { name: Scope.TERM_FUNCTION() }, - }, - }; - } - - public termLet(): schema.Rule { - return { - patterns: [ - { - // = … let - begin: alt( - seq( - group( - alt( - this.lastOps(Token.EQUALS_SIGN, seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN)), - lookBehind(alt(Token.SEMICOLON, Token.LEFT_PARENTHESIS)), - ), - ), - lookAhead(alt(set(Class.space), words(Token.LET))), - ), - lastWords(Token.BEGIN, Token.DO, Token.ELSE, Token.IN, Token.STRUCT, Token.THEN, Token.TRY), - seq(this.lastOps(seq(Token.COMMERCIAL_AT, Token.COMMERCIAL_AT)), manyOne(set(Class.space))), - ), - end: alt( - words(group(alt(capture(Token.AND), capture(Token.LET)))), - seq(lookAhead(complement(Class.space)), negativeLookAhead(seq(Token.LEFT_PARENTHESIS, Token.ASTERISK))), - ), - endCaptures: { - 1: { name: Scope.ITEM_AND() }, - 2: { name: Scope.TERM_LET() }, - }, - patterns: [include(this.comment)], - }, - { - // let … - begin: alt(lastWords(Token.AND, Token.LET), words(capture(Token.LET))), - end: alt(words(group(alt(capture(Token.AND), capture(Token.IN)))), this.declEndSans(Token.AND, Token.IN)), - beginCaptures: { - 1: { name: Scope.TERM_LET() }, - }, - endCaptures: { - 1: { name: Scope.ITEM_AND() }, - 2: { name: Scope.TERM_LET() }, - }, - patterns: [include(this.bindTerm)], - }, - ], - }; - } - - public termMatch(): schema.Rule { - return { - begin: words(Token.MATCH), - end: words(Token.WITH), - captures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [include(this.term)], - }; - } - - public termMatchRule(): schema.Rule { - return { - patterns: [ - { - begin: lastWords(Token.FUN, Token.FUNCTION, Token.WITH), - end: this.ops(alt(capture(Token.VERTICAL_LINE), capture(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN)))), - endCaptures: { - 1: { name: Scope.VERTICAL_LINE() }, - 2: { name: Scope.VERTICAL_LINE() }, - }, - patterns: [include(this.comment), include(this.attributeIdentifier), include(this.pattern)], - }, - { - // FIXME: special case of lastOps to prevent starting at [| - begin: alt( - group( - seq( - lookBehind( - group( - alt( - seq(complement(Token.LEFT_SQUARE_BRACKET, ...this.operatorTokens()), Token.VERTICAL_LINE), - seq(`^`, Token.VERTICAL_LINE), - ), - ), - ), - negativeLookAhead(set(...this.operatorTokens())), - ), - ), - this.ops(Token.VERTICAL_LINE), - ), - end: this.ops(alt(capture(Token.VERTICAL_LINE), capture(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN)))), - beginCaptures: { - 0: { name: Scope.VERTICAL_LINE() }, - }, - endCaptures: { - 1: { name: Scope.VERTICAL_LINE() }, - 2: { name: Scope.VERTICAL_LINE() }, - }, - patterns: [ - include(this.pattern), - { - begin: words(Token.WHEN), - end: lookAhead(this.ops(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN))), - beginCaptures: { - 0: { name: Scope.KEYWORD_WHEN() }, - }, - patterns: [include(this.term)], - }, - ], - }, - ], - }; - } - - public termOperator(): schema.Rule { - return { - patterns: [ - { - begin: this.ops(Token.NUMBER_SIGN), - end: this.identLower(), - beginCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - endCaptures: { - 0: { name: Scope.NAME_METHOD() }, - }, - }, - { - match: seq(Token.LESS_THAN_SIGN, Token.HYPHEN_MINUS), - captures: { - 0: { name: `${Scope.STYLE_CONTROL()} ${Scope.STYLE_BOLD()}` }, - }, - }, - { - match: alt(capture(alt(Token.COMMA, this.operator())), capture(Token.SEMICOLON)), - captures: { - 1: { name: Scope.STYLE_OPERATOR() }, - 2: { name: Scope.STYLE_OPERATOR() }, - }, - }, - { - match: words( - group( - alt( - Token.AND, - Token.ASSERT, - Token.ASR, - Token.LAND, - Token.LAZY, - Token.LSR, - Token.LXOR, - Token.MOD, - Token.NEW, - Token.OR, - ), - ), - ), - name: Scope.TERM_BUILTIN(), - }, - ], - }; - } - - public termPun(): schema.Rule { - return { - begin: this.ops(alt(Token.QUESTION_MARK, Token.TILDE)), - end: alt(Token.COLON, lookAhead(complement(Class.space, Token.COLON))), - applyEndPatternLast: true, - beginCaptures: { - 0: { name: Scope.STYLE_OPERATOR() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [ - { - begin: this.lastOps(Token.QUESTION_MARK, Token.TILDE), - end: this.identLower(), - endCaptures: { - 0: { name: Scope.NAME_FIELD() }, - }, - }, - ], - }; - } - - public termTry(): schema.Rule { - return { - begin: words(Token.TRY), - end: words(Token.WITH), - captures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [include(this.term)], - }; - } - - public termWhile(): schema.Rule { - return { - patterns: [ - { - begin: words(Token.WHILE), - end: words(Token.DONE), - beginCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - endCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [ - { - begin: lastWords(Token.WHILE), - end: words(Token.DO), - endCaptures: { - 0: { name: Scope.STYLE_CONTROL() }, - }, - patterns: [include(this.term)], - }, - { - begin: lastWords(Token.DO), - end: lookAhead(words(Token.DONE)), - patterns: [include(this.term)], - }, - ], - }, - ], - }; - } - - public type(): schema.Rule { - return { - patterns: [ - include(this.comment), - { - match: words(Token.NONREC), - name: Scope.KEYWORD_REC(), - }, - include(this.pathModulePrefixExtended), - include(this.typeLabel), - include(this.typeObject), - include(this.typeOperator), - include(this.typeParens), - include(this.typePolymorphicVariant), - include(this.typeRecord), - include(this.typeConstructor), - ], - }; - } - - public typeConstructor(): schema.Rule { - return { - patterns: [ - { - begin: alt( - capture(Token.LOW_LINE), - capture(this.identLower()), - seq(capture(Token.APOSTROPHE), capture(this.identLower())), - lookBehind(alt(seq(complement(Token.ASTERISK), Token.RIGHT_PARENTHESIS), Token.RIGHT_SQUARE_BRACKET)), - ), - end: alt( - lookAhead( - alt( - seq(Token.LEFT_PARENTHESIS, negativeLookAhead(Token.ASTERISK)), - Token.ASTERISK, - Token.COLON, - Token.COMMA, - Token.EQUALS_SIGN, - Token.FULL_STOP, - Token.GREATER_THAN_SIGN, - Token.HYPHEN_MINUS, - Token.LEFT_CURLY_BRACKET, - Token.LEFT_SQUARE_BRACKET, - Token.PLUS_SIGN, - Token.RIGHT_CURLY_BRACKET, - Token.RIGHT_PARENTHESIS, - Token.RIGHT_SQUARE_BRACKET, - Token.SEMICOLON, - Token.VERTICAL_LINE, - ), - ), - seq( - capture(this.identLower()), - many(seq(Class.space)), - negativeLookAhead(alt(seq(Token.LEFT_PARENTHESIS, Token.ASTERISK), set(Class.word))), - ), - this.declEnd(), - ), - beginCaptures: { - 1: { name: Scope.META_COMMENT() }, - 3: { name: Scope.PUNCTUATION_APOSTROPHE() }, - 4: { name: Scope.VARIABLE_TYPE() }, - }, - endCaptures: { - 1: { name: Scope.TYPE_CONSTRUCTOR() }, - }, - patterns: [include(this.comment), include(this.pathModulePrefixExtended)], - }, - ], - }; - } - - public typeLabel(): schema.Rule { - return { - patterns: [ - { - begin: seq( - capture(opt(Token.QUESTION_MARK)), - capture(this.identLower()), - many(set(Class.space)), - capture(this.ops(Token.COLON)), - ), - end: lookAhead(this.ops(seq(Token.HYPHEN_MINUS, Token.GREATER_THAN_SIGN))), - captures: { - 1: { - name: `keyword ${Scope.STYLE_BOLD()} ${Scope.STYLE_ITALICS()}`, - }, - 2: { name: `${Scope.NAME_FIELD()} ${Scope.STYLE_ITALICS()}` }, - 3: { name: Scope.STYLE_KEYWORD() }, - }, - patterns: [include(this.type)], - }, - ], - }; - } - - public typeModule(): schema.Rule { - return { - begin: words(Token.MODULE), - end: lookAhead(Token.RIGHT_PARENTHESIS), - beginCaptures: { - 0: { name: Scope.TERM_MODULE() }, - }, - patterns: [include(this.pathModuleExtended), include(this.signatureConstraints)], - }; - } - - public typeObject(): schema.Rule { - return { - begin: Token.LESS_THAN_SIGN, - end: Token.GREATER_THAN_SIGN, - captures: { - 0: { name: `${Scope.TERM_CONSTRUCTOR()} ${Scope.STYLE_BOLD()}` }, - }, - patterns: [ - { - begin: lookBehind(alt(Token.LESS_THAN_SIGN, Token.SEMICOLON)), - end: alt(capture(Token.COLON), lookAhead(Token.GREATER_THAN_SIGN)), - endCaptures: { - 1: { name: Scope.PUNCTUATION_COLON() }, - 3: { name: Scope.STYLE_OPERATOR() }, - 4: { name: Scope.STYLE_OPERATOR() }, - }, - patterns: [ - include(this.comment), - include(this.pathModulePrefixSimple), - { - match: this.identLower(), - name: `${Scope.NAME_FIELD()} ${Scope.STYLE_ITALICS()}`, - }, - ], - }, - { - begin: this.lastOps(Token.COLON), - end: alt(capture(Token.SEMICOLON), lookAhead(Token.GREATER_THAN_SIGN)), - endCaptures: { - 1: { name: Scope.STYLE_OPERATOR() }, - 2: { name: Scope.PUNCTUATION_EQUALS() }, - }, - patterns: [include(this.type)], - }, - ], - }; - } - - public typeOperator(): schema.Rule { - return { - patterns: [ - { - match: alt(Token.COMMA, Token.SEMICOLON, this.operator()), - name: Scope.OPERATOR_TYPE(), - }, - ], - }; - } - - public typeParens(): schema.Rule { - return { - begin: Token.LEFT_PARENTHESIS, - end: Token.RIGHT_PARENTHESIS, - captures: { - 0: { name: Scope.STYLE_DELIMITER() }, - }, - patterns: [ - { - match: Token.COMMA, - name: Scope.STYLE_OPERATOR(), - }, - include(this.typeModule), - include(this.type), - ], - }; - } - - public typePolymorphicVariant(): schema.Rule { - return { - begin: Token.LEFT_SQUARE_BRACKET, - end: Token.RIGHT_SQUARE_BRACKET, - patterns: [], - }; - } - - public typeRecord(): schema.Rule { - return this.recordWith(include(this.type)); - } - - public variableModule(): schema.Rule { - return { - match: this.identUpper(), - captures: { - 0: { name: Scope.VARIABLE_PATTERN() }, - }, - }; - } - - public variablePattern(): schema.Rule { - return { - match: alt(capture(words(Token.LOW_LINE)), capture(this.identLower())), - captures: { - 1: { name: Scope.META_COMMENT() }, - 2: { name: Scope.VARIABLE_PATTERN() }, - }, - }; - } - - public render(): schema.IGrammar { - return { - name: `OCaml`, - scopeName: `source.ocaml`, - fileTypes: [`.ml`, `.mli`], - patterns: [include(this.comment), include(this.pragma), include(this.decl)], - repository: { - attribute: this.attribute(), - attributeIdentifier: this.attributeIdentifier(), - attributePayload: this.attributePayload(), - bindClassTerm: this.bindClassTerm(), - bindClassType: this.bindClassType(), - bindConstructor: this.bindConstructor(), - bindSignature: this.bindSignature(), - bindStructure: this.bindStructure(), - bindTerm: this.bindTerm(), - bindTermArgs: this.bindTermArgs(), - bindType: this.bindType(), - comment: this.comment(), - commentBlock: this.commentBlock(), - commentDoc: this.commentDoc(), - decl: this.decl(), - declClass: this.declClass(), - declException: this.declException(), - declInclude: this.declInclude(), - declModule: this.declModule(), - declOpen: this.declOpen(), - declTerm: this.declTerm(), - declType: this.declType(), - extension: this.extension(), - literal: this.literal(), - literalArray: this.literalArray(), - literalBoolean: this.literalBoolean(), - literalCharacter: this.literalCharacter(), - literalCharacterEscape: this.literalCharacterEscape(), - literalClassType: this.literalClassType(), - literalList: this.literalList(), - literalNumber: this.literalNumber(), - literalObjectTerm: this.literalObjectTerm(), - literalRecord: this.literalRecord(), - literalString: this.literalString(), - literalStringEscape: this.literalStringEscape(), - literalUnit: this.literalUnit(), - pathModuleExtended: this.pathModuleExtended(), - pathModulePrefixExtended: this.pathModulePrefixExtended(), - pathModulePrefixExtendedParens: this.pathModulePrefixExtendedParens(), - pathModulePrefixSimple: this.pathModulePrefixSimple(), - pathModuleSimple: this.pathModuleSimple(), - pathRecord: this.pathRecord(), - pattern: this.pattern(), - patternArray: this.patternArray(), - patternLazy: this.patternLazy(), - patternList: this.patternList(), - patternMisc: this.patternMisc(), - patternModule: this.patternModule(), - patternParens: this.patternParens(), - patternRecord: this.patternRecord(), - patternType: this.patternType(), - pragma: this.pragma(), - signature: this.signature(), - signatureConstraints: this.signatureConstraints(), - signatureFunctor: this.signatureFunctor(), - signatureLiteral: this.signatureLiteral(), - signatureParens: this.signatureParens(), - signatureRecovered: this.signatureRecovered(), - structure: this.structure(), - structureFunctor: this.structureFunctor(), - structureLiteral: this.structureLiteral(), - structureParens: this.structureParens(), - structureUnpack: this.structureUnpack(), - term: this.term(), - termAtomic: this.termAtomic(), - termConditional: this.termConditional(), - termConstructor: this.termConstructor(), - termDelim: this.termDelim(), - termFor: this.termFor(), - termFunction: this.termFunction(), - termLet: this.termLet(), - termMatch: this.termMatch(), - termMatchRule: this.termMatchRule(), - termOperator: this.termOperator(), - termPun: this.termPun(), - termTry: this.termTry(), - termWhile: this.termWhile(), - type: this.type(), - typeConstructor: this.typeConstructor(), - typeLabel: this.typeLabel(), - typeModule: this.typeModule(), - typeObject: this.typeObject(), - typeOperator: this.typeOperator(), - typeParens: this.typeParens(), - typePolymorphicVariant: this.typePolymorphicVariant(), - typeRecord: this.typeRecord(), - variableModule: this.variableModule(), - variablePattern: this.variablePattern(), - }, - }; - } -} - -export default new OCaml().render(); diff --git a/editor-extensions/vscode/src/syntaxes/schema.ts b/editor-extensions/vscode/src/syntaxes/schema.ts deleted file mode 100644 index 3ab30284..00000000 --- a/editor-extensions/vscode/src/syntaxes/schema.ts +++ /dev/null @@ -1,51 +0,0 @@ -export interface IPatterns extends Array {} - -export interface IGrammar { - name: string; - scopeName: string; - fileTypes: string[]; - patterns: IPatterns; - repository: IRepository; -} - -export interface IMatchScopes { - [key: string]: RuleSimple; -} - -export type Rule = RuleSimple | IRuleCapturing | IRuleDelimited | IRuleReference; - -export interface IRuleCapturing { - match: string; - name?: string; - captures?: IMatchScopes; - patterns?: IPatterns; -} - -export interface IRuleDelimited { - begin: string; - end: string; - applyEndPatternLast?: boolean; - name?: string; - contentName?: string; - beginCaptures?: IMatchScopes; - endCaptures?: IMatchScopes; - patterns?: IPatterns; -} - -export interface IRuleReference { - include: string; -} - -export type RuleSimple = - | { - name: string; - patterns?: IPatterns; - } - | { - name?: string; - patterns: IPatterns; - }; - -export interface IRepository { - [key: string]: Rule; -} diff --git a/editor-extensions/vscode/src/syntaxes/tsconfig.json b/editor-extensions/vscode/src/syntaxes/tsconfig.json deleted file mode 100644 index 579ae264..00000000 --- a/editor-extensions/vscode/src/syntaxes/tsconfig.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "experimentalDecorators": true, - "forceConsistentCasingInFileNames": true, - "lib": [ - "dom", - "esnext" - ], - "module": "commonjs", - "moduleResolution": "node", - "newLine": "LF", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "outDir": "out", - "pretty": true, - "removeComments": true, - "rootDir": ".", - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "suppressImplicitAnyIndexErrors": false, - "target": "esnext" - }, - "exclude": [ - "node_modules", - "out", - ".vscode-test" - ] -} diff --git a/editor-extensions/vscode/windows.zip b/editor-extensions/vscode/windows.zip deleted file mode 100644 index fc4e1fab..00000000 Binary files a/editor-extensions/vscode/windows.zip and /dev/null differ diff --git a/rescript-editor-support.opam b/rescript-editor-support.opam index 7e64cb21..cdcd434e 100644 --- a/rescript-editor-support.opam +++ b/rescript-editor-support.opam @@ -12,7 +12,6 @@ depends: [ "dune" {>= "2.7"} "ocaml" {= "4.06.1"} "reason" {= "3.6.0"} - "uri" {= "3.1.0"} ] build: [ ["dune" "build" "-p" name "@install"] diff --git a/src/BasicServer.re b/src/BasicServer.re deleted file mode 100644 index 1e17955f..00000000 --- a/src/BasicServer.re +++ /dev/null @@ -1,155 +0,0 @@ -module J = JsonShort; - -type messageSeverity = - | Error; - -let severity = m => - switch (m) { - | Error => 1 - }; - -let showMessage = (typ, message) => - Rpc.sendNotification( - stdout, - "window/showMessage", - J.o([("type", J.i(severity(typ))), ("message", J.s(message))]), - ); - -let handleMessage = (messageHandlers, id, method, params, state) => { - let start = Unix.gettimeofday(); - Log.log("[server] Got a method " ++ method); - switch (List.assoc(method, messageHandlers)) { - | exception Not_found => - Rpc.sendError( - stdout, - id, - J.o([ - ("code", J.i(-32601)), /* MethodNotFoundError */ - ("message", J.s("Unexpected method: " ++ method)), - ]), - ); - state; - | handler => - Log.log( - "[server] processing took " - ++ string_of_float((Unix.gettimeofday() -. start) *. 1000.) - ++ "ms", - ); - let result = handler(state, params); - switch (result) { - | Ok((state, result)) => - Rpc.sendMessage(stdout, id, result); - state; - | Error(string) => - Rpc.sendError( - stdout, - id, - J.o([ - ("code", J.i(-32603)), /* InternalError */ - ("message", J.s(string)), - ]), - ); - state; - | exception e => - Rpc.sendError( - stdout, - id, - J.o([ - ("code", J.i(-32603)), /* InternalError */ - ( - "message", - J.s(Printexc.to_string(e) ++ Printexc.get_backtrace()), - ), - ]), - ); - /* }; */ - state; - }; - }; -}; - -let handleNotification = (notificationHandlers, method, params, state) => - switch (List.assoc(method, notificationHandlers)) { - | exception Not_found => state - | handler => - switch (handler(state, params)) { - | Ok(state) => state - | Error(string) => - showMessage(Error, string); - state; - | exception e => - showMessage(Error, Printexc.to_string(e) ++ Printexc.get_backtrace()); - state; - } - }; - -/* Will wait up to 100ms */ -let canRead = desc => { - let (r, _, _) = Unix.select([desc], [], [], 0.1); - r != []; -}; - -let run = - (~messageHandlers, ~notificationHandlers, ~getInitialState, ~capabilities) => { - let stdin_descr = Unix.descr_of_in_channel(stdin); - - let rec loop = (~isShuttingDown, state) => - if (canRead(stdin_descr)) { - switch (Rpc.readMessage(stdin)) { - | Message(id, "shutdown", _params) => - Rpc.sendMessage(stdout, id, Json.Null); - loop(~isShuttingDown=true, state); - | Message(id, method, params) => - loop( - ~isShuttingDown, - handleMessage(messageHandlers, id, method, params, state), - ) - | Notification("exit", _) => - if (isShuttingDown) { - Log.log("Got exit! Terminating loop"); - } else { - Log.log("Got exit without shutdown. Erroring out"); - exit(1); - } - | Notification(method, params) => - loop( - ~isShuttingDown, - handleNotification(notificationHandlers, method, params, state), - ) - | Response(_, _) => loop(~isShuttingDown, state) - }; - } else { - loop(~isShuttingDown, state); - }; - - let initialize = () => - switch (Rpc.readMessage(stdin)) { - | Message(id, "initialize", params) => - switch (getInitialState(params)) { - | Ok(state) => - Rpc.sendMessage( - stdout, - id, - Json.Object([("capabilities", capabilities(params))]), - ); - loop(~isShuttingDown=false, state); - | Error(string) => Rpc.sendError(stdout, id, Json.String(string)) - | exception e => - Log.log("Failed to get initial state"); - Rpc.sendError( - stdout, - id, - J.o([ - ("code", J.i(-32603)), /* InternalError */ - ( - "message", - J.s(Printexc.to_string(e) ++ Printexc.get_backtrace()), - ), - ]), - ); - } - | _ => failwith("Client must send 'initialize' as first event") - }; - - initialize(); -}; diff --git a/src/CodeLens.re b/src/CodeLens.re deleted file mode 100644 index a7dc0f0f..00000000 --- a/src/CodeLens.re +++ /dev/null @@ -1,99 +0,0 @@ -let sepList = items => { - let firstItems = - switch (items) { - | [i1, i2, i3, _i4, _i5, ..._] => [i1, i2, i3] - | _ => items - }; - String.concat(", ", firstItems) - ++ " and " - ++ string_of_int(List.length(items) - 3) - ++ " more"; -}; - -let forOpen = (tracker: SharedTypes.openTracker) => { - let items = - tracker.used - |> List.map(((path, tip, _loc)) => - switch (path) { - | SharedTypes.Tip(name) => (name, tip) - | Nested(name, _) => (name, SharedTypes.Module) - } - ) - |> List.sort_uniq(compare); - let values = items |> List.filter(((_, t)) => t == SharedTypes.Value); - let modules = items |> List.filter(((_, t)) => t == SharedTypes.Module); - let types = - items |> List.filter(((_, t)) => t != SharedTypes.Value && t != Module); - - let typeMap = Hashtbl.create(10); - List.iter( - ((name, t)) => { - let current = - Hashtbl.mem(typeMap, name) ? Hashtbl.find(typeMap, name) : []; - let current = - switch (t) { - | SharedTypes.Constructor(name) => [name, ...current] - | Field(name) => [name, ...current] - | _ => current - }; - Hashtbl.replace(typeMap, name, current); - }, - types, - ); - - (items, types, modules, values, typeMap); -}; - -let forOpens = (extra: SharedTypes.extra) => { - SharedTypes.hashList(extra.opens) - |> List.map(((_loc, tracker)) => { - let (items, types, modules, values, typeMap) = forOpen(tracker); - - let parts = []; - let parts = - types == [] - ? parts - : [ - "types: {" - ++ String.concat( - ", ", - Hashtbl.fold( - (t, items, res) => - [ - items == [] ? t : t ++ " [" ++ sepList(items) ++ "]", - ...res, - ], - typeMap, - [], - ), - ) - ++ "}", - ...parts, - ]; - let parts = - modules == [] - ? parts - : [ - "modules: {" - ++ String.concat(", ", List.map(fst, modules)) - ++ "}", - ...parts, - ]; - let parts = - values == [] - ? parts - : [ - "values: {" ++ String.concat(", ", List.map(fst, values)) ++ "}", - ...parts, - ]; - - ( - parts == [] - ? "Unused open" - : string_of_int(List.length(items)) - ++ " uses. " - ++ String.concat(" ", parts), - tracker.ident.loc, - ); - }); -}; diff --git a/src/Files.re b/src/Files.re index 9dc0e84b..57efaa5f 100644 --- a/src/Files.re +++ b/src/Files.re @@ -52,7 +52,7 @@ let relpath = (base, path) => }; let maybeStat = path => - try (Some(Unix.stat(path))) { + try(Some(Unix.stat(path))) { | Unix.Unix_error(Unix.ENOENT, _, _) => None }; @@ -100,7 +100,7 @@ let ifExists = path => exists(path) ? Some(path) : None; let readDirectory = dir => { let maybeGet = handle => - try (Some(Unix.readdir(handle))) { + try(Some(Unix.readdir(handle))) { | End_of_file => None }; let rec loop = handle => @@ -120,16 +120,6 @@ let readDirectory = dir => { }; }; -let rec mkdirp = dest => - if (!exists(dest)) { - let parent = Filename.dirname(dest); - mkdirp(parent); - Unix.mkdir(dest, 0o740); - if (!exists(dest)) { - failwith("Unable to create " ++ dest); - }; - }; - let rec collectDirs = path => { switch (maybeStat(path)) { | None => [] diff --git a/src/JsonShort.re b/src/JsonShort.re index 5e3de18c..d44b077b 100644 --- a/src/JsonShort.re +++ b/src/JsonShort.re @@ -3,5 +3,4 @@ let o = o => Object(o); let s = s => String(s); let i = i => Number(float_of_int(i)); let l = l => Array(l); -let t = True; let null = Null; diff --git a/src/Log.re b/src/Log.re index aaff0a4d..00d00d2b 100644 --- a/src/Log.re +++ b/src/Log.re @@ -1,26 +1,7 @@ -let out = ref(None); - -let setLocation = location => { - switch (out^) { - | None => () - | Some(out) => close_out(out) - }; - output_string(stderr, "Setting log location: " ++ location ++ "\n"); - flush(stderr); - out := Some(open_out(location)); -}; - let spamError = ref(false); -let log = msg => { +let log = msg => if (spamError^) { output_string(stderr, msg ++ "\n"); flush(stderr); }; - switch (out^) { - | None => () - | Some(out) => - output_string(out, msg ++ "\n"); - flush(out); - }; -}; diff --git a/src/MerlinFile.re b/src/MerlinFile.re index ed28dddf..461a8c8b 100644 --- a/src/MerlinFile.re +++ b/src/MerlinFile.re @@ -1,5 +1,3 @@ -let debug = ref(false); - let parseMerlin = text => { let lines = Str.split(Str.regexp_string("\n"), text); List.fold_left( diff --git a/src/MerlinFile.rei b/src/MerlinFile.rei index 26869059..8a8d5ee3 100644 --- a/src/MerlinFile.rei +++ b/src/MerlinFile.rei @@ -1,2 +1 @@ -let debug: ref(bool); let getFlags: string => result(list(string), string); diff --git a/src/MessageHandlers.re b/src/MessageHandlers.re deleted file mode 100644 index 4930312c..00000000 --- a/src/MessageHandlers.re +++ /dev/null @@ -1,406 +0,0 @@ -open RResult; -open TopTypes; -module J = JsonShort; - -let handlers: - list((string, (state, Json.t) => result((state, Json.t), string))) = [ - ( - "textDocument/definition", - (state, params) => { - switch (Protocol.rPositionParams(params)) { - | Error(e) => Error(e) - | Ok((uri, pos)) => - switch (State.getFullFromCmt(~state, ~uri)) { - | Error(e) => Error(e) - | Ok((package, {file, extra})) => - let position = Utils.cmtLocFromVscode(pos); - switch ( - References.definitionForPos( - ~pathsForModule=package.pathsForModule, - ~file, - ~extra, - ~getUri=State.fileForUri(state), - ~getModule=State.fileForModule(state, ~package), - position, - ) - ) { - | None => Ok((state, Json.Null)) - | Some((uri, loc)) => - Ok(( - state, - Json.Object([ - ("uri", Json.String(Uri2.toString(uri))), - ("range", Protocol.rangeOfLoc(loc)), - ]), - )) - } - } - } - } - ), - ( - "textDocument/completion", - (state, params) => { - switch (Protocol.rPositionParams(params)) { - | Error(e) => Error(e) - | Ok((uri, pos)) => - let maybeText = - switch (Hashtbl.find_opt(state.documentText, uri)) { - | Some(text) => Some(text) - | None => None - }; - switch (State.getFullFromCmt(~state, ~uri)) { - | Error(e) => Error(e) - | Ok((package, full)) => - let completions = - NewCompletions.computeCompletions( - ~full, - ~maybeText, - ~package, - ~pos, - ~state, - ); - Ok((state, completions)); - }; - } - } - ), - ( - "textDocument/documentHighlight", - (state, params) => { - switch (Protocol.rPositionParams(params)) { - | Error(e) => Error(e) - | Ok((uri, pos)) => - let pos = Utils.cmtLocFromVscode(pos); - let refs = - switch (State.fileForUri(state, uri) |> toOptionAndLog) { - | None => None - | Some((file, extra)) => References.refsForPos(~file, ~extra, pos) - }; - Ok(( - state, - switch (refs) { - | None => J.null - | Some(refs) => - J.l( - refs - |> List.map(loc => - J.o([ - ("range", Protocol.rangeOfLoc(loc)), - ("kind", J.i(2)), - ]) - ), - ) - }, - )); - } - } - ), - ( - "textDocument/references", - (state, params) => { - switch (Protocol.rPositionParams(params)) { - | Error(e) => Error(e) - | Ok((uri, pos)) => - switch (Packages.getPackage(uri, state)) { - | Error(e) => Error(e) - | Ok(package) => - switch (State.fileForUri(state, uri)) { - | Error(e) => Error(e) - | Ok((file, extra)) => - switch (References.locForPos(~extra, Utils.cmtLocFromVscode(pos))) { - | None => Ok((state, J.null)) - | Some((_, loc)) => - switch ( - References.allReferencesForLoc( - ~pathsForModule=package.pathsForModule, - ~file, - ~extra, - ~allModules=package.localModules, - ~getUri=State.fileForUri(state), - ~getModule=State.fileForModule(state, ~package), - ~getExtra=State.extraForModule(state, ~package), - loc, - ) - |> toOptionAndLog - ) { - | None => Ok((state, J.null)) - | Some(allReferences) => - Ok(( - state, - J.l( - allReferences - |> List.map(((fname, references)) => { - let locs = - fname == uri - ? List.filter( - loc => !Protocol.locationContains(loc, pos), - references, - ) - : references; - locs - |> List.map(loc => Protocol.locationOfLoc(~fname, loc)); - }) - |> List.concat, - ), - )); - } - }; - } - } - } - } - ), - ( - "textDocument/rename", - (state, params) => { - switch (Protocol.rPositionParams(params)) { - | Error(e) => Error(e) - | Ok((uri, pos)) => - switch (Packages.getPackage(uri, state)) { - | Error(e) => Error(e) - | Ok(package) => - switch (State.fileForUri(state, uri)) { - | Error(e) => Error(e) - | Ok((file, extra)) => - switch (RJson.get("newName", params)) { - | Error(e) => Error(e) - | Ok(newName) => - switch (References.locForPos(~extra, Utils.cmtLocFromVscode(pos))) { - | None => Ok((state, J.null)) - | Some((_, loc)) => - switch ( - References.allReferencesForLoc( - ~file, - ~extra, - ~pathsForModule=package.pathsForModule, - ~allModules=package.localModules, - ~getModule=State.fileForModule(state, ~package), - ~getUri=State.fileForUri(state), - ~getExtra=State.extraForModule(state, ~package), - loc, - ) - |> toOptionAndLog - ) { - | None => Ok((state, J.null)) - | Some(allReferences) => - Ok(( - state, - J.o([ - ( - "changes", - J.o( - allReferences - |> List.map(((fname, references)) => - ( - fname |> Uri2.toString, - J.l( - references - |> List.map(loc => - J.o([ - ( "range", Protocol.rangeOfLoc(loc)), - ("newText", newName), - ]) - ), - ), - ) - ), - ), - ), - ]), - )) - } - } - } - } - } - } - } - ), - ( - "textDocument/codeLens", - (state, params) => { - open InfixResult; - switch ( - params - |> RJson.get("textDocument") - |?> RJson.get("uri") - |?> RJson.string - ) { - | Error(e) => Error(e) - | Ok(uri) => - switch (Uri2.parse(uri) |> RResult.orError("Not a uri")) { - | Error(e) => Error(e) - | Ok(uri) => - /* Log.log("<< codleens me please"); */ - let topLoc = { - Location.loc_start: { - Lexing.pos_fname: "", - pos_lnum: 1, - pos_bol: 0, - pos_cnum: 0, - }, - Location.loc_end: { - Lexing.pos_fname: "", - pos_lnum: 1, - pos_bol: 0, - pos_cnum: 0, - }, - loc_ghost: false, - }; - let getLensItems = ({SharedTypes.file, extra}) => { - /* getTypeLensTopLevel gives the list of per-value type codeLens - for every value in a module topLevel */ - let rec getTypeLensTopLevel = topLevel => { - switch (topLevel) { - | [] => [] - | [{SharedTypes.name: {loc}, item}, ...tlp] => - let currentCl = - switch (item) { - | SharedTypes.MValue(typ) => [ - (typ |> Shared.typeToString, loc), - ] - | Module(Structure({topLevel})) => - getTypeLensTopLevel(topLevel) - | _ => [] - }; - List.append(currentCl, getTypeLensTopLevel(tlp)); - }; - }; - let lenses = file.contents.topLevel |> getTypeLensTopLevel; - let lenses = lenses @ CodeLens.forOpens(extra); - let depsList = - List.map(fst, SharedTypes.hashList(extra.externalReferences)); - let depsString = - depsList == [] ? "[none]" : String.concat(", ", depsList); - let lenses = [("Dependencies: " ++ depsString, topLoc), ...lenses]; - lenses; - }; - let items = - switch (State.getFullFromCmt(~state, ~uri)) { - | Error(message) => [(message, topLoc)] - | Ok((_package, full)) => getLensItems(full) - }; - Ok(( - state, - J.l( - items - |> List.map(((text, loc)) => - J.o([ - ("range", Protocol.rangeOfLoc(loc)), - ( - "command", - J.o([("title", J.s(text)), ("command", J.s(""))]), - ), - ]) - ), - ), - )); - } - } - - } - ), - ( - "textDocument/hover", - (state, params) => { - switch (Protocol.rPositionParams(params)) { - | Error(e) => Error(e) - | Ok((uri, pos)) => - switch (Packages.getPackage(uri, state)) { - | Error(e) => Error(e) - | Ok(package) => - switch (State.fileForUri(state, uri)) { - | Error(e) => Error(e) - | Ok((file, extra)) => - let pos = Utils.cmtLocFromVscode(pos); - switch (References.locForPos(~extra, pos)) { - | None => Ok((state, J.null)) - | Some((location, loc)) => - switch ( - Hover.newHover( - ~file, - ~getModule=State.fileForModule(state, ~package), - loc, - ) - ) { - | None => Ok((state, J.null)) - | Some(text) => - Ok(( - state, - J.o([ - ("range", Protocol.rangeOfLoc(location)), - ("contents", text |> Protocol.contentKind), - ]), - )) - } - }; - } - } - } - } - ), - ( - "textDocument/documentSymbol", - (state, params) => { - open InfixResult; - switch ( - params - |> RJson.get("textDocument") - |?> RJson.get("uri") - |?> RJson.string - ) { - | Error(e) => Error(e) - | Ok(uri) => - switch (Uri2.parse(uri) |> RResult.orError("Not a uri")) { - | Error(e) => Error(e) - | Ok(uri) => - switch (State.fileForUri(state, uri)) { - | Error(e) => Error(e) - | Ok((file, _extra)) => - open SharedTypes; - - let rec getItems = ({topLevel}) => { - let fn = ({name: {txt}, extentLoc, item}) => { - let (item, siblings) = - switch (item) { - | MValue(v) => (v |> Shared.variableKind, []) - | MType(t, _) => (t.decl |> Shared.declarationKind, []) - | Module(Structure(contents)) => (Module, getItems(contents)) - | Module(Ident(_)) => (Module, []) - }; - if (extentLoc.loc_ghost) { - siblings; - } else { - [(txt, extentLoc, item), ...siblings]; - }; - }; - let x = topLevel |> List.map(fn) |> List.concat; - x; - }; - - getItems(file.contents) - |> ( - items => { - Ok(( - state, - J.l( - items - |> List.map(((name, loc, typ)) => - J.o([ - ("name", J.s(name)), - ("kind", J.i(Protocol.symbolKind(typ))), - ("location", Protocol.locationOfLoc(loc)), - /* ("containerName", s(String.concat(".", path))) */ - ]) - ), - ), - )); - } - ); - } - } - } - } - ), -]; diff --git a/src/NotificationHandlers.re b/src/NotificationHandlers.re deleted file mode 100644 index 56be5515..00000000 --- a/src/NotificationHandlers.re +++ /dev/null @@ -1,110 +0,0 @@ -open Infix; -open RResult; -open TopTypes; -module J = JsonShort; - -let getTextDocument = doc => - switch (Json.get("uri", doc) |?> Json.string |?> Uri2.parse) { - | None => None - | Some(uri) => - switch (Json.get("text", doc) |?> Json.string) { - | None => None - | Some(text) => Some((uri, text)) - } - }; - -let notificationHandlers: - list((string, (state, Json.t) => result(state, string))) = [ - ( - "textDocument/didOpen", - (state, params) => { - switch ( - Json.get("textDocument", params) - |?> getTextDocument - |> RResult.orError("Invalid params") - ) { - | Error(e) => Error(e) - | Ok((uri, text)) => - Hashtbl.replace(state.documentText, uri, text); - let path = Uri2.toPath(uri); - if (FindFiles.isSourceFile(path)) { - switch (Packages.getPackage(uri, state)) { - | Error(e) => Error(e) - | Ok(package) => - /* let name = FindFiles.getName(path); */ - if (!Hashtbl.mem(package.nameForPath, path)) { - /* TODO: figure out what the name should be, and process it. */ - package.nameForPath - |> Hashtbl.iter((name, _) => Log.log(" > " ++ name)); - Log.log("Reloading because you created a new file: " ++ path); - Ok(state); - /* Ok(reloadAllState(state)) */ - /* Hashtbl.add(package.nameForPath, path, name); - Hashtbl.add(package.pathsForModule, name, Impl(path, Some(path))); - Hashtbl.replace(state.packagesByRoot, package.basePath, { - ...package, - localModules: [name, ...package.localModules] - }); - Ok(state) */ - } else { - Ok(state); - } - }; - } else { - Ok(state); - }; - } - } - ), - ( - "workspace/didChangeConfiguration", - (state, _params) => { - Ok(state); - }, - ), - ( - "textDocument/didSave", - (state, _params) => { - Ok(state); - }, - ), - ( - "textDocument/didChange", - (state, params) => { - open InfixResult; - switch (params |> RJson.get("textDocument")) { - | Error(e) => Error(e) - | Ok(doc) => - switch (RJson.get("uri", doc) |?> RJson.string) { - | Error(e) => Error(e) - | Ok(uri) => - switch (Uri2.parse(uri) |> RResult.orError("Not a uri")) { - | Error(e) => Error(e) - | Ok(uri) => - switch (RJson.get("contentChanges", params) |?> RJson.array) { - | Error(e) => Error(e) - | Ok(changes) => - switch ( - List.nth(changes, List.length(changes) - 1) - |> RJson.get("text") - |?> RJson.string - ) { - | Error(e) => Error(e) - | Ok(text) => - /* Hmm how do I know if it's modified? */ - let state = State.updateContents(uri, text, state); - Ok(state); - } - } - } - } - } - } - ), - ( - "workspace/didChangeWatchedFiles", - (state, _params) => { - Ok(state); - }, - ), -]; diff --git a/src/Packages.re b/src/Packages.re index dd6aff32..7f75eb62 100644 --- a/src/Packages.re +++ b/src/Packages.re @@ -23,31 +23,18 @@ let makePathsForModule = dependencyModules: list((string, SharedTypes.paths)), ) => { let pathsForModule = Hashtbl.create(30); - let nameForPath = Hashtbl.create(30); - let add = (name, paths) => - switch (paths) { - | SharedTypes.Intf(_, path) => Hashtbl.replace(nameForPath, path, name) - | SharedTypes.Impl(_, Some(path)) => - Hashtbl.replace(nameForPath, path, name) - | SharedTypes.IntfAndImpl(_, intf, _, impl) => - Hashtbl.replace(nameForPath, intf, name); - Hashtbl.replace(nameForPath, impl, name); - | _ => () - }; dependencyModules |> List.iter(((modName, paths)) => { - add(modName, paths); - Hashtbl.replace(pathsForModule, modName, paths); + Hashtbl.replace(pathsForModule, modName, paths) }); localModules |> List.iter(((modName, paths)) => { - add(modName, paths); - Hashtbl.replace(pathsForModule, modName, paths); + Hashtbl.replace(pathsForModule, modName, paths) }); - (pathsForModule, nameForPath); + pathsForModule; }; let newBsPackage = rootPath => @@ -76,9 +63,14 @@ let newBsPackage = rootPath => { let namespace = FindFiles.getNamespace(config); let localSourceDirs = - FindFiles.getSourceDirectories(~includeDev=true, rootPath, config); + FindFiles.getSourceDirectories( + ~includeDev=true, + rootPath, + config, + ); Log.log( - "Got source directories " ++ String.concat(" - ", localSourceDirs), + "Got source directories " + ++ String.concat(" - ", localSourceDirs), ); let localModules = FindFiles.findProjectFiles( @@ -89,8 +81,8 @@ let newBsPackage = rootPath => compiledBase, ); /* |> List.map(((name, paths)) => (switch (namespace) { - | None => name - | Some(n) => name ++ "-" ++ n }, paths)); */ + | None => name + | Some(n) => name ++ "-" ++ n }, paths)); */ Log.log( "-- All local modules found: " ++ string_of_int(List.length(localModules)), @@ -105,7 +97,7 @@ let newBsPackage = rootPath => }; }); - let (pathsForModule, nameForPath) = + let pathsForModule = makePathsForModule(localModules, dependencyModules); let opens = @@ -113,11 +105,15 @@ let newBsPackage = rootPath => | None => [] | Some(namespace) => let cmt = compiledBase /+ namespace ++ ".cmt"; - Log.log("############ Namespaced as " ++ namespace ++ " at " ++ cmt); + Log.log( + "############ Namespaced as " ++ namespace ++ " at " ++ cmt, + ); Hashtbl.add(pathsForModule, namespace, Impl(cmt, None)); [FindFiles.nameSpaceToName(namespace)]; }; - Log.log("Dependency dirs " ++ String.concat(" ", dependencyDirectories)); + Log.log( + "Dependency dirs " ++ String.concat(" ", dependencyDirectories), + ); let opens = { let flags = @@ -142,14 +138,14 @@ let newBsPackage = rootPath => opens; }; - let interModuleDependencies = Hashtbl.create(List.length(localModules)); + let interModuleDependencies = + Hashtbl.create(List.length(localModules)); { rootPath, localModules: localModules |> List.map(fst), dependencyModules: dependencyModules |> List.map(fst), pathsForModule, - nameForPath, opens, namespace, interModuleDependencies, diff --git a/src/ProcessExtra.re b/src/ProcessExtra.re index 2f3c7f65..ba466082 100644 --- a/src/ProcessExtra.re +++ b/src/ProcessExtra.re @@ -351,13 +351,12 @@ module F = addLocation(loc, Explanation(doc)) | Tstr_include({incl_mod: expr}) => handle_module_expr(expr.mod_desc) | Tstr_module({mb_expr}) => handle_module_expr(mb_expr.mod_desc) - | Tstr_open({open_path, open_txt: {txt, loc} as l}) => + | Tstr_open({open_path, open_txt: {txt, loc}}) => /* Log.log("Have an open here"); */ maybeAddUse(open_path, txt, loc, Module); let tracker = { path: open_path, loc, - ident: l, used: [], extent: { loc_ghost: true, @@ -472,11 +471,11 @@ module F = expression.exp_extra |> List.iter(((e, eloc, _)) => switch (e) { - | Texp_open(_, path, ident, _) => + | Texp_open(_, path, _ident, _) => Hashtbl.add( extra.opens, eloc, - {path, ident, loc: eloc, extent: expression.exp_loc, used: []}, + {path, loc: eloc, extent: expression.exp_loc, used: []}, ) | _ => () } diff --git a/src/Protocol.re b/src/Protocol.re index 44dc53da..62cb8078 100644 --- a/src/Protocol.re +++ b/src/Protocol.re @@ -1,71 +1,10 @@ module J = JsonShort; -let rgetPosition = pos => { - open RResult.InfixResult; - switch (RJson.get("line", pos) |?> RJson.number) { - | Error(e) => Error(e) - | Ok(line) => - switch (RJson.get("character", pos) |?> RJson.number) { - | Error(e) => Error(e) - | Ok(character) => Ok((int_of_float(line), int_of_float(character))) - } - } -}; - -let rPositionParams = params => { - open RResult.InfixResult; - switch ( - RJson.get("textDocument", params) |?> RJson.get("uri") |?> RJson.string - ) { - | Error(e) => Error(e) - | Ok(uri) => - switch (Uri2.parse(uri) |> RResult.orError("Not a uri")) { - | Error(e) => Error(e) - | Ok(uri) => - switch (RJson.get("position", params) |?> rgetPosition) { - | Error(e) => Error(e) - | Ok(pos) => Ok((uri, pos)) - } - } - } -}; - let posOfLexing = ({Lexing.pos_lnum, pos_cnum, pos_bol}) => J.o([ ("line", J.i(pos_lnum - 1)), ("character", J.i(pos_cnum - pos_bol)), ]); -let contentKind = text => - J.o([("kind", J.s("markdown")), ("value", J.s(text))]); - let rangeOfLoc = ({Location.loc_start, loc_end}) => J.o([("start", posOfLexing(loc_start)), ("end", posOfLexing(loc_end))]); - -let locationOfLoc = - (~fname=?, {Location.loc_start: {Lexing.pos_fname}} as loc) => { - let uri = - switch (fname) { - | Some(x) => x - | None => Uri2.fromPath(pos_fname) - }; - J.o([("range", rangeOfLoc(loc)), ("uri", J.s(Uri2.toString(uri)))]); -}; - -let locationContains = ({Location.loc_start, loc_end}, pos) => - Utils.tupleOfLexing(loc_start) <= pos - && Utils.tupleOfLexing(loc_end) >= pos; - -let symbolKind = (kind: SharedTypes.kinds) => - switch (kind) { - | Module => 2 - | Enum => 10 - | Interface => 11 - | Function => 12 - | Variable => 13 - | Array => 18 - | Object => 19 - | Null => 21 - | EnumMember => 22 - | TypeParameter => 26 - }; diff --git a/src/RJson.re b/src/RJson.re deleted file mode 100644 index 15f79748..00000000 --- a/src/RJson.re +++ /dev/null @@ -1,4 +0,0 @@ -let get = (k, obj) => Json.get(k, obj) |> RResult.orError("No key " ++ k); -let string = obj => Json.string(obj) |> RResult.orError("Not a string"); -let number = obj => Json.number(obj) |> RResult.orError("Not a number"); -let array = obj => Json.array(obj) |> RResult.orError("Expected an array"); diff --git a/src/RResult.re b/src/RResult.re index b042a390..8e50d3d4 100644 --- a/src/RResult.re +++ b/src/RResult.re @@ -14,11 +14,6 @@ let toOptionAndLog = err => }; module InfixResult = { - let (|?>) = (a, fn) => - switch (a) { - | Ok(a) => fn(a) - | Error(e) => Error(e) - }; let (|?>>) = (a, fn) => switch (a) { | Ok(a) => Ok(fn(a)) diff --git a/src/References.re b/src/References.re index 90234596..64ba7a28 100644 --- a/src/References.re +++ b/src/References.re @@ -57,47 +57,6 @@ let locForPos = (~extra, pos) => { }; }; -/** Other locations *within this file* that refer to the same thing. - * - * Useful for "highlight" stuff. */ -let localReferencesForLoc = (~file, ~extra, loc) => - switch (loc) { - | Explanation(_) - | Typed(_, NotFound) - | LModule(NotFound) - | TopLevelModule(_) - | Constant(_) => None - | TypeDefinition(_, _, stamp) => - Hashtbl.find_opt(extra.internalReferences, stamp) - | LModule(LocalReference(stamp, tip) | Definition(stamp, tip)) - | Typed(_, LocalReference(stamp, tip) | Definition(stamp, tip)) => - open Infix; - switch ( - switch (tip) { - | Constructor(name) => - Query.getConstructor(file, stamp, name) |?>> (x => x.stamp) - | Field(name) => Query.getField(file, stamp, name) |?>> (x => x.stamp) - | _ => Some(stamp) - } - ) { - | None => None - | Some(localStamp) => - Hashtbl.find_opt(extra.internalReferences, localStamp) - } - | LModule(GlobalReference(moduleName, path, tip)) - | Typed(_, GlobalReference(moduleName, path, tip)) => - switch (Hashtbl.find_opt(extra.externalReferences, moduleName)) { - | None => None - | Some(refs) => - Some( - refs - |> Utils.filterMap(((p, t, l)) => - p == path && t == tip ? Some(l) : None - ), - ) - } - }; - let definedForLoc = (~file, ~getModule, locKind) => { let inner = (~file, stamp, tip) => { switch (tip) { @@ -240,9 +199,8 @@ let resolveModuleReference = | Some(stamp) => switch (Hashtbl.find_opt(env.file.stamps.modules, stamp)) { | None => None - | Some(md) => - Some((env.file, Some(md))) - /* Some((env.file.uri, validateLoc(md.name.loc, md.extentLoc))) */ + | Some(md) => Some((env.file, Some(md))) + /* Some((env.file.uri, validateLoc(md.name.loc, md.extentLoc))) */ } } | `Global(moduleName, path) => @@ -258,9 +216,8 @@ let resolveModuleReference = | Some(stamp) => switch (Hashtbl.find_opt(env.file.stamps.modules, stamp)) { | None => None - | Some(md) => - Some((env.file, Some(md))) - /* Some((env.file.uri, validateLoc(md.name.loc, md.extentLoc))) */ + | Some(md) => Some((env.file, Some(md))) + /* Some((env.file.uri, validateLoc(md.name.loc, md.extentLoc))) */ } } }; @@ -268,9 +225,8 @@ let resolveModuleReference = | `Stamp(stamp) => switch (Hashtbl.find_opt(file.stamps.modules, stamp)) { | None => None - | Some(md) => - Some((file, Some(md))) - /* Some((file.uri, validateLoc(md.name.loc, md.extentLoc))) */ + | Some(md) => Some((file, Some(md))) + /* Some((file.uri, validateLoc(md.name.loc, md.extentLoc))) */ } | `GlobalMod(name) => switch (getModule(name)) { @@ -284,248 +240,6 @@ let resolveModuleReference = }; }; -let forLocalStamp = - ( - ~pathsForModule, - ~file, - ~extra, - ~allModules, - ~getModule, - ~getUri, - ~getExtra, - stamp, - tip, - ) => { - let env = Query.fileEnv(file); - open Infix; - switch ( - switch (tip) { - | Constructor(name) => - Query.getConstructor(file, stamp, name) |?>> (x => x.stamp) - | Field(name) => Query.getField(file, stamp, name) |?>> (x => x.stamp) - | _ => Some(stamp) - } - ) { - | None => None - | Some(localStamp) => - switch (Hashtbl.find_opt(extra.internalReferences, localStamp)) { - | None => None - | Some(local) => - maybeLog("Checking externals: " ++ string_of_int(stamp)); - let externals = - switch (Query.declaredForTip(~stamps=env.file.stamps, stamp, tip)) { - | None => [] - | Some(declared) => - if (isVisible(declared)) { - /** - if this file has a corresponding interface or implementation file - also find the references in that file. - */ - let alternativeReferences = - switch ( - alternateDeclared( - ~pathsForModule, - ~file, - ~getUri, - declared, - tip, - ) - ) { - | None => [] - | Some((file, extra, {stamp})) => - switch ( - switch (tip) { - | Constructor(name) => - Query.getConstructor(file, stamp, name) |?>> (x => x.stamp) - | Field(name) => - Query.getField(file, stamp, name) |?>> (x => x.stamp) - | _ => Some(stamp) - } - ) { - | None => [] - | Some(localStamp) => - switch (Hashtbl.find_opt(extra.internalReferences, localStamp)) { - | None => [] - | Some(local) => [(file.uri, local)] - } - } - }; - switch ( - pathFromVisibility(declared.modulePath, declared.name.txt) - ) { - | None => [] - | Some(path) => - maybeLog("Now checking path " ++ pathToString(path)); - let thisModuleName = file.moduleName; - let externals = - allModules - |> List.filter(name => name != file.moduleName) - |> Utils.filterMap(name => - { - switch ( - getModule(name) - |> RResult.orError( - "Could not get file for module " ++ name, - ) - ) { - | Error(e) => Error(e) - | Ok(file) => - switch ( - getExtra(name) - |> RResult.orError( - "Could not get extra for module " ++ name, - ) - ) { - | Error(e) => Error(e) - | Ok(extra) => - switch ( - Hashtbl.find_opt(extra.externalReferences, thisModuleName) - |> RResult.orError( - "No references in " - ++ name - ++ " for " - ++ thisModuleName, - ) - ) { - | Error(e) => Error(e) - | Ok(refs) => - let refs = - refs - |> Utils.filterMap(((p, t, l)) => - p == path && t == tip ? Some(l) : None - ); - Ok((file.uri, refs)); - } - } - } - } |> RResult.toOptionAndLog - ); - alternativeReferences @ externals; - }; - } else { - maybeLog("Not visible"); - []; - } - }; - Some([(file.uri, local), ...externals]); - } - }; -}; - -let allReferencesForLoc = - ( - ~pathsForModule, - ~getUri, - ~file, - ~extra, - ~allModules, - ~getModule, - ~getExtra, - loc, - ) => { - switch (loc) { - | Explanation(_) - | Typed(_, NotFound) - | LModule(NotFound) - | TopLevelModule(_) - | Constant(_) => Error("Not a valid loc") - | TypeDefinition(_, _, stamp) => - forLocalStamp( - ~pathsForModule, - ~getUri, - ~file, - ~extra, - ~allModules, - ~getModule, - ~getExtra, - stamp, - Type, - ) - |> RResult.orError("Could not get for local stamp") - | Typed(_, LocalReference(stamp, tip) | Definition(stamp, tip)) - | LModule(LocalReference(stamp, tip) | Definition(stamp, tip)) => - maybeLog( - "Finding references for " - ++ Uri2.toString(file.uri) - ++ " and stamp " - ++ string_of_int(stamp) - ++ " and tip " - ++ tipToString(tip), - ); - forLocalStamp( - ~pathsForModule, - ~getUri, - ~file, - ~extra, - ~allModules, - ~getModule, - ~getExtra, - stamp, - tip, - ) - |> RResult.orError("Could not get for local stamp"); - | LModule(GlobalReference(moduleName, path, tip)) - | Typed(_, GlobalReference(moduleName, path, tip)) => - switch ( - getModule(moduleName) - |> RResult.orError("Cannot get module " ++ moduleName) - ) { - | Error(e) => Error(e) - | Ok(file) => - let env = Query.fileEnv(file); - switch ( - Query.resolvePath(~env, ~path, ~getModule) - |> RResult.orError("Cannot resolve path " ++ pathToString(path)) - ) { - | Error(e) => Error(e) - | Ok((env, name)) => - switch ( - Query.exportedForTip(~env, name, tip) - |> RResult.orError( - "Exported not found for tip " ++ name ++ " > " ++ tipToString(tip) - ) - ) { - | Error(e) => Error(e) - | Ok(stamp) => - switch (getUri(env.file.uri)) { - | Error(e) => Error(e) - | Ok((file, extra)) => - maybeLog( - "Finding references for (global) " - ++ Uri2.toString(env.file.uri) - ++ " and stamp " - ++ string_of_int(stamp) - ++ " and tip " - ++ tipToString(tip), - ); - forLocalStamp( - ~pathsForModule, - ~getUri, - ~file, - ~extra, - ~allModules, - ~getModule, - ~getExtra, - stamp, - tip, - ) - |> RResult.orError("Could not get for local stamp"); - } - } - }; - } - }; -}; - -let refsForPos = (~file, ~extra, pos) => { - switch (locForPos(~extra, pos)) { - | None => None - | Some((_, loc)) => - maybeLog("Got a loc for pos"); - localReferencesForLoc(~file, ~extra, loc); - } -}; - let validateLoc = (loc: Location.t, backup: Location.t) => if (loc.loc_start.pos_cnum == (-1)) { if (backup.loc_start.pos_cnum == (-1)) { @@ -632,16 +346,17 @@ let definitionForLoc = (~pathsForModule, ~file, ~getUri, ~getModule, loc) => { | Constant(_) => None | TopLevelModule(name) => maybeLog("Toplevel " ++ name); - open Infix; - switch ( - Hashtbl.find_opt(pathsForModule, name) - |> orLog("No paths found") - |?> getSrc - |> orLog("No src found") - ) { - | None => None - | Some(src) => Some((Uri2.fromPath(src), Utils.topLoc(src))) - } + Infix.( + switch ( + Hashtbl.find_opt(pathsForModule, name) + |> orLog("No paths found") + |?> getSrc + |> orLog("No src found") + ) { + | None => None + | Some(src) => Some((Uri2.fromPath(src), Utils.topLoc(src))) + } + ); | LModule(LocalReference(stamp, tip)) | Typed(_, LocalReference(stamp, tip)) => maybeLog("Local defn " ++ tipToString(tip)); @@ -674,12 +389,3 @@ let definitionForLoc = (~pathsForModule, ~file, ~getUri, ~getModule, loc) => { }; }; }; - -let definitionForPos = - (~pathsForModule, ~file, ~extra, ~getUri, ~getModule, pos) => - switch (locForPos(~extra, pos)) { - | None => None - | Some((_, loc)) => - maybeLog("Got a loc for pos"); - definitionForLoc(~pathsForModule, ~file, ~getUri, ~getModule, loc); - }; diff --git a/src/RescriptEditorSupport.re b/src/RescriptEditorSupport.re index 60f44e10..3821feb8 100644 --- a/src/RescriptEditorSupport.re +++ b/src/RescriptEditorSupport.re @@ -1,72 +1,5 @@ -open Infix; module J = JsonShort; module StringSet = Set.Make(String); -let capabilities = - J.o([ - ("textDocumentSync", J.i(1)), - ("hoverProvider", J.t), - ( - "completionProvider", - J.o([ - ( - "triggerCharacters", - J.l([J.s("."), J.s(">"), J.s("@"), J.s("~")]), - ), - ]), - ), - ("definitionProvider", J.t), - ("typeDefinitionProvider", J.t), - ("referencesProvider", J.t), - ("documentSymbolProvider", J.t), - ("codeLensProvider", J.o([("resolveProvider", J.t)])), - ("documentHighlightProvider", J.t), - ("renameProvider", J.t), - ]); - -let getInitialState = params => { - let rootUri = Json.get("rootUri", params) |?> Json.string |?> Uri2.parse; - switch (rootUri |> RResult.orError("Not a uri")) { - | Error(e) => Error(e) - | Ok(rootUri) => - let rootPath = Uri2.toPath(rootUri); - - Files.mkdirp(rootPath /+ "node_modules" /+ ".lsp"); - Log.setLocation(rootPath /+ "node_modules" /+ ".lsp" /+ "debug.log"); - Log.log("Hello - from " ++ Sys.executable_name); - - Rpc.sendNotification( - stdout, - "client/registerCapability", - J.o([ - ( - "registrations", - J.l([ - J.o([ - ("id", J.s("watching")), - ("method", J.s("workspace/didChangeWatchedFiles")), - ( - "registerOptions", - J.o([ - ( - "watchers", - J.l([ - J.o([("globPattern", J.s("**/bsconfig.json"))]), - J.o([("globPattern", J.s("**/.merlin"))]), - ]), - ), - ]), - ), - ]), - ]), - ), - ]), - ); - - let state = TopTypes.empty(); - - Ok(state); - }; -}; let parseArgs = args => { switch (args) { @@ -92,8 +25,6 @@ let hasOpt = (opts, name) => opts |> StringSet.mem(name); let hasOpts = (opts, names) => names |> List.exists(opts |> hasOpt); -let hasVerbose = opts => hasOpts(opts, ["-v", "--verbose"]); - let help = {| Commands for Rescript Language Server @@ -116,24 +47,6 @@ let showHelp = () => { let main = () => { switch (parseArgs(Sys.argv |> Array.to_list)) { | (opts, _) when hasOpts(opts, ["-h", "--help"]) => showHelp() - | (opts, []) => - if (opts |> hasVerbose) { - Log.spamError := true; - References.debugReferences := true; - MerlinFile.debug := true; - }; - Log.log("Booting up"); - BasicServer.run( - ~messageHandlers=MessageHandlers.handlers, - ~notificationHandlers=NotificationHandlers.notificationHandlers, - ~capabilities=_params => capabilities, - ~getInitialState, - ); - Log.log("Finished"); - switch (Log.out^) { - | None => () - | Some(out) => close_out(out) - } | (_opts, ["dump", ...files]) => EditorSupportCommands.dump(files) | (_opts, ["complete", pathWithPos, currentFile]) => EditorSupportCommands.complete(~pathWithPos, ~currentFile) diff --git a/src/Rpc.re b/src/Rpc.re deleted file mode 100644 index 6999e696..00000000 --- a/src/Rpc.re +++ /dev/null @@ -1,98 +0,0 @@ -open Infix; -module J = JsonShort; - -type jsonrpc = - | Message(Json.t, string, Json.t) - | Notification(string, Json.t) - | Response(Json.t, Json.t); - -let messageFromJson = json => { - let id = Json.get("id", json); - let method = Json.get("method", json) |?> Json.string; - let result = Json.get("result", json); - let params = Json.get("params", json); - switch (id) { - | None => - Notification( - method |! "method required", - params |! "params required for notification", - ) - | Some(id) => - switch (method, result) { - | (_, Some(result)) => Response(id, result) - | (Some(method), _) => Message(id, method, params |! "params required") - | (None, None) => failwith("Either method or result required") - } - }; -}; - -let readMessage = input => { - let clength = input_line(input); - let cl = "Content-Length: "; - let cll = String.length(cl); - if (String.sub(clength, 0, cll) == cl) { - /* if on windows, dont need the extra -1 */ - let offset = Sys.os_type == "Win32" ? 0 : (-1); /* -1 for trailing \r */ - let num = - String.sub(clength, cll, String.length(clength) - cll + offset); - /* log("Num bytes to read: " ++ String.escaped(num)); */ - let num = (num |> int_of_string) + (Sys.os_type == "Win32" ? 1 : 2); - let buffer = Buffer.create(num); - Buffer.add_channel(buffer, input, num); - let raw = Buffer.contents(buffer); - Log.log("Read message " ++ raw); - let json = - try (Json.parse(raw)) { - | Failure(message) => - failwith("Unable to parse message " ++ raw ++ " as json: " ++ message) - | err => - failwith( - "Other failure " ++ raw ++ " message " ++ Printexc.to_string(err), - ) - }; - messageFromJson(json); - } else { - failwith("Invalid header"); - }; -}; - -let send = (output, content) => { - let length = String.length(content); - let sep = Sys.os_type == "Unix" ? "\r\n\r\n" : "\n\n"; - output_string( - output, - "Content-Length: " ++ string_of_int(length) ++ sep ++ content, - ); - flush(output); -}; - -let sendMessage = (output, id, result) => { - let content = - Json.stringify( - J.o([("id", id), ("jsonrpc", J.s("2.0")), ("result", result)]), - ); - Log.log("Sending response " ++ content); - send(output, content); -}; - -let sendError = (output, id, error) => { - let content = - Json.stringify( - J.o([("id", id), ("jsonrpc", J.s("2.0")), ("error", error)]), - ); - Log.log("Sending response " ++ content); - send(output, content); -}; - -let sendNotification = (output, method, params) => { - let content = - Json.stringify( - J.o([ - ("jsonrpc", J.s("2.0")), - ("method", J.s(method)), - ("params", params), - ]), - ); - Log.log("Sending notification " ++ content); - send(output, content); -}; diff --git a/src/Shared.re b/src/Shared.re index b014f743..5be917fc 100644 --- a/src/Shared.re +++ b/src/Shared.re @@ -45,29 +45,6 @@ let digConstructor = expr => { }; }; -let rec variableKind = t => - switch (t.Types.desc) { - | Tlink(t) => variableKind(t) - | Tsubst(t) => variableKind(t) - | Tarrow(_) => SharedTypes.Function - | Ttuple(_) => Array - | Tconstr(_) => Variable - | Tobject(_) => Object - | Tnil => Null - | Tvariant(_) => EnumMember - | Tpoly(_) => EnumMember - | Tpackage(_) => Module - | _ => Variable - }; - -let declarationKind = t => - switch (t.Types.type_kind) { - | Type_open - | Type_abstract => SharedTypes.TypeParameter - | Type_record(_) => Interface - | Type_variant(_) => Enum - }; - let declToString = (~recStatus=Types.Trec_not, name, t) => PrintType.printDecl(~recStatus, name, t); diff --git a/src/SharedTypes.re b/src/SharedTypes.re index d84e8bb4..b0ee5554 100644 --- a/src/SharedTypes.re +++ b/src/SharedTypes.re @@ -1,15 +1,3 @@ -type kinds = - | Function - | Array - | Variable - | Object - | Null - | EnumMember - | Module - | Enum - | Interface - | TypeParameter; - type filePath = string; type paths = | Impl(filePath, option(filePath)) @@ -107,19 +95,6 @@ module Type = { | Let | LetRec; */ -let isVisible = declared => - declared.exported - && { - let rec loop = v => - switch (v) { - | File(_) => true - | NotVisible => false - | IncludedModule(_, inner) => loop(inner) - | ExportedModule(_, inner) => loop(inner) - }; - loop(declared.modulePath); - }; - type namedMap('t) = Hashtbl.t(string, 't); type namedStampMap = namedMap(int); @@ -210,18 +185,6 @@ let rec pathToString = path => | Nested(name, inner) => name ++ "." ++ pathToString(inner) }; -let rec pathFromVisibility = (visibilityPath, current) => - switch (visibilityPath) { - | File(_) => Some(current) - | IncludedModule(_, inner) => pathFromVisibility(inner, current) - | ExportedModule(name, inner) => - pathFromVisibility(inner, Nested(name, current)) - | NotVisible => None - }; - -let pathFromVisibility = (visibilityPath, tipName) => - pathFromVisibility(visibilityPath, Tip(tipName)); - type locKind = | LocalReference(int, tip) | GlobalReference(string, path, tip) @@ -239,7 +202,6 @@ type loc = type openTracker = { path: Path.t, loc: Location.t, - ident: Location.loc(Longident.t), extent: Location.t, mutable used: list((path, tip, Location.t)), }; diff --git a/src/State.re b/src/State.re index 88f0098a..b881f3ae 100644 --- a/src/State.re +++ b/src/State.re @@ -51,11 +51,6 @@ let docsForCmt = (~moduleName, cmt, src, state) => }; }; -let updateContents = (uri, text, state) => { - Hashtbl.replace(state.documentText, uri, text); - state; -}; - open Infix; let getFullFromCmt = (~state, ~uri) => { @@ -75,7 +70,8 @@ let getFullFromCmt = (~state, ~uri) => { Hashtbl.replace( package.interModuleDependencies, moduleName, - SharedTypes.hashList(full.extra.externalReferences) |> List.map(fst), + SharedTypes.hashList(full.extra.externalReferences) + |> List.map(fst), ); Ok((package, full)); }; @@ -105,28 +101,12 @@ let fileForUri = (state, uri) => { switch (getFullFromCmt(~state, ~uri)) { | Error(e) => Error(e) | Ok((_package, {extra, file})) => Ok((file, extra)) - } + }; }; let fileForModule = (state, ~package, modname) => { switch (docsForModule(modname, state, ~package)) { | None => None | Some((file, _)) => Some(file) - } -}; - -let extraForModule = (state, ~package, modname) => - if (Hashtbl.mem(package.pathsForModule, modname)) { - let paths = Hashtbl.find(package.pathsForModule, modname); - /* TODO do better? */ - switch (SharedTypes.getSrc(paths)) { - | None => None - | Some(src) => - switch (getFullFromCmt(~state, ~uri=Uri2.fromPath(src))) { - | Ok((_package, {extra})) => Some(extra) - | Error(_) => None - } - }; - } else { - None; }; +}; diff --git a/src/TopTypes.re b/src/TopTypes.re index d6291ebb..7f480935 100644 --- a/src/TopTypes.re +++ b/src/TopTypes.re @@ -11,20 +11,17 @@ type package = { interModuleDependencies: Hashtbl.t(moduleName, list(moduleName)), dependencyModules: list(moduleName), pathsForModule: Hashtbl.t(moduleName, SharedTypes.paths), - nameForPath: Hashtbl.t(filePath, moduleName), namespace: option(string), opens: list(string), }; type state = { - documentText: Hashtbl.t(uri, string), packagesByRoot: Hashtbl.t(string, package), rootForUri: Hashtbl.t(uri, string), cmtCache: Hashtbl.t(filePath, (float, SharedTypes.file)), }; let empty = () => { - documentText: Hashtbl.create(5), packagesByRoot: Hashtbl.create(1), rootForUri: Hashtbl.create(30), cmtCache: Hashtbl.create(30), diff --git a/src/Uri2.re b/src/Uri2.re index c16142ff..9b6d1925 100644 --- a/src/Uri2.re +++ b/src/Uri2.re @@ -1,7 +1,6 @@ module Uri: { type t; let fromPath: string => t; - let parse: string => option(t); let toPath: t => string; let toString: t => string; } = { @@ -29,41 +28,6 @@ module Uri: { let fromPath = path => {path, uri: pathToUri(path)}; - let parseWindowsUri = withoutScheme => { - withoutScheme - |> Str.substitute_first( - Str.regexp("^/\\([a-z]\\)%3A"), - text => { - let name = Str.matched_group(1, text); - String.uppercase_ascii(name) ++ ":"; - }, - ) - /* OCaml doesn't want to do a find & replace where the replacement is a single backslash. So this works */ - |> Str.split(Str.regexp_string("/")) - |> String.concat({|\|}); - }; - - let parseUri = uri => { - let withoutPct = Uri.pct_decode(uri); - if (Utils.startsWith(withoutPct, "file://")) { - let withoutScheme = - Utils.sliceToEnd(withoutPct, String.length("file://")); - - if (Sys.os_type == "Unix") { - Some(withoutScheme); - } else { - Some(parseWindowsUri(withoutScheme)); - }; - } else { - None; - }; - }; - - let parse = uri => - switch (parseUri(uri)) { - | Some(path) => Some({uri, path}) - | None => None - }; let toPath = ({path}) => path; let toString = ({uri}) => uri; }; diff --git a/src/dune b/src/dune index 8808247e..611b3bfa 100644 --- a/src/dune +++ b/src/dune @@ -2,6 +2,6 @@ (executable (name RescriptEditorSupport) (public_name rescript-editor-support.exe) - (libraries str compiler-libs.common uri unix) + (libraries str compiler-libs.common unix) (flags "-w" "+26+27+32+33+39") )