From: Puyan Lotfi Date: Tue, 9 May 2017 17:13:37 +0000 (+0000) Subject: Adding VSCode syntax colorizer to utils (generated from textmate colorizer). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92fa36802d296b09e4239f1e0bc59c3f9d3d6f03;p=llvm Adding VSCode syntax colorizer to utils (generated from textmate colorizer). --This line, and those below, will be igored-- A utils/vscode A utils/vscode/README A utils/vscode/tablegen A utils/vscode/tablegen/.vscode A utils/vscode/tablegen/.vscode/launch.json A utils/vscode/tablegen/CHANGELOG.md A utils/vscode/tablegen/README.md A utils/vscode/tablegen/language-configuration.json A utils/vscode/tablegen/package.json A utils/vscode/tablegen/syntaxes A utils/vscode/tablegen/syntaxes/TableGen.tmLanguage A utils/vscode/tablegen/vsc-extension-quickstart.md git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302553 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/vscode/README b/utils/vscode/README new file mode 100644 index 00000000000..6febb5e3c10 --- /dev/null +++ b/utils/vscode/README @@ -0,0 +1,18 @@ +This directory contains a "bundle" for doing syntax highlighting of TableGen +files for the Microsoft VSCode editor. The highlighting follows that done by +the TextMate "C" bundle as it is a translation of the textmate bundle to VSCode +using the "yo code" npm package. Currently, keywords, comments, and strings are +highlighted. + +This colorizer was generate by the vscode-generator tool "Yo Code" +(https://github.com/Microsoft/vscode-generator-code) from the existing TableGen +text TableGen.tmLanguage syntax colorizer in utils/textmate. This README was +copied from utils/textmate/README. + +To install this VSCode .td file colorizer, copy it to the following locations +per your Operating System: + + - Windows: %USERPROFILE%\.vscode\extensions + - Mac: ~/.vscode/extensions + - Linux: ~/.vscode/extensions + diff --git a/utils/vscode/tablegen/.vscode/launch.json b/utils/vscode/tablegen/.vscode/launch.json new file mode 100644 index 00000000000..8384213de75 --- /dev/null +++ b/utils/vscode/tablegen/.vscode/launch.json @@ -0,0 +1,13 @@ +// A launch configuration that launches the extension inside a new window +{ + "version": "0.1.0", + "configurations": [ + { + "name": "Launch Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] + } + ] +} \ No newline at end of file diff --git a/utils/vscode/tablegen/CHANGELOG.md b/utils/vscode/tablegen/CHANGELOG.md new file mode 100644 index 00000000000..4cedbb953a9 --- /dev/null +++ b/utils/vscode/tablegen/CHANGELOG.md @@ -0,0 +1,4 @@ +# Change Log + +- Initial release + diff --git a/utils/vscode/tablegen/README.md b/utils/vscode/tablegen/README.md new file mode 100644 index 00000000000..e726004edf7 --- /dev/null +++ b/utils/vscode/tablegen/README.md @@ -0,0 +1,13 @@ +# tablegen README + +This VSCode colorizer extension is a translation of the textmate bunble to +VSCode using the "yo code" npm package. Currently, keywords, comments, and +strings are highlighted. + +To install this VSCode .td file colorizer, copy it to the following locations +per your Operating System: + + - Windows: %USERPROFILE%\.vscode\extensions + - Mac: ~/.vscode/extensions + - Linux: ~/.vscode/extensions + diff --git a/utils/vscode/tablegen/language-configuration.json b/utils/vscode/tablegen/language-configuration.json new file mode 100644 index 00000000000..aa257100076 --- /dev/null +++ b/utils/vscode/tablegen/language-configuration.json @@ -0,0 +1,30 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": "//", + // symbols used for start and end a block comment. Remove this entry if your language does not support block comments + "blockComment": [ "/*", "*/" ] + }, + // symbols used as brackets + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + // symbols that that can be used to surround a selection + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} \ No newline at end of file diff --git a/utils/vscode/tablegen/package.json b/utils/vscode/tablegen/package.json new file mode 100644 index 00000000000..efd32accf13 --- /dev/null +++ b/utils/vscode/tablegen/package.json @@ -0,0 +1,26 @@ +{ + "name": "tablegen", + "displayName": "TableGen", + "description": "VSCode Language Colorizer for LLVM's TableGen language.", + "version": "0.0.1", + "publisher": "llvm", + "engines": { + "vscode": "^1.12.0" + }, + "categories": [ + "Languages" + ], + "contributes": { + "languages": [{ + "id": "tablegen", + "aliases": ["TableGen", "tablegen"], + "extensions": [".td"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "tablegen", + "scopeName": "source.tablegen", + "path": "./syntaxes/TableGen.tmLanguage" + }] + } +} \ No newline at end of file diff --git a/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage b/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage new file mode 100644 index 00000000000..f3cf2d618fd --- /dev/null +++ b/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage @@ -0,0 +1,132 @@ + + + + + fileTypes + td + foldingStartMarker + /\*\*|\{\s*$ + foldingStopMarker + \*\*/|^\s*\} + name + TableGen + patterns + + + include + #comments + + + match + \b(def|let|in|code|dag|string|list|bits|bit|field|include|defm|foreach|class|multiclass|int)\b + name + keyword.control.tablegen + + + begin + " + end + " + name + string.quoted.double.untitled + patterns + + + match + \\. + name + constant.character.escape.tablegen + + + + + repository + + comments + + patterns + + + captures + + 1 + + name + meta.toc-list.banner.block.tablegen + + + match + ^/\* =(\s*.*?)\s*= \*/$\n? + name + comment.block.tablegen + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.tablegen + + + end + \*/ + name + comment.block.tablegen + + + match + \*/.*\n + name + invalid.illegal.stray-comment-end.tablegen + + + captures + + 1 + + name + meta.toc-list.banner.line.tablegen + + + match + ^// =(\s*.*?)\s*=\s*$\n? + name + comment.line.banner.tablegen + + + begin + // + beginCaptures + + 0 + + name + punctuation.definition.comment.tablegen + + + end + $\n? + name + comment.line.double-slash.tablegen + patterns + + + match + (?>\\\s*\n) + name + punctuation.separator.continuation.tablegen + + + + + + + scopeName + source.tablegen + uuid + 3A090BFC-E74B-4993-8DAE-7CCF6D238A32 + + diff --git a/utils/vscode/tablegen/vsc-extension-quickstart.md b/utils/vscode/tablegen/vsc-extension-quickstart.md new file mode 100644 index 00000000000..abfbfdb7021 --- /dev/null +++ b/utils/vscode/tablegen/vsc-extension-quickstart.md @@ -0,0 +1,27 @@ +# Welcome to your VS Code Extension + +## What's in the folder +* This folder contains all of the files necessary for your extension +* `package.json` - this is the manifest file in which you declare your language support and define +the location of the grammar file that has been copied into you extension. +* `syntaxes/TableGen.tmLanguage` - this is the Text mate grammar file that is used for tokenization +* `language-configuration.json` - this the language configuration, defining the tokens that are used for +comments and brackets. + +## Get up and running straight away +* Make sure the language configuration settings in `language-configuration.json` are accurate +* press `F5` to open a new window with your extension loaded +* create a new file with a file name suffix matching your language +* verify that syntax highlight works and that the language configuration settings are working + +## Make changes +* you can relaunch the extension from the debug toolbar after making changes to the files listed above +* you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes + +## Add more language features +* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at +https://code.visualstudio.com/docs + +## Install your extension +* To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. +* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension. \ No newline at end of file