intelliwacc ide #43
4
wacc-syntax/.vscodeignore
Normal file
4
wacc-syntax/.vscodeignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.vscode/**
|
||||||
|
.vscode-test/**
|
||||||
|
.gitignore
|
||||||
|
vsc-extension-quickstart.md
|
||||||
9
wacc-syntax/CHANGELOG.md
Normal file
9
wacc-syntax/CHANGELOG.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to the "wacc-syntax" 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
wacc-syntax/README.md
Normal file
65
wacc-syntax/README.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# wacc-syntax README
|
||||||
|
|
||||||
|
This is the README for your extension "wacc-syntax". 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!**
|
||||||
38
wacc-syntax/extension.js
Normal file
38
wacc-syntax/extension.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
const vscode = require('vscode');
|
||||||
|
|
||||||
|
function activate(context) {
|
||||||
|
console.log('IntelliWACC is now active!');
|
||||||
|
|
||||||
|
// Create a DiagnosticCollection for error highlighting
|
||||||
|
let diagnosticCollection = vscode.languages.createDiagnosticCollection('wacc');
|
||||||
|
context.subscriptions.push(diagnosticCollection);
|
||||||
|
|
||||||
|
// Listen for document saves and run error checking
|
||||||
|
vscode.workspace.onDidSaveTextDocument((document) => {
|
||||||
|
if (document.languageId !== 'wacc') return;
|
||||||
|
|
||||||
|
let diagnostics = [];
|
||||||
|
let errors = runCompilerAndGetErrors(document.getText());
|
||||||
|
|
||||||
|
errors.forEach(error => {
|
||||||
|
let range = new vscode.Range(error.line, error.column, error.line, error.column + 1);
|
||||||
|
let diagnostic = new vscode.Diagnostic(range, error.message, vscode.DiagnosticSeverity.Error);
|
||||||
|
diagnostics.push(diagnostic);
|
||||||
|
});
|
||||||
|
|
||||||
|
diagnosticCollection.set(document.uri, diagnostics);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deactivate() {
|
||||||
|
console.log('IntelliWACC is deactivating...');
|
||||||
|
}
|
||||||
|
|
||||||
|
function runCompilerAndGetErrors(code) {
|
||||||
|
// COMPILER INTEGRATION
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
activate,
|
||||||
|
deactivate
|
||||||
|
};
|
||||||
28
wacc-syntax/language-configuration.json
Normal file
28
wacc-syntax/language-configuration.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"comments": {
|
||||||
|
// symbol used for single line comment. Remove this entry if your language does not support line comments
|
||||||
|
"lineComment": "#",
|
||||||
|
},
|
||||||
|
// symbols used as brackets
|
||||||
|
"brackets": [
|
||||||
|
["{", "}"],
|
||||||
|
["[", "]"],
|
||||||
|
["(", ")"]
|
||||||
|
],
|
||||||
|
// symbols that are auto closed when typing
|
||||||
|
"autoClosingPairs": [
|
||||||
|
["{", "}"],
|
||||||
|
["[", "]"],
|
||||||
|
["(", ")"],
|
||||||
|
["\"", "\""],
|
||||||
|
["'", "'"]
|
||||||
|
],
|
||||||
|
// symbols that can be used to surround a selection
|
||||||
|
"surroundingPairs": [
|
||||||
|
["{", "}"],
|
||||||
|
["[", "]"],
|
||||||
|
["(", ")"],
|
||||||
|
["\"", "\""],
|
||||||
|
["'", "'"]
|
||||||
|
]
|
||||||
|
}
|
||||||
15
wacc-syntax/package-lock.json
generated
Normal file
15
wacc-syntax/package-lock.json
generated
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "wacc-syntax",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "wacc-syntax",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.97.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
wacc-syntax/package.json
Normal file
32
wacc-syntax/package.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "wacc-syntax",
|
||||||
|
"displayName": "intelliWACC",
|
||||||
|
"description": "WACC language support features",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.97.0"
|
||||||
|
},
|
||||||
|
"categories": [
|
||||||
|
"Programming Languages"
|
||||||
|
],
|
||||||
|
"contributes": {
|
||||||
|
"languages": [{
|
||||||
|
"id": "wacc",
|
||||||
|
"aliases": ["WACC", "wacc"],
|
||||||
|
"extensions": [".wacc"],
|
||||||
|
"configuration": "./language-configuration.json"
|
||||||
|
}],
|
||||||
|
"grammars": [{
|
||||||
|
"language": "wacc",
|
||||||
|
"scopeName": "source.wacc",
|
||||||
|
"path": "./syntaxes/wacc.tmLanguage.json"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"vscode:prepublish": "npm run compile",
|
||||||
|
"compile": "tsc -p ./",
|
||||||
|
"watch": "tsc -watch -p ./",
|
||||||
|
"build": "vsce package"
|
||||||
|
},
|
||||||
|
"main": "./extension.js"
|
||||||
|
}
|
||||||
56
wacc-syntax/syntaxes/wacc.tmLanguage.json
Normal file
56
wacc-syntax/syntaxes/wacc.tmLanguage.json
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||||
|
"name": "WACC",
|
||||||
|
"scopeName": "source.wacc",
|
||||||
|
"fileTypes": [
|
||||||
|
"wacc"
|
||||||
|
],
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\b(true|false)\\b",
|
||||||
|
"name": "keyword.constant.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(int|bool|char|string|pair|null)\\b",
|
||||||
|
"name": "storage.type.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\".*?\"",
|
||||||
|
"name": "string.quoted.double.mylang"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(begin|end)\\b",
|
||||||
|
"name": "keyword.other.unit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(if|then|else|fi|while|do|done|skip)\\b",
|
||||||
|
"name": "keyword.control.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(read|free|print|println|newpair|call|fst|snd|ord|chr|len)\\b",
|
||||||
|
"name": "keyword.operator.function.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(return|exit)\\b",
|
||||||
|
"name": "keyword.operator.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "'[^']{1}'",
|
||||||
|
"name": "constant.character.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
|
||||||
|
"name": "variable.function.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
|
||||||
|
"name": "variable.other.wacc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "#.*$",
|
||||||
|
"name": "comment.line"
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
29
wacc-syntax/vsc-extension-quickstart.md
Normal file
29
wacc-syntax/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/wacc.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.
|
||||||
Reference in New Issue
Block a user