mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2024-11-15 11:45:58 +00:00
Merge branch 'master' into sophiabranch
This commit is contained in:
commit
f5dfb2397b
79
src/commands.ts
Normal file
79
src/commands.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object} Command // Command to register with the VS Code Extension API
|
||||||
|
* @prop {string} command // Name of the command; e.g., 'mind-reader.selectTheme'
|
||||||
|
* @prop {callback} callback // Callback to register when `command` is invoked
|
||||||
|
*/
|
||||||
|
type Command = {
|
||||||
|
name: string,
|
||||||
|
callback: () => void
|
||||||
|
};
|
||||||
|
|
||||||
|
// The list of commands to register in the extension
|
||||||
|
const commands: Command[] = [
|
||||||
|
{
|
||||||
|
name: 'mind-reader.selectTheme',
|
||||||
|
|
||||||
|
// callbacks can be inlined...
|
||||||
|
callback: () => vscode.commands.executeCommand('workbench.action.selectTheme'),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'mind-reader.increaseFontScale',
|
||||||
|
callback: increaseFontScale, // ...or factored out into separate functions below
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'mind-reader.decreaseFontScale',
|
||||||
|
callback: decreaseFontScale,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'mind-reader.resetFontScale',
|
||||||
|
callback: resetFontScale,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'mind-reader.increaseEditorScale',
|
||||||
|
callback: increaseEditorScale,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'mind-reader.decreaseEditorScale',
|
||||||
|
callback: decreaseEditorScale,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'mind-reader.resetEditorScale',
|
||||||
|
callback: resetEditorScale,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// COMMAND CALLBACK IMPLEMENTATIONS
|
||||||
|
|
||||||
|
function increaseFontScale(): void {
|
||||||
|
vscode.commands.executeCommand('editor.action.fontZoomIn');
|
||||||
|
}
|
||||||
|
|
||||||
|
function decreaseFontScale(): void {
|
||||||
|
vscode.commands.executeCommand('editor.action.fontZoomOut');
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetFontScale(): void {
|
||||||
|
vscode.commands.executeCommand('editor.action.fontZoomReset');
|
||||||
|
}
|
||||||
|
|
||||||
|
function increaseEditorScale(): void {
|
||||||
|
vscode.commands.executeCommand('workbench.action.zoomIn');
|
||||||
|
}
|
||||||
|
|
||||||
|
function decreaseEditorScale(): void {
|
||||||
|
vscode.commands.executeCommand('workbench.action.zoomOut');
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetEditorScale(): void {
|
||||||
|
vscode.commands.executeCommand('workbench.action.zoomReset');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default commands;
|
@ -1,5 +1,7 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
import * as pl from './pylex';
|
import * as pl from './pylex';
|
||||||
|
import commands from './commands';
|
||||||
|
|
||||||
let parser: pl.Parser = new pl.Parser();
|
let parser: pl.Parser = new pl.Parser();
|
||||||
|
|
||||||
@ -9,54 +11,14 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
parser.parse('Beep Boop');
|
parser.parse('Beep Boop');
|
||||||
|
|
||||||
// Increase Font Scale
|
// Register Commands
|
||||||
context.subscriptions.push(
|
commands.forEach(command => {
|
||||||
vscode.commands.registerCommand('mind-reader.increaseFontScale', () => {
|
let disposable = vscode.commands.registerCommand(
|
||||||
vscode.commands.executeCommand('editor.action.fontZoomIn');
|
command.name,
|
||||||
})
|
command.callback
|
||||||
);
|
|
||||||
|
|
||||||
// Decrease Font Scale
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('mind-reader.decreaseFontScale', () => {
|
|
||||||
vscode.commands.executeCommand('editor.action.fontZoomOut');
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Reset Font Scale
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('mind-reader.resetFontScale', () => {
|
|
||||||
vscode.commands.executeCommand('editor.action.fontZoomReset');
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Increase Editor Scale
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('mind-reader.increaseEditorScale', () => {
|
|
||||||
vscode.commands.executeCommand('workbench.action.zoomIn');
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Decrease Editor Scale
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('mind-reader.decreaseEditorScale', () => {
|
|
||||||
vscode.commands.executeCommand('workbench.action.zoomOut');
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Reset Editor Scale
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('mind-reader.resetEditorScale', () => {
|
|
||||||
vscode.commands.executeCommand('workbench.action.zoomReset');
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Select Theme
|
|
||||||
context.subscriptions.push(
|
|
||||||
vscode.commands.registerCommand('mind-reader.selectTheme', () => {
|
|
||||||
vscode.commands.executeCommand('workbench.action.selectTheme');
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
context.subscriptions.push(disposable);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deactivate() {}
|
export function deactivate() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user