This commit is contained in:
2023-06-08 21:16:38 -07:00
parent d1e8f544c7
commit 0c0b5262bf
20 changed files with 7927 additions and 8886 deletions

View File

@ -5,38 +5,26 @@ import * as replaceLinesHelper from './replaceLinesHelper';
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
import * as promiseLinesHelper from './promiseLinesHelper';
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
// 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) {
const openCommand = 'open-in-new-window.open';
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "type-script-helper" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
// let disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
// // The command has been defined in the package.json file
// // Now provide the implementation of the command with registerCommand
// // The commandId parameter must match the command field in package.json
// let disposable = vscode.commands.registerCommand('type-script-helper.helloWorld', () => {
// // The code you place here will be executed every time your command is executed
// // Display a message box to the user
// vscode.window.showInformationMessage('Hello World!');
// vscode.window.showInformationMessage('Hello World from type-script-helper!');
// });
// context.subscriptions.push(disposable);
const commands = [
vscode.commands.registerCommand(openCommand, (uri) => {
if (!uri) {
vscode.window.showWarningMessage('The intended usage is from the explorer context menu.');
return;
}
vscode.window.showInformationMessage(`Opening ${uri.path} in new window!`);
vscode.commands.executeCommand('vscode.openFolder', uri, true);
}),
vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
vscode.commands.registerCommand('readOnlyLinesHelper.searchGoogle', readOnlyLinesHelper.searchGoogle),
vscode.commands.registerCommand('replaceLinesHelper.addCSharpComment', replaceLinesHelper.addCSharpComment),
@ -65,5 +53,5 @@ export function activate(context: vscode.ExtensionContext) {
commands.forEach(command => context.subscriptions.push(command));
}
// this method is called when your extension is deactivated
// This method is called when your extension is deactivated
export function deactivate() { }

View File

@ -1,5 +1,4 @@
import * as vscode from 'vscode';
import { QuickPickItem } from "vscode";
function codeGeneratorQuickPickLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;

View File

@ -1,6 +1,6 @@
import * as path from 'path';
import { runTests } from 'vscode-test';
import { runTests } from '@vscode/test-electron';
async function main() {
try {
@ -15,7 +15,7 @@ async function main() {
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error('Failed to run tests');
console.error('Failed to run tests', err);
process.exit(1);
}
}

View File

@ -3,13 +3,13 @@ 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';
// import * as myExtension from '../../extension';
suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');
test('Sample test', () => {
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
});
});

View File

@ -6,8 +6,8 @@ export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
color: true
});
mocha.useColors(true);
const testsRoot = path.resolve(__dirname, '..');
@ -30,6 +30,7 @@ export function run(): Promise<void> {
}
});
} catch (err) {
console.error(err);
e(err);
}
});