VSCode syntax highlighting
This commit is contained in:
parent
6a6bc874de
commit
a01b105dd4
18 changed files with 423 additions and 13 deletions
|
@ -1 +1,2 @@
|
|||
rust 1.63.0
|
||||
rust 1.64.0
|
||||
nodejs 16.16.0
|
||||
|
|
|
@ -8,7 +8,7 @@ use String
|
|||
protocol Error, as: do
|
||||
def message(self: Self): String
|
||||
|
||||
defs raise(error: Error): Any, as: do
|
||||
def raise(error: Error): Any, as: do
|
||||
Nif.error_raise(error)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,6 @@ protocol LogicalAnd, as: do
|
|||
|
||||
If `LogicalAnd.true?` is true for both the left-hand and right-hand values, the right-hand value is returned. Otherwise None.
|
||||
```
|
||||
def and(self: Self, _other: Any): Option, when: true?(self) && true?(other), as: Option.some(other)
|
||||
def and(self: Self, other: Any): Option, when: true?(self) && true?(other), as: Option.some(other)
|
||||
def and(_self: Self, _other: Any): Option, as: Option.none()
|
||||
end
|
||||
|
|
|
@ -36,10 +36,10 @@ protocol Option, as: do
|
|||
```doc
|
||||
Create a new "some" value using the default some type.
|
||||
```
|
||||
defs some(value: Any): Option, as: Some.new(value)
|
||||
def some(value: Any): Option, as: Some.new(value)
|
||||
|
||||
```doc
|
||||
Create a new "none" value using the default none type.
|
||||
```
|
||||
defs none(): Option, as: None.new()
|
||||
def none(): Option, as: None.new()
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ use Result
|
|||
The default implementation of an "Error" result type.
|
||||
```
|
||||
struct Outrun.Core.Error(error: Error), as: do
|
||||
defs new(error: Error), as: Self { error: error }
|
||||
def new(error: Error), as: Self { error: error }
|
||||
end
|
||||
|
||||
impl Result, for: Outrun.Core.Error, as: do
|
||||
|
@ -19,7 +19,7 @@ impl Result, for: Outrun.Core.Error, as: do
|
|||
end
|
||||
|
||||
struct Outrun.Core.Error.UnwrapError(value: Outrun.Core.Error), as: do
|
||||
defs new(value: Outrun.Core.Error), as: Self { value: value }
|
||||
def new(value: Outrun.Core.Error), as: Self { value: value }
|
||||
|
||||
def message(self: Self): String, as: "Attempted to unwrap on an error result"
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ impl Option, for: Outrun.Core.None, as: do
|
|||
Error.raise(Self.UnwrapError{})
|
||||
end
|
||||
|
||||
defs new(): Self, as: Self {}
|
||||
def new(): Self, as: Self {}
|
||||
end
|
||||
|
||||
struct Outrun.Core.None.UnwrapError
|
||||
|
|
|
@ -8,7 +8,7 @@ use String
|
|||
The default implementation of an "Okay" result type.
|
||||
```
|
||||
struct Outrun.Core.Okay(value: Any), as: do
|
||||
defs new(value: Any), as: Self { value: value }
|
||||
def new(value: Any), as: Self { value: value }
|
||||
end
|
||||
|
||||
impl Result, for: Outrun.Core.Okay, as: do
|
||||
|
@ -20,7 +20,7 @@ impl Result, for: Outrun.Core.Okay, as: do
|
|||
end
|
||||
|
||||
struct Outrun.Core.Okay.UnwrapError(value: Outrun.Core.Okay), as: do
|
||||
defs new(value: Outrun.Core.Okay), as: Self { value: value }
|
||||
def new(value: Outrun.Core.Okay), as: Self { value: value }
|
||||
|
||||
def message(self: Self): String, as: "Attempted to unwrap_error on a successful result"
|
||||
end
|
||||
|
|
|
@ -17,5 +17,5 @@ impl Option, for: Outrun.Core.Some, as: do
|
|||
|
||||
def unwrap(self: Self): Any, as: self.value
|
||||
|
||||
defs new(value: Any): Self, as: Self { value: value }
|
||||
def new(value: Any): Self, as: Self { value: value }
|
||||
end
|
||||
|
|
|
@ -46,10 +46,10 @@ protocol Result, as: do
|
|||
```doc
|
||||
Creates a new successful result from a value.
|
||||
```
|
||||
defs okay(value: Any): Result, as: Outrun.Core.Okay.new(value)
|
||||
def okay(value: Any): Result, as: Outrun.Core.Okay.new(value)
|
||||
|
||||
```doc
|
||||
Creates a new unsuccessful result from an error.
|
||||
```
|
||||
defs error(error: Error): Result, as: Outrun.Core.Error.new(error)
|
||||
def error(error: Error): Result, as: Outrun.Core.Error.new(error)
|
||||
end
|
||||
|
|
17
outrun-vscode/.vscode/launch.json
vendored
Normal file
17
outrun-vscode/.vscode/launch.json
vendored
Normal file
|
@ -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}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
4
outrun-vscode/.vscodeignore
Normal file
4
outrun-vscode/.vscodeignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
.vscode/**
|
||||
.vscode-test/**
|
||||
.gitignore
|
||||
vsc-extension-quickstart.md
|
9
outrun-vscode/CHANGELOG.md
Normal file
9
outrun-vscode/CHANGELOG.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to the "outrun-vscode" 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
|
65
outrun-vscode/README.md
Normal file
65
outrun-vscode/README.md
Normal file
|
@ -0,0 +1,65 @@
|
|||
# outrun-vscode README
|
||||
|
||||
This is the README for your extension "outrun-vscode". 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
|
||||
|
||||
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, 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!**
|
72
outrun-vscode/language-configuration.json
Normal file
72
outrun-vscode/language-configuration.json
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"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": [
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"'",
|
||||
"'"
|
||||
]
|
||||
]
|
||||
}
|
15
outrun-vscode/package-lock.json
generated
Normal file
15
outrun-vscode/package-lock.json
generated
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "outrun-vscode",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "outrun-vscode",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"vscode": "^1.71.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
outrun-vscode/package.json
Normal file
33
outrun-vscode/package.json
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "outrun-vscode",
|
||||
"displayName": "Outrun Syntax Highlighting",
|
||||
"description": "Outrun syntax highlighting for VS Code",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"vscode": "^1.71.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"id": "outrun",
|
||||
"aliases": [
|
||||
"Outrun",
|
||||
"outrun"
|
||||
],
|
||||
"extensions": [
|
||||
".outrun"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}],
|
||||
"grammars": [{
|
||||
"language": "outrun",
|
||||
"scopeName": "source.outrun",
|
||||
"path": "./syntaxes/outrun.tmLanguage.json",
|
||||
"embeddedLanguages": {
|
||||
"meta.embedded.block.markdown": "markdown"
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
165
outrun-vscode/syntaxes/outrun.tmLanguage.json
Normal file
165
outrun-vscode/syntaxes/outrun.tmLanguage.json
Normal file
|
@ -0,0 +1,165 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "Outrun",
|
||||
"fileTypes": [
|
||||
"outrun"
|
||||
],
|
||||
"patterns": [{
|
||||
"comment": "Multi-line documentation",
|
||||
"begin": "```doc\r?\n",
|
||||
"end": "\\s*```",
|
||||
"name": "comment.block.documentation.outrun"
|
||||
},
|
||||
{
|
||||
"begin": "\"",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.begin.outrun"
|
||||
}
|
||||
},
|
||||
"comment": "double quoted string (allows for interpolation)",
|
||||
"end": "\"",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.end.outrun"
|
||||
}
|
||||
},
|
||||
"name": "string.quoted.double.outrun"
|
||||
},
|
||||
{
|
||||
"comment": "`use` keyword",
|
||||
"match": "(use)\\s+",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.use.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "`struct` keyword",
|
||||
"match": "(struct)\\s+",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.struct.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "`protocol` keyword",
|
||||
"match": "(protocol)\\s+",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.protocol.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "`impl` keyword",
|
||||
"match": "(impl)\\s+",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.impl.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "function definition",
|
||||
"match": "(defp?)\\s+(_?[a-z]\\w*[?]?)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.def.outrun"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.function.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "A type name",
|
||||
"match": "(([A-Z]\\w*\\s*(\\.)\\s*)*[A-Z]\\w*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.type.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Keyword argument",
|
||||
"match": "(,\\s*)?(_?[a-z]\\w*[?!]?):",
|
||||
"captures": {
|
||||
"2": {
|
||||
"name": "variable.parameter.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Block",
|
||||
"begin": "(do)\\s*",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.other.do.outrun"
|
||||
}
|
||||
},
|
||||
"end": "\\s*(end)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.other.end.outrun"
|
||||
}
|
||||
},
|
||||
"patterns": [{
|
||||
"include": "$self"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"comment": "Local function call",
|
||||
"begin": "(_?[a-z]\\w*[?!]?)\\s*\\(",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.outrun"
|
||||
}
|
||||
},
|
||||
"end": "\\s*\\)",
|
||||
"patterns": [{
|
||||
"include": "$self"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"comment": "Indexed function call",
|
||||
"begin": "\\.(_?[a-z]\\w*[?!]?)\\s*\\(",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.outrun"
|
||||
}
|
||||
},
|
||||
"end": "\\s*\\)",
|
||||
"patterns": [{
|
||||
"include": "$self"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"comment": "Struct index",
|
||||
"match": "\\.(_?[a-z]\\w*[?!]?)",
|
||||
"name": "entity.other.attribute-name.outrun"
|
||||
},
|
||||
{
|
||||
"comment": "boolean literals",
|
||||
"match": "(true|false)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.language.boolean.outrun"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "local variables",
|
||||
"match": "(_?[a-z]\\w*[?]?)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.name.outrun"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"repository": {},
|
||||
"scopeName": "source.outrun"
|
||||
}
|
29
outrun-vscode/vsc-extension-quickstart.md
Normal file
29
outrun-vscode/vsc-extension-quickstart.md
Normal file
|
@ -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/outrun.tmLanguage.json` - 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.
|
Loading…
Reference in a new issue