[llvm] r302553 - Adding VSCode syntax colorizer to utils (generated from textmate colorizer).

Puyan Lotfi via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 10:13:37 PDT 2017


Author: zer0
Date: Tue May  9 12:13:37 2017
New Revision: 302553

URL: http://llvm.org/viewvc/llvm-project?rev=302553&view=rev
Log:
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

Added:
    llvm/trunk/utils/vscode/
    llvm/trunk/utils/vscode/README
    llvm/trunk/utils/vscode/tablegen/
    llvm/trunk/utils/vscode/tablegen/.vscode/
    llvm/trunk/utils/vscode/tablegen/.vscode/launch.json
    llvm/trunk/utils/vscode/tablegen/CHANGELOG.md
    llvm/trunk/utils/vscode/tablegen/README.md
    llvm/trunk/utils/vscode/tablegen/language-configuration.json
    llvm/trunk/utils/vscode/tablegen/package.json
    llvm/trunk/utils/vscode/tablegen/syntaxes/
    llvm/trunk/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage
    llvm/trunk/utils/vscode/tablegen/vsc-extension-quickstart.md

Added: llvm/trunk/utils/vscode/README
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/README?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/README (added)
+++ llvm/trunk/utils/vscode/README Tue May  9 12:13:37 2017
@@ -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
+

Added: llvm/trunk/utils/vscode/tablegen/.vscode/launch.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/.vscode/launch.json?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/.vscode/launch.json (added)
+++ llvm/trunk/utils/vscode/tablegen/.vscode/launch.json Tue May  9 12:13:37 2017
@@ -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

Added: llvm/trunk/utils/vscode/tablegen/CHANGELOG.md
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/CHANGELOG.md?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/CHANGELOG.md (added)
+++ llvm/trunk/utils/vscode/tablegen/CHANGELOG.md Tue May  9 12:13:37 2017
@@ -0,0 +1,4 @@
+# Change Log
+
+- Initial release
+

Added: llvm/trunk/utils/vscode/tablegen/README.md
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/README.md?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/README.md (added)
+++ llvm/trunk/utils/vscode/tablegen/README.md Tue May  9 12:13:37 2017
@@ -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
+

Added: llvm/trunk/utils/vscode/tablegen/language-configuration.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/language-configuration.json?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/language-configuration.json (added)
+++ llvm/trunk/utils/vscode/tablegen/language-configuration.json Tue May  9 12:13:37 2017
@@ -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

Added: llvm/trunk/utils/vscode/tablegen/package.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/package.json?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/package.json (added)
+++ llvm/trunk/utils/vscode/tablegen/package.json Tue May  9 12:13:37 2017
@@ -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

Added: llvm/trunk/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage (added)
+++ llvm/trunk/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage Tue May  9 12:13:37 2017
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>fileTypes</key>
+	<array><string>td</string></array>
+	<key>foldingStartMarker</key>
+	<string>/\*\*|\{\s*$</string>
+	<key>foldingStopMarker</key>
+	<string>\*\*/|^\s*\}</string>
+	<key>name</key>
+	<string>TableGen</string>
+	<key>patterns</key>
+	<array>
+		<dict>
+			<key>include</key>
+			<string>#comments</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b(def|let|in|code|dag|string|list|bits|bit|field|include|defm|foreach|class|multiclass|int)\b</string>
+			<key>name</key>
+			<string>keyword.control.tablegen</string>
+		</dict>
+		<dict>
+			<key>begin</key>
+			<string>"</string>
+			<key>end</key>
+			<string>"</string>
+			<key>name</key>
+			<string>string.quoted.double.untitled</string>
+			<key>patterns</key>
+			<array>
+				<dict>
+					<key>match</key>
+					<string>\\.</string>
+					<key>name</key>
+					<string>constant.character.escape.tablegen</string>
+				</dict>
+			</array>
+		</dict>
+	</array>
+	<key>repository</key>
+	<dict>
+		<key>comments</key>
+		<dict>
+			<key>patterns</key>
+			<array>
+				<dict>
+					<key>captures</key>
+					<dict>
+						<key>1</key>
+						<dict>
+							<key>name</key>
+							<string>meta.toc-list.banner.block.tablegen</string>
+						</dict>
+					</dict>
+					<key>match</key>
+					<string>^/\* =(\s*.*?)\s*= \*/$\n?</string>
+					<key>name</key>
+					<string>comment.block.tablegen</string>
+				</dict>
+				<dict>
+					<key>begin</key>
+					<string>/\*</string>
+					<key>captures</key>
+					<dict>
+						<key>0</key>
+						<dict>
+							<key>name</key>
+							<string>punctuation.definition.comment.tablegen</string>
+						</dict>
+					</dict>
+					<key>end</key>
+					<string>\*/</string>
+					<key>name</key>
+					<string>comment.block.tablegen</string>
+				</dict>
+				<dict>
+					<key>match</key>
+					<string>\*/.*\n</string>
+					<key>name</key>
+					<string>invalid.illegal.stray-comment-end.tablegen</string>
+				</dict>
+				<dict>
+					<key>captures</key>
+					<dict>
+						<key>1</key>
+						<dict>
+							<key>name</key>
+							<string>meta.toc-list.banner.line.tablegen</string>
+						</dict>
+					</dict>
+					<key>match</key>
+					<string>^// =(\s*.*?)\s*=\s*$\n?</string>
+					<key>name</key>
+					<string>comment.line.banner.tablegen</string>
+				</dict>
+				<dict>
+					<key>begin</key>
+					<string>//</string>
+					<key>beginCaptures</key>
+					<dict>
+						<key>0</key>
+						<dict>
+							<key>name</key>
+							<string>punctuation.definition.comment.tablegen</string>
+						</dict>
+					</dict>
+					<key>end</key>
+					<string>$\n?</string>
+					<key>name</key>
+					<string>comment.line.double-slash.tablegen</string>
+					<key>patterns</key>
+					<array>
+						<dict>
+							<key>match</key>
+							<string>(?>\\\s*\n)</string>
+							<key>name</key>
+							<string>punctuation.separator.continuation.tablegen</string>
+						</dict>
+					</array>
+				</dict>
+			</array>
+		</dict>
+	</dict>
+	<key>scopeName</key>
+	<string>source.tablegen</string>
+	<key>uuid</key>
+	<string>3A090BFC-E74B-4993-8DAE-7CCF6D238A32</string>
+</dict>
+</plist>

Added: llvm/trunk/utils/vscode/tablegen/vsc-extension-quickstart.md
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vscode/tablegen/vsc-extension-quickstart.md?rev=302553&view=auto
==============================================================================
--- llvm/trunk/utils/vscode/tablegen/vsc-extension-quickstart.md (added)
+++ llvm/trunk/utils/vscode/tablegen/vsc-extension-quickstart.md Tue May  9 12:13:37 2017
@@ -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 `<user home>/.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




More information about the llvm-commits mailing list