Initial working version for VS Code

This commit is contained in:
ex61wi
2026-03-06 19:07:00 +01:00
commit 954d7d5a62
22 changed files with 13711 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
node_modules/
out/
dist/
.DS_Store
+10
View File
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"connor4312.esbuild-problem-matchers",
"ms-vscode.extension-test-runner",
"sumneko.lua"
]
}
+22
View File
@@ -0,0 +1,22 @@
// A launch configuration that compiles the extension and then opens it 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": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/dutchies-dcs-scripting-tools"
],
"outFiles": [
"${workspaceFolder}/dutchies-dcs-scripting-tools/dist/**/*.js",
"${workspaceFolder}/compiler/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
+13
View File
@@ -0,0 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
+73
View File
@@ -0,0 +1,73 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"dependsOn": [
"npm: watch:tsc",
"npm: watch:esbuild"
],
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}/dutchies-dcs-scripting-tools"
}
},
{
"type": "npm",
"script": "watch:esbuild",
"group": "build",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"label": "npm: watch:esbuild",
"presentation": {
"group": "watch",
"reveal": "never"
},
"options": {
"cwd": "${workspaceFolder}/dutchies-dcs-scripting-tools"
}
},
{
"type": "npm",
"script": "watch:tsc",
"group": "build",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"label": "npm: watch:tsc",
"presentation": {
"group": "watch",
"reveal": "never"
},
"options": {
"cwd": "${workspaceFolder}/dutchies-dcs-scripting-tools"
}
},
{
"type": "npm",
"script": "watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "tasks: watch-tests",
"dependsOn": [
"npm: watch",
"npm: watch-tests"
],
"problemMatcher": []
}
]
}
+372
View File
@@ -0,0 +1,372 @@
import * as fs from 'fs';
import * as path from 'path';
export interface CompilationError {
filePath: string;
line: number;
message: string;
}
export interface ScriptCompilerOptions {
sourcePath: string,
outputPath: string,
outputFileName?: string,
minify: boolean,
onError?: (error: CompilationError) => void
}
const LUA_SCRIPT_GLOBAL_KEYWORD = 'ScriptGlobals';
export class ScriptCompiler {
constructor(private options: ScriptCompilerOptions) {
if (options.outputFileName === undefined) {
this.options.outputFileName = 'compiled.lua';
}
}
public async compile(): Promise<void> {
const entries = fs.readdirSync(this.options.sourcePath, { recursive: true, withFileTypes: true });
const parsedFiles: Map<string, ParsedFile> = new Map();
for (const entry of entries) {
if (entry.isFile() && entry.name.endsWith('.lua')) {
const fullPath = path.join(entry.parentPath ?? entry.path, entry.name);
const relativePath = path.relative(this.options.sourcePath, fullPath);
const content = fs.readFileSync(fullPath, 'utf-8');
const parsedFile = this.parseFile(relativePath, content, fullPath);
parsedFiles.set(parsedFile.fileKey, parsedFile);
}
}
const writer = new Writer(
path.join(this.options.outputPath, this.options.outputFileName!),
parsedFiles,
this.options.onError
);
writer.write();
console.log(`Compilation complete. Output written to ${path.join(this.options.outputPath, this.options.outputFileName!)}`);
}
private reportError(filePath: string, line: number, message: string): void {
if (this.options.onError) {
this.options.onError({ filePath, line, message });
}
}
private parseFile(filePath: string, content: string, fullPath: string): ParsedFile {
const dependencies: string[] = [];
const newLines: string[] = [`do --${filePath}`];
content = stripLuaMultilineComments(content);
const lines = content.split('\n').map(line => line.replace(/--.*$/, ''));
const blockStack : string[] = [];
let isInFunction = false;
let foundModuleLevelReturn = false;
let expectingDo = false;
const blockFound = (blockType: string): void => {
blockStack.push(blockType);
if (blockType === 'function') {
isInFunction = true;
}
};
const blockClosed = (): void => {
const closedBlock = blockStack.pop();
if (closedBlock === 'function') {
isInFunction = blockStack.includes('function');
}
};
for (let i = 0; i < lines.length; i++) {
let line = lines[i];
const trimmedLine = line.trim();
// Skip comments and blank lines
if (trimmedLine === '' || trimmedLine.startsWith('--')) {
continue;
}
// If we found module-level return, only allow 'end' statements after it
if (foundModuleLevelReturn) {
// Check for 'end' keyword
if (/\bend\b/.test(trimmedLine)) {
const endMatches = trimmedLine.match(/\bend\b/g);
if (endMatches) {
for (let j = 0; j < endMatches.length; j++) {
blockClosed();
}
}
newLines.push(line);
} else {
this.reportError(fullPath, i, `Code found after module-level return: ${trimmedLine}`);
newLines.push(line); // Continue processing despite error
}
continue;
}
// Handle require statements
const requireMatch = line.match(/require\(['"](.+?)['"]\)/);
if (requireMatch) {
const requiredModule = fileReferenceToLuaVariable(requireMatch[1]);
dependencies.push(requiredModule);
line = line.replace(requireMatch[0], requiredModule);
}
// Track block keywords AND returns - need to process in order they appear
const keywords = [
{ regex: /\bfunction\b/, type: 'function' },
{ regex: /\bif\b/, type: 'if' },
{ regex: /\bfor\b/, type: 'for' },
{ regex: /\bwhile\b/, type: 'while' },
{ regex: /\bdo\b/, type: 'do' },
{ regex: /\bend\b/, type: 'end' },
{ regex: /\breturn\b/, type: 'return' } // Add return to the list!
];
// Find positions of all keywords in the line
const foundKeywords: Array<{ position: number, type: string }> = [];
for (const kw of keywords) {
const matches = [...trimmedLine.matchAll(new RegExp(kw.regex, 'g'))];
for (const match of matches) {
if (match.index !== undefined) {
foundKeywords.push({ position: match.index, type: kw.type });
}
}
}
// Sort by position to process in order
foundKeywords.sort((a, b) => a.position - b.position);
// Process keywords in order
for (const kw of foundKeywords) {
if (kw.type === 'end') {
blockClosed();
expectingDo = false;
} else if (kw.type === 'for' || kw.type === 'while') {
blockFound(kw.type);
expectingDo = true;
} else if (kw.type === 'do') {
if (!expectingDo) {
// Standalone do block
blockFound('do');
}
expectingDo = false;
} else if (kw.type === 'return') {
// Handle return in sequence
if (!isInFunction && !foundModuleLevelReturn) {
// Extract the return value (everything after 'return')
const afterReturnPos = kw.position + 6; // 'return' is 6 chars
const afterReturn = trimmedLine.substring(afterReturnPos).trim();
if (afterReturn === '') {
this.reportError(fullPath, i, 'Empty return statement at module level');
continue;
}
// Check for multiple return values (commas outside of parentheses/braces/brackets)
let parenDepth = 0;
let braceDepth = 0;
let bracketDepth = 0;
let inString = false;
let stringChar = '';
let hasMultipleValues = false;
for (let j = 0; j < afterReturn.length; j++) {
const char = afterReturn[j];
if (!inString) {
if (char === '"' || char === "'") {
inString = true;
stringChar = char;
} else if (char === '(') {
parenDepth++;
} else if (char === ')') {
parenDepth--;
} else if (char === '{') {
braceDepth++;
} else if (char === '}') {
braceDepth--;
} else if (char === '[') {
bracketDepth++;
} else if (char === ']') {
bracketDepth--;
} else if (char === ',' && parenDepth === 0 && braceDepth === 0 && bracketDepth === 0) {
hasMultipleValues = true;
break;
}
} else {
if (char === stringChar && afterReturn[j - 1] !== '\\') {
inString = false;
}
}
}
if (hasMultipleValues) {
this.reportError(fullPath, i, `Multiple return values not supported: ${trimmedLine}`);
} else {
// Replace return with assignment
const moduleVariable = fileReferenceToLuaVariable(filePath);
const parts = moduleVariable.split('.');
for (let p = 1; p < parts.length; p++) {
const path = parts.slice(0, p + 1).join('.');
newLines.push(`if not ${path} then ${path} = {} end`);
}
line = line.replace(/\breturn\b/, moduleVariable + ' =');
foundModuleLevelReturn = true;
}
}
} else {
// function or if
blockFound(kw.type);
expectingDo = false;
}
}
newLines.push(line);
}
newLines.push(`end --${filePath}`);
return new ParsedFile(filePath, fullPath, newLines, dependencies);
}
}
function stripLuaMultilineComments(content: string): string {
// Matches --[[...]], --[=[...]=], --[==[...]==], etc.
return content.replace(/--\[(=*)\[[\s\S]*?\]\1\]/g, '');
}
class ParsedFile {
public readonly fileKey: string;
constructor(
public readonly filePath: string,
public readonly fullPath: string,
public readonly lines: string[],
public readonly dependencies: string[]
) {
this.fileKey = fileReferenceToLuaVariable(filePath);
}
}
function fileReferenceToLuaVariable(fileReference: string): string {
// Remove .lua extension
if (fileReference.endsWith('.lua')) {
fileReference = fileReference.substring(0, fileReference.length - 4);
}
// Remove leading ./
if (fileReference.startsWith('./')) {
fileReference = fileReference.substring(2);
}
// Normalize path separators
fileReference = fileReference.replace(/\\/g, '/').replace(/\./g, '/');
// Split by / to get path parts
const parts = fileReference.split('/');
// Convert to ScriptGlobals.folder.FileName format
let result = LUA_SCRIPT_GLOBAL_KEYWORD;
for (let i = 0; i < parts.length; i++) {
if (i === parts.length - 1) {
// Capitalize first letter of filename
result += '.' + parts[i].charAt(0).toUpperCase() + parts[i].slice(1);
} else {
// Folder names stay lowercase
result += '.' + parts[i];
}
}
return result;
}
class Writer {
constructor(
public location: string,
public files: Map<string, ParsedFile>,
public onError?: (error: CompilationError) => void
) {}
private getStartLines(): string[] {
return [`local ${LUA_SCRIPT_GLOBAL_KEYWORD} = {}`];
}
write(): void {
const writtenFiles: Set<string> = new Set();
const outputLines: string[] = [];
outputLines.push(...this.getStartLines());
const writeFileRecursive = (fileKey: string) => {
if (writtenFiles.has(fileKey)) {
return;
}
const file = this.files.get(fileKey);
if (!file) {
throw new Error(`File not found in compiler: ${fileKey}`);
}
// Write dependencies first
for (const dep of file.dependencies) {
writeFileRecursive(dep);
}
outputLines.push(...file.lines);
writtenFiles.add(fileKey);
};
//Check for circular dependencies before writing
const visited: Set<string> = new Set();
for (const fileKey of this.files.keys()) {
const stack: string[] = [];
const checkCircular = (key: string): boolean => {
if (stack.includes(key)) {
const cycleStart = stack.indexOf(key);
const cycle = [...stack.slice(cycleStart), key];
const file = this.files.get(stack[stack.length - 1]);
if (file && this.onError) {
this.onError({
filePath: file.fullPath,
line: 0,
message: `Circular dependency detected: ${cycle.map(x => x.split('.').pop()).join(' -> ')}`
});
}
return true;
}
if (visited.has(key)) {
return false;
}
visited.add(key);
stack.push(key);
const file = this.files.get(key);
if (file) {
for (const dep of file.dependencies) {
if (checkCircular(dep)) {
return true;
}
}
}
stack.pop();
return false;
};
if (checkCircular(fileKey)) {
throw new Error(`Compilation failed due to circular dependencies`);
}
}
// Write all files in dependency order
for (const fileKey of this.files.keys()) {
writeFileRecursive(fileKey);
}
fs.mkdirSync(path.dirname(this.location), { recursive: true });
fs.writeFileSync(this.location, outputLines.join('\n'), 'utf-8');
}
}
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';
export default defineConfig({
files: 'out/test/**/*.test.js',
});
@@ -0,0 +1,14 @@
.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.yarnrc
esbuild.js
vsc-extension-quickstart.md
**/tsconfig.json
**/eslint.config.mjs
**/*.map
**/*.ts
**/.vscode-test.*
@@ -0,0 +1,9 @@
# Change Log
All notable changes to the "dutchies-dcs-scripting-tools" 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
+19
View File
@@ -0,0 +1,19 @@
# dutchies-dcs-scripting-tools
My view on a toolset you'll need to write DCS mission scripts.
Direct DCS API checking and a Transpiler that can help keep huge complex scripts and frameworks simple and overseeable.
## Features
## Requirements
`sumenko.lua` : The VSCode Lua Language Server
## Release Notes
### 0.0.1
Initial.
Still very much in Test/Development
+59
View File
@@ -0,0 +1,59 @@
const esbuild = require("esbuild");
const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');
/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',
setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
};
async function main() {
const ctx = await esbuild.context({
entryPoints: [
'src/extension.ts'
],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'dist/extension.js',
external: ['vscode'],
alias: {
'dcs-script-compiler': '../compiler/src/ScriptCompiler.ts'
},
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}
main().catch(e => {
console.error(e);
process.exit(1);
});
@@ -0,0 +1,27 @@
import typescriptEslint from "typescript-eslint";
export default [{
files: ["**/*.ts"],
}, {
plugins: {
"@typescript-eslint": typescriptEslint.plugin,
},
languageOptions: {
parser: typescriptEslint.parser,
ecmaVersion: 2022,
sourceType: "module",
},
rules: {
"@typescript-eslint/naming-convention": ["warn", {
selector: "import",
format: ["camelCase", "PascalCase"],
}],
curly: "warn",
eqeqeq: "warn",
"no-throw-literal": "warn",
semi: "warn",
},
}];
@@ -0,0 +1,6 @@
{
"name": "Dutchie DCS Toolkit",
"words" : [],
"files" : [],
"settings": {}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
{
"name": "dutchies-dcs-scripting-tools",
"displayName": "Dutchies Dcs Scripting Tools",
"description": "Scripting tools to create DCS script and frameworks easier",
"version": "0.0.1",
"author": {
"name": "dutchie031",
"email": "54616262+dutchie031@users.noreply.github.com"
},
"publisher": "dutchie031",
"license": "MIT",
"engines": {
"vscode": "^1.108.1"
},
"repository": {
"type": "git",
"url": "https://github.com/dutchie031/DcsMissionScriptingTools"
},
"categories": [
"Other"
],
"activationEvents": [],
"main": "./dist/extension.js",
"contributes": {
"grammars": [
{
"path": "./syntaxes/lua-slocal.json",
"scopeName": "source.lua.slocal",
"injectTo": ["source.lua"]
}
],
"commands": [
{
"command": "dutchies-dcs-scripting-tools.enable",
"title": "Enable",
"category": "Dutchies DCS Tools"
},
{
"command": "dutchies-dcs-scripting-tools.disable",
"title": "Disable",
"category": "Dutchies DCS Tools"
},
{
"command": "dutchies-dcs-scripting-tools.compileLuaScripts",
"title": "Compile",
"category": "Dutchies DCS Tools"
}
]
},
"extensionDependencies": [
"sumneko.lua"
],
"files": [
"dist",
"README.md",
"lua-addons/**/*",
"syntaxes/**/*"
],
"dependencies": {
"dcs-script-compiler" : "*"
},
"scripts": {
"vscode:prepublish": "npm run build -w compiler && npm run package",
"compile": "npm run check-types && npm run lint && node esbuild.js",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"watch:compiler": "cd ../compiler && npm run watch",
"package": "npm run check-types && npm run lint && node esbuild.js --production",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"check-types": "tsc --noEmit",
"lint": "eslint src",
"test": "vscode-test"
},
"devDependencies": {
"@types/vscode": "^1.108.1",
"@types/mocha": "^10.0.10",
"@types/node": "22.x",
"typescript-eslint": "^8.52.0",
"eslint": "^9.39.2",
"esbuild": "^0.27.2",
"npm-run-all": "^4.1.5",
"typescript": "^5.9.3",
"@vscode/test-cli": "^0.0.12",
"@vscode/test-electron": "^2.5.2"
}
}
@@ -0,0 +1,119 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import { ScriptCompiler, ScriptCompilerOptions, CompilationError } from 'dcs-script-compiler';
const luaWorkSpaceSettingKey = "Lua.workspace";
const librarySettingsKey = "library";
const diagnosticCollection = vscode.languages.createDiagnosticCollection('lua-transpiler');
let pluginPath : string | undefined;
// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
pluginPath = context.asAbsolutePath('lua-addons');
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.enable', () => {
addPluginPathToSettings();
vscode.commands.executeCommand(
"lua.startServer"
);
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools enabled.');
});
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.disable', () => {
removePluginPathFromSettings();
vscode.commands.executeCommand(
"lua.startServer"
);
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools disabled.');
});
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.compileLuaScripts', async () => {
try{
const start = Date.now();
await compileLuaScripts();
const end = Date.now();
console.log(`Lua scripts compiled in ${(end - start) / 1000} seconds.`);
vscode.window.showInformationMessage(`Lua scripts compiled successfully in ${(end - start) / 1000} seconds.`);
}catch(err){
vscode.window.showErrorMessage('Error compiling Lua scripts: ' + (err as Error).message);
}
});
}
// This method is called when your extension is deactivated
export function deactivate()
{
removePluginPathFromSettings();
}
async function compileLuaScripts() {
const config = vscode.workspace.getConfiguration('dcsScriptingTools');
const sourcePath = config.get<string>('luaSourcePath') || '${workspaceFolder}/src';
const outputPath = config.get<string>('luaOutputPath') || '${workspaceFolder}/dist';
const minify = config.get<boolean>('minifyLuaScripts') || false;
const resolvedSourcePath = sourcePath.replace('${workspaceFolder}', vscode.workspace.workspaceFolders?.[0].uri.fsPath || '');
const resolvedOutputPath = outputPath.replace('${workspaceFolder}', vscode.workspace.workspaceFolders?.[0].uri.fsPath || '');
diagnosticCollection.clear();
const errorsByFile = new Map<string, CompilationError[]>();
const options: ScriptCompilerOptions = {
sourcePath: resolvedSourcePath,
outputPath: resolvedOutputPath,
minify: minify,
onError: (error: CompilationError) => {
const errors = errorsByFile.get(error.filePath) || [];
errors.push(error);
errorsByFile.set(error.filePath, errors);
}
};
const compiler = new ScriptCompiler(options);
try {
await compiler.compile();
} catch (err) {
vscode.window.showErrorMessage('Compilation failed: ' + (err as Error).message);
}
// Update diagnostics
diagnosticCollection.clear();
for (const [filePath, errors] of errorsByFile) {
const uri = vscode.Uri.file(filePath);
const diagnostics = errors.map(error => {
const range = new vscode.Range(error.line, 0, error.line, 0);
const diagnostic = new vscode.Diagnostic(range, error.message, vscode.DiagnosticSeverity.Error);
diagnostic.source = 'DCS Lua Transpiler';
return diagnostic;
});
diagnosticCollection.set(uri, diagnostics);
}
}
function addPluginPathToSettings() {
if (pluginPath) {
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
const librarySettings = luaSettings.get<string[]>(librarySettingsKey) || [];
if (!librarySettings.includes(pluginPath)) {
librarySettings.push(pluginPath);
luaSettings.update(librarySettingsKey, librarySettings, vscode.ConfigurationTarget.Workspace);
}
}
}
function removePluginPathFromSettings() {
if (pluginPath) {
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
const librarySettings = luaSettings.get<string[]>(librarySettingsKey) || [];
const libIndex = librarySettings.indexOf(pluginPath);
if (libIndex !== -1) {
librarySettings.splice(libIndex, 1);
luaSettings.update(librarySettingsKey, librarySettings, vscode.ConfigurationTarget.Workspace);
}
}
}
@@ -0,0 +1,15 @@
import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
// import * as myExtension from '../../extension';
suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');
test('Sample test', () => {
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
});
});
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "Node16",
"target": "ES2022",
"lib": [
"ES2022"
],
"sourceMap": true,
"strict": true, /* enable all strict type-checking options */
"paths": {
"dcs-script-compiler": ["../compiler/src/ScriptCompiler.ts"]
},
/* Additional Checks */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
}
}
@@ -0,0 +1,48 @@
# 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 extension and command.
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesnt yet need to load the plugin.
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
## Setup
* install the recommended extensions (amodio.tsl-problem-matcher, ms-vscode.extension-test-runner, and dbaeumer.vscode-eslint)
## Get up and running straight away
* Press `F5` to open a new window with your extension loaded.
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
* Find output from your extension in the debug console.
## Make changes
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Explore the API
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
## Run tests
* Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner)
* Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered.
* Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A`
* See the output of the test result in the Test Results view.
* Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder.
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
* You can create folders inside the `test` folder to structure your tests any way you want.
## Go further
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
+5726
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
{
"name": "dcs-mission-scripting-tools",
"private": true,
"workspaces": [
"compiler",
"dutchies-dcs-scripting-tools"
]
}