about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-11-08 18:49:15 -0800
committerKartik Agaram <vc@akkartik.com>2021-11-08 18:49:15 -0800
commit2bac01fb7b4e43a2f7e707b7848d1b925d598cda (patch)
treeee776cf03a887b5e341d12f250175e55dc148250
parent11a191c2906fbaa2d80192da833b727984cf8f94 (diff)
downloadmu-2bac01fb7b4e43a2f7e707b7848d1b925d598cda.tar.gz
syntax highlighting for Visual Studio Code
-rw-r--r--editor/VSCode/.vscode/launch.json17
-rw-r--r--editor/VSCode/.vscodeignore4
-rw-r--r--editor/VSCode/CHANGELOG.md9
-rw-r--r--editor/VSCode/README.md65
-rw-r--r--editor/VSCode/language-configuration.json30
-rw-r--r--editor/VSCode/package.json25
-rw-r--r--editor/VSCode/syntaxes/Mu.tmLanguage96
-rw-r--r--editor/VSCode/vsc-extension-quickstart.md29
8 files changed, 275 insertions, 0 deletions
diff --git a/editor/VSCode/.vscode/launch.json b/editor/VSCode/.vscode/launch.json
new file mode 100644
index 00000000..0e191b59
--- /dev/null
+++ b/editor/VSCode/.vscode/launch.json
@@ -0,0 +1,17 @@
+// A launch configuration that launches the extension inside a new window
+// Use IntelliSense to learn about possible attributes.
+// Hover to view descriptions of existing attributes.
+// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+{
+	"version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Extension",
+            "type": "extensionHost",
+            "request": "launch",
+            "args": [
+                "--extensionDevelopmentPath=${workspaceFolder}"
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/editor/VSCode/.vscodeignore b/editor/VSCode/.vscodeignore
new file mode 100644
index 00000000..f369b5e5
--- /dev/null
+++ b/editor/VSCode/.vscodeignore
@@ -0,0 +1,4 @@
+.vscode/**
+.vscode-test/**
+.gitignore
+vsc-extension-quickstart.md
diff --git a/editor/VSCode/CHANGELOG.md b/editor/VSCode/CHANGELOG.md
new file mode 100644
index 00000000..5b37189b
--- /dev/null
+++ b/editor/VSCode/CHANGELOG.md
@@ -0,0 +1,9 @@
+# Change Log
+
+All notable changes to the "mu" extension will be documented in this file.
+
+Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
+
+## [Unreleased]
+
+- Initial release
\ No newline at end of file
diff --git a/editor/VSCode/README.md b/editor/VSCode/README.md
new file mode 100644
index 00000000..3230356e
--- /dev/null
+++ b/editor/VSCode/README.md
@@ -0,0 +1,65 @@
+# mu README
+
+This is the README for your extension "mu". After writing up a brief description, we recommend including the following sections.
+
+## Features
+
+Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
+
+For example if there is an image subfolder under your extension project workspace:
+
+\!\[feature X\]\(images/feature-x.png\)
+
+> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
+
+## Requirements
+
+If you have any requirements or dependencies, add a section describing those and how to install and configure them.
+
+## Extension Settings
+
+Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
+
+For example:
+
+This extension contributes the following settings:
+
+* `myExtension.enable`: enable/disable this extension
+* `myExtension.thing`: set to `blah` to do something
+
+## Known Issues
+
+Calling out known issues can help limit users opening duplicate issues against your extension.
+
+## Release Notes
+
+Users appreciate release notes as you update your extension.
+
+### 1.0.0
+
+Initial release of ...
+
+### 1.0.1
+
+Fixed issue #.
+
+### 1.1.0
+
+Added features X, Y, and Z.
+
+-----------------------------------------------------------------------------------------------------------
+
+## Working with Markdown
+
+**Note:** You can author your README using Visual Studio Code.  Here are some useful editor keyboard shortcuts:
+
+* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux)
+* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
+* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets
+
+### For more information
+
+* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
+* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
+
+**Enjoy!**
diff --git a/editor/VSCode/language-configuration.json b/editor/VSCode/language-configuration.json
new file mode 100644
index 00000000..8f162a0c
--- /dev/null
+++ b/editor/VSCode/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 can be used to surround a selection
+    "surroundingPairs": [
+        ["{", "}"],
+        ["[", "]"],
+        ["(", ")"],
+        ["\"", "\""],
+        ["'", "'"]
+    ]
+}
\ No newline at end of file
diff --git a/editor/VSCode/package.json b/editor/VSCode/package.json
new file mode 100644
index 00000000..6619f4ea
--- /dev/null
+++ b/editor/VSCode/package.json
@@ -0,0 +1,25 @@
+{
+    "name": "mu",
+    "displayName": "Mu",
+    "description": "Syntax Highlighting for the Mu language",
+    "version": "0.0.1",
+    "engines": {
+        "vscode": "^1.62.0"
+    },
+    "categories": [
+        "Programming Languages"
+    ],
+    "contributes": {
+        "languages": [{
+            "id": "mu",
+            "aliases": ["Mu", "mu"],
+            "extensions": [".mu"],
+            "configuration": "./language-configuration.json"
+        }],
+        "grammars": [{
+            "language": "mu",
+            "scopeName": "source.mu",
+            "path": "./syntaxes/Mu.tmLanguage"
+        }]
+    }
+}
\ No newline at end of file
diff --git a/editor/VSCode/syntaxes/Mu.tmLanguage b/editor/VSCode/syntaxes/Mu.tmLanguage
new file mode 100644
index 00000000..64f71320
--- /dev/null
+++ b/editor/VSCode/syntaxes/Mu.tmLanguage
@@ -0,0 +1,96 @@
+<?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>mu</string>
+	</array>
+	<key>name</key>
+	<string>Mu</string>
+	<key>patterns</key>
+	<array>
+		<dict>
+			<key>match</key>
+			<string>#.*</string>
+			<key>name</key>
+			<string>comment.line.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string> &lt;- </string>
+			<key>name</key>
+			<string>meta.operator.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b(return|break[^ ]*|loop[^ ]*)</string>
+			<key>name</key>
+			<string>keyword.control.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b[^ ]*:\b</string>
+			<key>name</key>
+			<string>constant.other.label.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>^fn|-&gt;\b</string>
+			<key>name</key>
+			<string>meta.function.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\bvar\b</string>
+			<key>name</key>
+			<string>storage.type.var.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b(addr|array|boolean|byte|code-point|grapheme|handle|int|float|stream|type)\b</string>
+			<key>name</key>
+			<string>storage.type.mu</string>
+		</dict>
+		<dict>
+			<key>begin</key>
+			<string>"</string>
+			<key>end</key>
+			<string>"</string>
+			<key>name</key>
+			<string>string.quoted.double.mu</string>
+			<key>patterns</key>
+			<array>
+				<dict>
+					<key>match</key>
+					<string>\.</string>
+					<key>name</key>
+					<string>constant.character.escape</string>
+				</dict>
+			</array>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b(0x\h+|[0-9])\b</string>
+			<key>name</key>
+			<string>constant.numeric.integer.mu</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b([0-9][0-9a-f]+)\b</string>
+			<key>name</key>
+			<string>invalid.illegal.constant.numeric</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>\b([0-9a-zA-Z][0-9a-zA-Z])\b</string>
+			<key>name</key>
+			<string>invalid.illegal.constant.numeric</string>
+		</dict>
+	</array>
+	<key>scopeName</key>
+	<string>source.mu</string>
+	<key>uuid</key>
+	<string>766C3FEA-ED70-4B61-B17B-79E6ECE54036</string>
+</dict>
+</plist>
diff --git a/editor/VSCode/vsc-extension-quickstart.md b/editor/VSCode/vsc-extension-quickstart.md
new file mode 100644
index 00000000..856221dc
--- /dev/null
+++ b/editor/VSCode/vsc-extension-quickstart.md
@@ -0,0 +1,29 @@
+# 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 your extension.
+* `syntaxes/Mu.tmLanguage` - this is the Text mate grammar file that is used for tokenization.
+* `language-configuration.json` - this is 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 highlighting 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.