Compare commits
No commits in common. "trunk" and "Release" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -6,12 +6,9 @@
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
!.vscode/*.code-snippets
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
node_modules/*
|
|
||||||
|
|
||||||
out/*
|
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
# Local History for Visual Studio Code
|
||||||
.history/
|
.history/
|
||||||
|
|
||||||
# Built Visual Studio Code Extensions
|
# Built Visual Studio Code Extensions
|
||||||
*.vsix
|
*.vsix
|
||||||
|
|
||||||
|
|
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.1.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Launch Extension",
|
|
||||||
"type": "extensionHost",
|
|
||||||
"request": "launch",
|
|
||||||
"runtimeExecutable": "${execPath}",
|
|
||||||
"args": [
|
|
||||||
"--extensionDevelopmentPath=${workspaceRoot}"
|
|
||||||
],
|
|
||||||
"sourceMaps": true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
# ---> 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,14 +1,3 @@
|
||||||
# hblang-vscode
|
# hblang-vscode
|
||||||
|
|
||||||
syntax highlighting for hblang in vscode
|
syntax highlighting for hblang in vscode
|
||||||
|
|
||||||
# Usage guide:
|
|
||||||
|
|
||||||
1. `cargo +nightly install hblang --git https://git.ablecorp.us/ableos/holey-bytes`
|
|
||||||
> 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,79 +1,31 @@
|
||||||
{
|
{
|
||||||
"comments": {
|
"comments": {
|
||||||
"lineComment": "//",
|
"lineComment": "//",
|
||||||
"blockComment": [
|
"blockComment": ["/*", "*/"]
|
||||||
"/*",
|
|
||||||
"*/"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"brackets": [
|
"brackets": [
|
||||||
[
|
["{", "}"],
|
||||||
"{",
|
["[", "]"],
|
||||||
"}"
|
["(", ")"]
|
||||||
],
|
|
||||||
[
|
|
||||||
"[",
|
|
||||||
"]"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"(",
|
|
||||||
")"
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
"autoClosingPairs": [
|
"autoClosingPairs": [
|
||||||
{
|
{ "open": "{", "close": "}" },
|
||||||
"open": "{",
|
{ "open": "[", "close": "]" },
|
||||||
"close": "}"
|
{ "open": "(", "close": ")" },
|
||||||
},
|
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
||||||
{
|
{ "open": "/*", "close": "*/", "notIn": ["string"] }
|
||||||
"open": "[",
|
|
||||||
"close": "]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"open": "(",
|
|
||||||
"close": ")"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"open": "\"",
|
|
||||||
"close": "\"",
|
|
||||||
"notIn": [
|
|
||||||
"string"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"open": "/*",
|
|
||||||
"close": "*/",
|
|
||||||
"notIn": [
|
|
||||||
"string"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"surroundingPairs": [
|
"surroundingPairs": [
|
||||||
{
|
{ "open": "{", "close": "}" },
|
||||||
"open": "{",
|
{ "open": "[", "close": "]" },
|
||||||
"close": "}"
|
{ "open": "(", "close": ")" },
|
||||||
},
|
{ "open": "\"", "close": "\"" }
|
||||||
{
|
|
||||||
"open": "[",
|
|
||||||
"close": "]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"open": "(",
|
|
||||||
"close": ")"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"open": "\"",
|
|
||||||
"close": "\""
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"folding": {
|
"folding": {
|
||||||
"markers": {
|
"markers": {
|
||||||
"start": "{\n",
|
"start": "^\\s*//\\s*#region\\b",
|
||||||
"end": "}"
|
"end": "^\\s*//\\s*#endregion\\b"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"indentationRules": {
|
}
|
||||||
"increaseIndentPattern": "{",
|
|
||||||
"decreaseIndentPattern": "}"
|
|
||||||
},
|
|
||||||
}
|
|
2221
package-lock.json
generated
2221
package-lock.json
generated
File diff suppressed because it is too large
Load diff
76
package.json
76
package.json
|
@ -1,79 +1,27 @@
|
||||||
{
|
{
|
||||||
"name": "hblang",
|
"name": "hblang",
|
||||||
"repository": {
|
"repository": {"url": "https://git.ablecorp.us/aurlex/hblang-vscode"},
|
||||||
"url": "https://git.ablecorp.us/koniifer/hblang-vscode"
|
"publisher": "aurlex",
|
||||||
},
|
|
||||||
"publisher": "koniifer",
|
|
||||||
"displayName": "hblang",
|
"displayName": "hblang",
|
||||||
"description": "Syntax highlighter and formatter for holey-bytes lang",
|
"description": "Syntax highlighting for holey-bytes lang",
|
||||||
"version": "0.2.2",
|
"version": "0.0.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.75.0"
|
"vscode": "^1.91.0"
|
||||||
},
|
},
|
||||||
"main": "./out/main.js",
|
|
||||||
"categories": [
|
"categories": [
|
||||||
"Programming Languages",
|
"Programming Languages"
|
||||||
"Formatters"
|
|
||||||
],
|
|
||||||
"activationEvents": [
|
|
||||||
"onCommand:extension.formatDocument"
|
|
||||||
],
|
],
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"languages": [
|
"languages": [{
|
||||||
{
|
|
||||||
"id": "hblang",
|
"id": "hblang",
|
||||||
"aliases": [
|
"aliases": ["hblang", "hblang"],
|
||||||
"hblang"
|
"extensions": [".hb"],
|
||||||
],
|
|
||||||
"extensions": [
|
|
||||||
".hb"
|
|
||||||
],
|
|
||||||
"configuration": "./language-configuration.json"
|
"configuration": "./language-configuration.json"
|
||||||
}
|
}],
|
||||||
],
|
"grammars": [{
|
||||||
"grammars": [
|
|
||||||
{
|
|
||||||
"language": "hblang",
|
"language": "hblang",
|
||||||
"scopeName": "source.hblang",
|
"scopeName": "source.hblang",
|
||||||
"path": "./syntaxes/hblang.tmLanguage.json"
|
"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.0.0",
|
|
||||||
"webpack-cli": "^4.10.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
120
src/main.ts
120
src/main.ts
|
@ -1,120 +0,0 @@
|
||||||
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")!;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function runCommand(filePath: string, args: string[]): Promise<string> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
execFile(getExecutablePath(), args, (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)}`
|
|
||||||
);
|
|
||||||
await fs.promises.writeFile(tempFilePath, document.getText());
|
|
||||||
|
|
||||||
try {
|
|
||||||
const stdout = await runCommand(tempFilePath, [
|
|
||||||
"--fmt-stdout",
|
|
||||||
tempFilePath,
|
|
||||||
]);
|
|
||||||
const fullRange = new vscode.Range(
|
|
||||||
document.positionAt(0),
|
|
||||||
document.positionAt(document.getText().length)
|
|
||||||
);
|
|
||||||
|
|
||||||
diagnosticCollection.delete(document.uri);
|
|
||||||
|
|
||||||
return [vscode.TextEdit.replace(fullRange, stdout)];
|
|
||||||
} catch (error) {
|
|
||||||
return [];
|
|
||||||
} finally {
|
|
||||||
fs.promises.unlink(tempFilePath).catch(console.error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function lintDocument(document: vscode.TextDocument) {
|
|
||||||
try {
|
|
||||||
const stderr = await runCommand(document.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 [, , lineStr, columnStr, message] = match;
|
|
||||||
const lineNum = parseInt(lineStr, 10) - 1;
|
|
||||||
const columnNum = parseInt(columnStr, 10) - 1;
|
|
||||||
|
|
||||||
return new vscode.Diagnostic(
|
|
||||||
new vscode.Range(
|
|
||||||
lineNum,
|
|
||||||
columnNum,
|
|
||||||
lineNum,
|
|
||||||
columnNum + message.length
|
|
||||||
),
|
|
||||||
message,
|
|
||||||
vscode.DiagnosticSeverity.Error
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.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,73 +1,44 @@
|
||||||
{
|
{
|
||||||
"scopeName": "source.hblang",
|
"scopeName": "source.hblang",
|
||||||
"name": "hblang",
|
"name": "hblang",
|
||||||
"fileTypes": [
|
"fileTypes": ["hb"],
|
||||||
"hb"
|
|
||||||
],
|
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"include": "#all"
|
"include": "#comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#keywords"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#types"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#declarations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#functions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#macros"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#structs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#arrays"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#pointers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#operators"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"all": {
|
"comments": {
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"include": "#comment"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#struct"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#keyword"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#function"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#number"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#type"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#variable"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#operator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#punctuation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": "#array"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"parameter": {
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"name": "variable.parameter.hblang",
|
|
||||||
"match": "\\b\\w+\\b"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"number": {
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"name": "constant.numeric.hblang",
|
|
||||||
"match": "\\b\\d+(\\.\\d+)?\\b"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "constant.numeric.hex.hblang",
|
|
||||||
"match": "0x[0-9A-Fa-f]+"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"comment": {
|
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "comment.block.hblang",
|
"name": "comment.block.hblang",
|
||||||
|
@ -81,141 +52,106 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"string": {
|
"strings": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "string.quoted.double.hblang",
|
"name": "string.quoted.double.hblang",
|
||||||
"begin": "\"",
|
"begin": "\"",
|
||||||
"end": "\"",
|
"end": "\""
|
||||||
"beginCaptures": {
|
|
||||||
"0": {
|
|
||||||
"name": "punctuation.definition.string.begin.hblang"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endCaptures": {
|
|
||||||
"0": {
|
|
||||||
"name": "punctuation.definition.string.end.hblang"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"name": "constant.character.escape.hblang",
|
|
||||||
"match": "\\\\[\"'\\\\bfnrt]|\\\\(\\{[^}]+\\}|\\[[^]]+\\]|[a-zA-Z])"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "invalid.illegal.escaped.hblang",
|
|
||||||
"match": "\\\\."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"keyword": {
|
"keywords": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "keyword.control.hblang",
|
"name": "keyword.control.hblang",
|
||||||
"match": "\\b(loop|break|if|else|return|packed|continue|true|false|struct|idk)\\b"
|
"match": "\\b(loop|break|if|else|return)\\b"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"type": {
|
"types": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "storage.type.hblang",
|
"name": "storage.type.hblang",
|
||||||
"match": "\\b(uint|int|(u|i)(8|16|32)|void|bool|type|never|([A-Z]\\w+))\\b"
|
"match": "\\b(uint|int|void|u\\d+|i\\d+|f\\d+)\\b"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"variable": {
|
"declarations": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "variable.parameter.hblang",
|
"name": "variable.other.declaration.hblang",
|
||||||
"match": "\\b\\w+\\s*:=\\b"
|
"match": "\\b[A-Z_][A-Z0-9_]*\\b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "variable.parameter.hblang",
|
"name": "variable.other.assignment.hblang",
|
||||||
"match": "\\b\\w+\\s*=\\b"
|
"match": "\\b[a-z_][a-z0-9_]*\\b"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "variable.parameter.hblang",
|
|
||||||
"match": "(?<=\\w+\\.)(\\w+)\\b"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"operator": {
|
"operators": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "keyword.operator.hblang",
|
"name": "keyword.operator.hblang",
|
||||||
"match": "(@|:=|<<=|>>=|>=|<=|^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|&&|\\|\\||<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>|=)"
|
"match": "\\b(\\^|\\*|&|<<|>>|>>>|<<=|>>=|>>>=|\\+|\\-|\\*|\\/|%|\\|\\||&&|!|==|!=|<|<=|>|>=|\\||&|\\^|~|<<|>>|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^=|~=|<<=|>>=|>>>|@\\w+)\\b"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"struct": {
|
"functions": {
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"name": "entity.name.type.struct.hblang",
|
|
||||||
"match": "\\b[A-Z]\\w+\\b"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"punctuation": {
|
|
||||||
"patterns": [
|
|
||||||
{
|
|
||||||
"name": "punctuation.terminator.statement.hblang",
|
|
||||||
"match": ";|\\.|,|:"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"function": {
|
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "entity.name.function.hblang",
|
"name": "entity.name.function.hblang",
|
||||||
"begin": "(?<!\\w)fn\\s*\\(",
|
"match": "\\b[a-z_][a-z0-9_]*\\b(?=\\()"
|
||||||
"end": "\\)",
|
|
||||||
"captures": {
|
|
||||||
"0": {
|
|
||||||
"name": "keyword.hblang"
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
"macros": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"include": "#all"
|
"name": "entity.name.macro.hblang",
|
||||||
},
|
"match": "@\\b[a-z_][a-z0-9_]*\\b"
|
||||||
{
|
|
||||||
"name": "variable.parameter.hblang",
|
|
||||||
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
"structs": {
|
||||||
"name": "entity.name.function.hblang",
|
|
||||||
"begin": "(?:@)?\\b\\w+\\s*\\(",
|
|
||||||
"end": "\\)",
|
|
||||||
"captures": {
|
|
||||||
"0": {
|
|
||||||
"name": "entity.name.function.hblang"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"include": "#all"
|
"name": "storage.type.struct.hblang",
|
||||||
|
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\s*:=\\s*struct\\b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "variable.parameter.hblang",
|
"name": "storage.type.struct.hblang",
|
||||||
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
|
"match": "\\b\\.[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"array": {
|
"arrays": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "storage.type.array.hblang",
|
"name": "storage.type.array.hblang",
|
||||||
"begin": "\\.\\(",
|
"match": "\\[\\b[a-zA-Z_][a-zA-Z0-9_]*\\b\\]"
|
||||||
"end": "\\)"
|
},
|
||||||
|
{
|
||||||
|
"name": "storage.type.array.hblang",
|
||||||
|
"match": "\\[\\b[a-zA-Z_][a-zA-Z0-9_]*\\b;\\s*\\d+\\]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pointers": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "storage.modifier.pointer.hblang",
|
||||||
|
"match": "\\^+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.dereference.hblang",
|
||||||
|
"match": "\\*+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.reference.hblang",
|
||||||
|
"match": "\\&+"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
main := fn(): void {
|
|
||||||
undefined_identifier
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES6",
|
|
||||||
"module": "commonjs",
|
|
||||||
"outDir": "./out",
|
|
||||||
"rootDir": "./src",
|
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src/**/*.ts"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
mode: 'production',
|
|
||||||
entry: './src/main.ts',
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, 'out'),
|
|
||||||
filename: 'main.js',
|
|
||||||
libraryTarget: 'commonjs2' // This is correct for VS Code extensions
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.ts', '.js'],
|
|
||||||
fallback: {
|
|
||||||
// For Node.js core modules not available in browser context, you set them to false
|
|
||||||
"child_process": false, // Not used in browser context
|
|
||||||
"fs": false, // Not used in browser context
|
|
||||||
"os": require.resolve("os-browserify/browser"), // Polyfill for os
|
|
||||||
"path": require.resolve("path-browserify"), // Polyfill for path
|
|
||||||
},
|
|
||||||
},
|
|
||||||
externals: {
|
|
||||||
vscode: 'commonjs vscode' // Externalize the vscode module
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.ts$/,
|
|
||||||
use: 'ts-loader',
|
|
||||||
exclude: /node_modules/
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
target: 'node' // Specify the target environment as Node.js
|
|
||||||
};
|
|
Loading…
Reference in a new issue