Compare commits
20 commits
Author | SHA1 | Date | |
---|---|---|---|
|
9d4a8b8246 | ||
|
a33019b088 | ||
|
cb7011ac46 | ||
|
8cbf55a627 | ||
|
04d662ee42 | ||
|
18199666d8 | ||
|
bb58baa09c | ||
|
fa7a4bd245 | ||
|
99f66d803a | ||
|
bc84098b77 | ||
|
d146f51e59 | ||
|
8ad44334d8 | ||
|
69a82a563e | ||
|
c3ade921d7 | ||
|
7c48aa6cad | ||
|
4b5bb991f7 | ||
|
9098604bf0 | ||
|
adaccda70b | ||
|
a95e98a650 | ||
|
ffc9763d42 |
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -6,9 +6,12 @@
|
|||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
node_modules/*
|
||||
|
||||
out/*
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
|
|
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}"
|
||||
],
|
||||
"sourceMaps": true,
|
||||
},
|
||||
]
|
||||
}
|
13
.vscodeignore
Normal file
13
.vscodeignore
Normal file
|
@ -0,0 +1,13 @@
|
|||
# ---> VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
11
README.md
11
README.md
|
@ -1,3 +1,14 @@
|
|||
# hblang-vscode
|
||||
|
||||
syntax highlighting for hblang in vscode
|
||||
|
||||
# Usage guide:
|
||||
|
||||
1. `cargo +nightly install hblang --git https://git.ablecorp.us/ableos/holey-bytes hbc --debug`
|
||||
> remember to keep this updated
|
||||
2.
|
||||
- add `$HOME/.cargo/bin` (or wherever you installed hblang) to `$PATH`
|
||||
> in bash, `export PATH=$PATH:$HOME/.cargo/bin`<br>
|
||||
> in other shells, there may be other ways
|
||||
- alternatively, add the path you installed hblang to the extension settings
|
||||
3. log out and log back in (or something, idk)
|
|
@ -1,31 +1,79 @@
|
|||
{
|
||||
"comments": {
|
||||
"lineComment": "//",
|
||||
"blockComment": ["/*", "*/"]
|
||||
"blockComment": [
|
||||
"/*",
|
||||
"*/"
|
||||
]
|
||||
},
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
||||
{ "open": "/*", "close": "*/", "notIn": ["string"] }
|
||||
{
|
||||
"open": "{",
|
||||
"close": "}"
|
||||
},
|
||||
{
|
||||
"open": "[",
|
||||
"close": "]"
|
||||
},
|
||||
{
|
||||
"open": "(",
|
||||
"close": ")"
|
||||
},
|
||||
{
|
||||
"open": "\"",
|
||||
"close": "\"",
|
||||
"notIn": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
{
|
||||
"open": "/*",
|
||||
"close": "*/",
|
||||
"notIn": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
],
|
||||
"surroundingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "\"", "close": "\"" }
|
||||
{
|
||||
"open": "{",
|
||||
"close": "}"
|
||||
},
|
||||
{
|
||||
"open": "[",
|
||||
"close": "]"
|
||||
},
|
||||
{
|
||||
"open": "(",
|
||||
"close": ")"
|
||||
},
|
||||
{
|
||||
"open": "\"",
|
||||
"close": "\""
|
||||
}
|
||||
],
|
||||
"folding": {
|
||||
"markers": {
|
||||
"start": "^\\s*//\\s*#region\\b",
|
||||
"end": "^\\s*//\\s*#endregion\\b"
|
||||
"start": "{\n",
|
||||
"end": "}"
|
||||
}
|
||||
},
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "{\\s+",
|
||||
"decreaseIndentPattern": "\\s+}\\$"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
2233
package-lock.json
generated
Normal file
2233
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
81
package.json
81
package.json
|
@ -1,27 +1,80 @@
|
|||
{
|
||||
"name": "hblang",
|
||||
"repository": {"url": "https://git.ablecorp.us/aurlex/hblang-vscode"},
|
||||
"publisher": "aurlex",
|
||||
"displayName": "hblang",
|
||||
"description": "Syntax highlighting for holey-bytes lang",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"vscode": "^1.91.0"
|
||||
"repository": {
|
||||
"url": "https://git.ablecorp.us/koniifer/hblang-vscode"
|
||||
},
|
||||
"publisher": "koniifer",
|
||||
"displayName": "hblang",
|
||||
"description": "Syntax, formatting, and linting for holey-bytes lang",
|
||||
"version": "0.2.8",
|
||||
"engines": {
|
||||
"vscode": "^1.75.0"
|
||||
},
|
||||
"main": "./out/main.js",
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
"Programming Languages",
|
||||
"Formatters",
|
||||
"Linters"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onCommand:extension.formatDocument"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"languages": [
|
||||
{
|
||||
"id": "hblang",
|
||||
"aliases": ["hblang", "hblang"],
|
||||
"extensions": [".hb"],
|
||||
"aliases": [
|
||||
"hblang"
|
||||
],
|
||||
"extensions": [
|
||||
".hb"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}],
|
||||
"grammars": [{
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "hblang",
|
||||
"scopeName": "source.hblang",
|
||||
"path": "./syntaxes/hblang.tmLanguage.json"
|
||||
}]
|
||||
}
|
||||
],
|
||||
"formatters": [
|
||||
{
|
||||
"language": "hblang",
|
||||
"provider": {
|
||||
"provideDocumentFormattingEdits": {
|
||||
"command": "editor.action.formatDocument"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"title": "hblang",
|
||||
"properties": {
|
||||
"hblang.compilerPath": {
|
||||
"type": "string",
|
||||
"default": "PATH",
|
||||
"description": "Set the optional path for the hbc compiler. If set to 'PATH', it will rely on the system to provide hbc.",
|
||||
"scope": "machine-overridable"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "webpack",
|
||||
"compile": "webpack --mode production",
|
||||
"watch": "webpack --watch --mode development"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/vscode": "^1.75.0",
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^4.0.0",
|
||||
"vscode": "^1.1.37",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack-cli": "^4.10.0"
|
||||
}
|
||||
}
|
158
src/main.ts
Normal file
158
src/main.ts
Normal file
|
@ -0,0 +1,158 @@
|
|||
import * as vscode from "vscode";
|
||||
import { execFile } from "child_process";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
const DEFAULT_EXECUTABLE = "hbc";
|
||||
let diagnosticCollection: vscode.DiagnosticCollection;
|
||||
|
||||
function getExecutablePath(): string {
|
||||
const config = vscode.workspace.getConfiguration("hblang");
|
||||
return config.get<string>("compilerPath") === "PATH"
|
||||
? DEFAULT_EXECUTABLE
|
||||
: config.get<string>("compilerPath")!;
|
||||
}
|
||||
|
||||
function isAbleosRepo(document: vscode.TextDocument): boolean {
|
||||
const workspaceFolder = vscode.workspace.getWorkspaceFolder(document.uri);
|
||||
if (!workspaceFolder) return false;
|
||||
return workspaceFolder.name.toLowerCase().includes("ableos");
|
||||
}
|
||||
|
||||
async function runCommand(
|
||||
filePath: string,
|
||||
args: string[],
|
||||
cwd: string,
|
||||
): Promise<string> {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
execFile(getExecutablePath(), args, { cwd }, (error, stdout, stderr) => {
|
||||
if (error && error.code === "ENOENT") {
|
||||
vscode.window.showErrorMessage(
|
||||
"hblang compiler not found. Ensure 'hbc' is installed and available in PATH."
|
||||
);
|
||||
return reject(new Error(`Compiler not found: ${stderr || stdout}`));
|
||||
}
|
||||
return error
|
||||
? reject(new Error(stderr || `Exit code: ${error.code}`))
|
||||
: resolve(stdout);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function provideDocumentFormattingEdits(
|
||||
document: vscode.TextDocument
|
||||
): Promise<vscode.TextEdit[]> {
|
||||
const tempFilePath = path.join(
|
||||
path.dirname(document.uri.fsPath),
|
||||
`temp_${path.basename(document.uri.fsPath)}`
|
||||
);
|
||||
|
||||
try {
|
||||
await document.save();
|
||||
|
||||
await fs.promises.writeFile(tempFilePath, document.getText());
|
||||
|
||||
const args = ["--fmt-stdout", tempFilePath];
|
||||
if (isAbleosRepo(document)) {
|
||||
args.push("--path-resolver", "ableos");
|
||||
}
|
||||
|
||||
const workspaceFolder = vscode.workspace.getWorkspaceFolder(document.uri);
|
||||
if (!workspaceFolder) {
|
||||
throw new Error("Workspace folder not found.");
|
||||
}
|
||||
|
||||
const stdout = await runCommand(tempFilePath, args, workspaceFolder.uri.fsPath);
|
||||
|
||||
const fullRange = new vscode.Range(
|
||||
document.positionAt(0),
|
||||
document.positionAt(document.getText().length)
|
||||
);
|
||||
return [vscode.TextEdit.replace(fullRange, stdout)];
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
vscode.window.showErrorMessage(`Formatting failed: ${error.message}`);
|
||||
} else {
|
||||
vscode.window.showErrorMessage(`Formatting failed: Unknown error`);
|
||||
}
|
||||
return [];
|
||||
} finally {
|
||||
fs.promises.unlink(tempFilePath).catch(console.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function lintDocument(document: vscode.TextDocument) {
|
||||
const args = [document.uri.fsPath];
|
||||
if (isAbleosRepo(document)) {
|
||||
args.push("--path-resolver", "ableos");
|
||||
}
|
||||
|
||||
try {
|
||||
const workspaceFolder = vscode.workspace.getWorkspaceFolder(document.uri);
|
||||
if (!workspaceFolder) { };
|
||||
const stderr = await runCommand(document.uri.fsPath, args, workspaceFolder?.uri.fsPath || document.uri.fsPath);
|
||||
diagnosticCollection.set(document.uri, parseLintingErrors(stderr));
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
diagnosticCollection.set(document.uri, parseLintingErrors(error.message));
|
||||
} else {
|
||||
vscode.window.showErrorMessage("Error linting hblang document.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseLintingErrors(stderr: string): vscode.Diagnostic[] {
|
||||
return stderr
|
||||
.split("\n")
|
||||
.filter((line) => line && !line.includes("missing main function"))
|
||||
.map((lineText) => {
|
||||
const match = lineText.match(/^([^:]+):(\d+):(\d+):\s*(.+)$/);
|
||||
if (!match) return null;
|
||||
|
||||
const [abc, , lineStr, columnStr, message] = match;
|
||||
const lineNum = parseInt(lineStr, 10) - 1;
|
||||
const columnNum = parseInt(columnStr, 10) - 1;
|
||||
|
||||
const severity = abc.startsWith("(W) ")
|
||||
? vscode.DiagnosticSeverity.Warning
|
||||
: vscode.DiagnosticSeverity.Error;
|
||||
|
||||
return new vscode.Diagnostic(
|
||||
new vscode.Range(
|
||||
lineNum,
|
||||
columnNum,
|
||||
lineNum,
|
||||
columnNum + message.length
|
||||
),
|
||||
message,
|
||||
severity
|
||||
);
|
||||
})
|
||||
.filter(Boolean) as vscode.Diagnostic[];
|
||||
}
|
||||
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
diagnosticCollection = vscode.languages.createDiagnosticCollection("hblang");
|
||||
context.subscriptions.push(diagnosticCollection);
|
||||
|
||||
vscode.workspace.onDidSaveTextDocument(async (document) => {
|
||||
if (document.languageId === "hblang") {
|
||||
await lintDocument(document);
|
||||
|
||||
if (diagnosticCollection.get(document.uri)?.length === 0) {
|
||||
vscode.commands.executeCommand(
|
||||
"editor.action.formatDocument",
|
||||
document
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vscode.languages.registerDocumentFormattingEditProvider("hblang", {
|
||||
provideDocumentFormattingEdits,
|
||||
});
|
||||
}
|
|
@ -1,44 +1,85 @@
|
|||
{
|
||||
"scopeName": "source.hblang",
|
||||
"name": "hblang",
|
||||
"fileTypes": ["hb"],
|
||||
"fileTypes": [
|
||||
"hb"
|
||||
],
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#declarations"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#macros"
|
||||
},
|
||||
{
|
||||
"include": "#structs"
|
||||
},
|
||||
{
|
||||
"include": "#arrays"
|
||||
},
|
||||
{
|
||||
"include": "#pointers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
"include": "#all"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comments": {
|
||||
"all": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"include": "#string"
|
||||
},
|
||||
{
|
||||
"include": "#struct"
|
||||
},
|
||||
{
|
||||
"include": "#keyword"
|
||||
},
|
||||
{
|
||||
"include": "#number"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#function"
|
||||
},
|
||||
{
|
||||
"include": "#operator"
|
||||
},
|
||||
{
|
||||
"include": "#variable"
|
||||
},
|
||||
{
|
||||
"include": "#type"
|
||||
},
|
||||
{
|
||||
"include": "#array"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameter": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "variable.parameter.hblang",
|
||||
"match": "\\b\\w+\\s*:\\s*(?:\\^)?[\\w\\$]+\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"number": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.numeric.float.hblang",
|
||||
"match": "\\b\\d+\\.\\d+\\b"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.hex.hblang",
|
||||
"match": "0x[0-9A-Fa-f]+"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.binary.hblang",
|
||||
"match": "0b[0-1]+"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.octal.hblang",
|
||||
"match": "0o[0-7]+"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.decimal.hblang",
|
||||
"match": "\\b\\d+\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "comment.block.hblang",
|
||||
|
@ -52,104 +93,147 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"strings": {
|
||||
"string": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.quoted.double.hblang",
|
||||
"begin": "\"",
|
||||
"end": "\""
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.hblang",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
},
|
||||
"keywords": {
|
||||
{
|
||||
"name": "string.quoted.single.hblang",
|
||||
"begin": "'",
|
||||
"end": "'",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.hblang",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"keyword": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.control.hblang",
|
||||
"match": "\\b(loop|break|if|else|return)\\b"
|
||||
"match": "(?<!\\w)\\b(fn|loop|break|if|else|return|packed|continue|true|false|struct|idk|die|null|defer|union|enum|match)\\b(?!\\w)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"type": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "storage.type.hblang",
|
||||
"match": "\\b(uint|int|void|u\\d+|i\\d+|f\\d+)\\b"
|
||||
"match": "(?<!\\w)\\b(f(32|64)|uint|int|u(8|16|32)|i(8|16|32)|void|bool|type|never)\\b(?!\\w)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"declarations": {
|
||||
"variable": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "variable.other.declaration.hblang",
|
||||
"match": "\\b[A-Z_][A-Z0-9_]*\\b"
|
||||
"name": "variable.declaration.hblang",
|
||||
"match": "\\b\\w+\\b(?=\\s*:=)"
|
||||
},
|
||||
{
|
||||
"name": "variable.other.assignment.hblang",
|
||||
"match": "\\b[a-z_][a-z0-9_]*\\b"
|
||||
"name": "variable.assignment.hblang",
|
||||
"match": "\\b\\w+\\b(?=\\s*=(?!=))"
|
||||
},
|
||||
{
|
||||
"name": "variable.member.hblang",
|
||||
"match": "(?<=\\.)\\w+\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operators": {
|
||||
"operator": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.operator.assignment.hblang",
|
||||
"match": ":="
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.assignment.hblang",
|
||||
"match": "=(?!=)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.hblang",
|
||||
"match": "\\b(\\^|\\*|&|<<|>>|>>>|<<=|>>=|>>>=|\\+|\\-|\\*|\\/|%|\\|\\||&&|!|==|!=|<|<=|>|>=|\\||&|\\^|~|<<|>>|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^=|~=|<<=|>>=|>>>|@\\w+)\\b"
|
||||
"match": "(\\$|\\?|@|<<=|>>=|>=|<=|\\^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"functions": {
|
||||
"struct": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "entity.name.function.hblang",
|
||||
"match": "\\b[a-z_][a-z0-9_]*\\b(?=\\()"
|
||||
"name": "entity.name.type.struct.hblang",
|
||||
"match": "\\b[A-Z]\\w*\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"macros": {
|
||||
"punctuation": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "entity.name.macro.hblang",
|
||||
"match": "@\\b[a-z_][a-z0-9_]*\\b"
|
||||
"name": "punctuation.terminator.statement.hblang",
|
||||
"match": ";|\\.|,|(?<!:):(?!=)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"structs": {
|
||||
"function": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "storage.type.struct.hblang",
|
||||
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\s*:=\\s*struct\\b"
|
||||
"name": "meta.function.declaration.hblang",
|
||||
"begin": "(\\b\\w+\\b)\\s*(:=)\\s*(fn)\\s*\\(",
|
||||
"end": "\\)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.hblang"
|
||||
},
|
||||
{
|
||||
"name": "storage.type.struct.hblang",
|
||||
"match": "\\b\\.[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
||||
"2": {
|
||||
"name": "keyword.operator.assignment.hblang"
|
||||
},
|
||||
"3": {
|
||||
"name": "keyword.control.hblang"
|
||||
}
|
||||
]
|
||||
},
|
||||
"arrays": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "storage.type.array.hblang",
|
||||
"match": "\\[\\b[a-zA-Z_][a-zA-Z0-9_]*\\b\\]"
|
||||
},
|
||||
{
|
||||
"name": "storage.type.array.hblang",
|
||||
"match": "\\[\\b[a-zA-Z_][a-zA-Z0-9_]*\\b;\\s*\\d+\\]"
|
||||
"include": "#all"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pointers": {
|
||||
{
|
||||
"name": "meta.function.call.hblang",
|
||||
"begin": "@?\\w+\\s*\\(",
|
||||
"end": "\\)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "entity.name.function.hblang"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"name": "storage.modifier.pointer.hblang",
|
||||
"match": "\\^+"
|
||||
"include": "#all"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"array": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.operator.dereference.hblang",
|
||||
"match": "\\*+"
|
||||
},
|
||||
"name": "meta.array.initialization.hblang",
|
||||
"begin": "\\.\\[",
|
||||
"end": "\\]",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.operator.reference.hblang",
|
||||
"match": "\\&+"
|
||||
"include": "#all"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
3
tests/dont-erase.hb
Normal file
3
tests/dont-erase.hb
Normal file
|
@ -0,0 +1,3 @@
|
|||
main := fn(): void {
|
||||
undefined_identifier
|
||||
}
|
15
tsconfig.json
Normal file
15
tsconfig.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
"module": "commonjs",
|
||||
"outDir": "./out",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
]
|
||||
}
|
33
webpack.config.js
Normal file
33
webpack.config.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/main.ts',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'out'),
|
||||
filename: 'main.js',
|
||||
libraryTarget: 'commonjs2'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js'],
|
||||
fallback: {
|
||||
"child_process": false,
|
||||
"fs": false,
|
||||
"os": require.resolve("os-browserify/browser"),
|
||||
"path": require.resolve("path-browserify"),
|
||||
},
|
||||
},
|
||||
externals: {
|
||||
vscode: 'commonjs vscode'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
target: 'node'
|
||||
};
|
Loading…
Reference in a new issue