From 258ac089b7bbf59bd368a2beed4b54a38da8d449 Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Thu, 19 Jan 2017 14:29:31 -0800 Subject: [PATCH] Change language-id for manifest.yml files --- .../vscode-manifest-yaml/lib/Main.ts | 3 +- .../vscode-manifest-yaml/package.json | 21 +++++++++++++- .../scripts/preinstall.sh | 7 +++++ .../yaml-support/.gitignore | 1 + .../yaml-support/OSSREADME.json | 28 +++++++++++++++++++ .../yaml-support/language-configuration.json | 24 ++++++++++++++++ 6 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 vscode-extensions/vscode-manifest-yaml/yaml-support/.gitignore create mode 100644 vscode-extensions/vscode-manifest-yaml/yaml-support/OSSREADME.json create mode 100644 vscode-extensions/vscode-manifest-yaml/yaml-support/language-configuration.json diff --git a/vscode-extensions/vscode-manifest-yaml/lib/Main.ts b/vscode-extensions/vscode-manifest-yaml/lib/Main.ts index 6c26f61ba..b5418af82 100644 --- a/vscode-extensions/vscode-manifest-yaml/lib/Main.ts +++ b/vscode-extensions/vscode-manifest-yaml/lib/Main.ts @@ -40,7 +40,8 @@ export function activate(context: VSCode.ExtensionContext) { // events pass on to Language Server only for documents for which function passed via textDocumentFilter property return true // TODO: Remove cast ones https://github.com/Microsoft/vscode-languageserver-node/issues/9 is resolved - documentSelector: [ {language: 'yaml', pattern: '**/manifest*.yml'}], + documentSelector: ["manifest-yaml"], +// documentSelector: [ {language: 'yaml', pattern: '**/manifest*.yml'}], synchronize: { // TODO: Remove textDocumentFilter property once https://github.com/Microsoft/vscode-languageserver-node/issues/9 is resolved textDocumentFilter: function(textDocument : TextDocument) : boolean { diff --git a/vscode-extensions/vscode-manifest-yaml/package.json b/vscode-extensions/vscode-manifest-yaml/package.json index f662ace6c..6bec02553 100644 --- a/vscode-extensions/vscode-manifest-yaml/package.json +++ b/vscode-extensions/vscode-manifest-yaml/package.json @@ -24,8 +24,27 @@ "manifest.yml" ], "activationEvents": [ - "onLanguage:yaml" + "onLanguage:manifest-yaml" ], + "contributes": { + "languages": [ + { + "id": "manifest-yaml", + "aliases": [ + "cloudfoundry-manifest" + ], + "filenamePatterns": [ + "*manifest*.yml" + ], + "configuration": "./yaml-support/language-configuration.json" + } + ], + "grammars": [{ + "language": "manifest-yaml", + "scopeName": "source.yaml", + "path": "./yaml-support/yaml.tmLanguage" + }] + }, "main": "./out/lib/Main", "scripts": { "prepublish": "tsc -p .", diff --git a/vscode-extensions/vscode-manifest-yaml/scripts/preinstall.sh b/vscode-extensions/vscode-manifest-yaml/scripts/preinstall.sh index 07b1b88ce..c1f651ae3 100755 --- a/vscode-extensions/vscode-manifest-yaml/scripts/preinstall.sh +++ b/vscode-extensions/vscode-manifest-yaml/scripts/preinstall.sh @@ -1,5 +1,12 @@ #!/bin/bash set -e +# Download yaml TextMate grammar +curl https://raw.githubusercontent.com/textmate/yaml.tmbundle/master/Syntaxes/YAML.tmLanguage > yaml-support/yaml.tmLanguage + +# Preinstall commons-vscode package (cd ../commons-vscode ; npm install) npm install ../commons-vscode + +# Use maven to build fat jar of the language server ../mvnw -U -f ../pom.xml -pl vscode-manifest-yaml -am clean install + diff --git a/vscode-extensions/vscode-manifest-yaml/yaml-support/.gitignore b/vscode-extensions/vscode-manifest-yaml/yaml-support/.gitignore new file mode 100644 index 000000000..ddc0ef4f6 --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/yaml-support/.gitignore @@ -0,0 +1 @@ +yaml.tmLanguage \ No newline at end of file diff --git a/vscode-extensions/vscode-manifest-yaml/yaml-support/OSSREADME.json b/vscode-extensions/vscode-manifest-yaml/yaml-support/OSSREADME.json new file mode 100644 index 000000000..bcdae2a4c --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/yaml-support/OSSREADME.json @@ -0,0 +1,28 @@ +// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: + +[{ + "name": "textmate/yaml.tmbundle", + "version": "0.0.0", + "license": "TextMate Bundle License", + "repositoryURL": "https://github.com/textmate/yaml.tmbundle", + "licenseDetail": [ + "Copyright (c) 2015 FichteFoll ", + "", + "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." + ] +}] diff --git a/vscode-extensions/vscode-manifest-yaml/yaml-support/language-configuration.json b/vscode-extensions/vscode-manifest-yaml/yaml-support/language-configuration.json new file mode 100644 index 000000000..cab4f6602 --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/yaml-support/language-configuration.json @@ -0,0 +1,24 @@ +{ + "comments": { + "lineComment": "#" + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} \ No newline at end of file