diff options
| -rw-r--r-- | llvm/utils/vscode/README | 18 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/.vscode/launch.json | 13 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/CHANGELOG.md | 4 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/README.md | 13 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/language-configuration.json | 30 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/package.json | 26 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage | 132 | ||||
| -rw-r--r-- | llvm/utils/vscode/tablegen/vsc-extension-quickstart.md | 27 |
8 files changed, 263 insertions, 0 deletions
diff --git a/llvm/utils/vscode/README b/llvm/utils/vscode/README new file mode 100644 index 00000000000..6febb5e3c10 --- /dev/null +++ b/llvm/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/llvm/utils/vscode/tablegen/.vscode/launch.json b/llvm/utils/vscode/tablegen/.vscode/launch.json new file mode 100644 index 00000000000..8384213de75 --- /dev/null +++ b/llvm/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/llvm/utils/vscode/tablegen/CHANGELOG.md b/llvm/utils/vscode/tablegen/CHANGELOG.md new file mode 100644 index 00000000000..4cedbb953a9 --- /dev/null +++ b/llvm/utils/vscode/tablegen/CHANGELOG.md @@ -0,0 +1,4 @@ +# Change Log + +- Initial release + diff --git a/llvm/utils/vscode/tablegen/README.md b/llvm/utils/vscode/tablegen/README.md new file mode 100644 index 00000000000..e726004edf7 --- /dev/null +++ b/llvm/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/llvm/utils/vscode/tablegen/language-configuration.json b/llvm/utils/vscode/tablegen/language-configuration.json new file mode 100644 index 00000000000..aa257100076 --- /dev/null +++ b/llvm/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/llvm/utils/vscode/tablegen/package.json b/llvm/utils/vscode/tablegen/package.json new file mode 100644 index 00000000000..efd32accf13 --- /dev/null +++ b/llvm/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/llvm/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage b/llvm/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage new file mode 100644 index 00000000000..f3cf2d618fd --- /dev/null +++ b/llvm/utils/vscode/tablegen/syntaxes/TableGen.tmLanguage @@ -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> diff --git a/llvm/utils/vscode/tablegen/vsc-extension-quickstart.md b/llvm/utils/vscode/tablegen/vsc-extension-quickstart.md new file mode 100644 index 00000000000..abfbfdb7021 --- /dev/null +++ b/llvm/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 `<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 |

