Masonbone (#13)

* added initial webpage

* Added webpage

* Update package.json

* Update package.json

* Updating stuff

* Update src/commands.ts

Co-authored-by: Jake Grossman <jake.r.grossman@gmail.com>

* updated extension.ts

* Added Key binding pages

* Read html from file

Co-authored-by: Jake Grossman <jake.r.grossman@gmail.com>
This commit is contained in:
MasonBone
2021-11-30 12:04:26 -06:00
committed by GitHub
parent 58f153b039
commit a67870ee5b
6 changed files with 195 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import * as vscode from 'vscode';
import * as pl from './pylex';
import * as fs from 'fs';
/**
* @type {Object} Command // Command to register with the VS Code Extension API
@@ -50,6 +51,20 @@ const commands: Command[] = [
callback: resetEditorScale,
},
{
name: 'mind-reader.openWebview',
callback: openWebview,
},
{
name: 'mind-reader.openKeyBindWin',
callback: () => openKeyBindWin('Windows')
},
{
name: 'mind-reader.openKeyBindMac',
callback: () => openKeyBindWin('Mac'),
},
//Navigation Keys......
{
name: 'mind-reader.showAllSymbols',
@@ -150,6 +165,38 @@ function resetEditorScale(): void {
vscode.commands.executeCommand('workbench.action.zoomReset');
}
function openWebview(): void {
//vscode.commands.executeCommand('workbench.action.zoomOut');
const panel = vscode.window.createWebviewPanel(
'mindReader', // Identifies the type of the webview. Used internally
'Mind Reader', // Title of the panel displayed to the user
vscode.ViewColumn.One, // Editor column to show the new webview panel in.
{}
); // Webview options. More on these later.
panel.webview.html = getWebviewContent('media/html/main.html');
}
function getWebviewContent(filepath: string) {
return fs.readFileSync(filepath, {encoding: 'utf-8'});
}
function openKeyBindWin(os: 'Mac' | 'Windows'): void {
//vscode.commands.executeCommand('workbench.action.zoomOut');
const panel = vscode.window.createWebviewPanel(
'mindReader', // Identifies the type of the webview. Used internally
'MR Key Bindings', // Title of the panel displayed to the user
vscode.ViewColumn.One, // Editor column to show the new webview panel in.
{}
); // Webview options. More on these later.
if (os === 'Windows') {
panel.webview.html = getWebviewContent('media/html/winkeys.html');
} else if (os === 'Mac') {
panel.webview.html = getWebviewContent('media/html/mackeys.html');
}
}
function getIndent(): void {
let editor = vscode.window.activeTextEditor;
if(editor)

View File

@@ -3,7 +3,7 @@ import * as vscode from 'vscode';
import * as pl from './pylex';
import commands from './commands';
import AccessNodeProvider from './accessNodeProvider'
import AccessNodeProvider from './accessNodeProvider';
let parser: pl.Parser = new pl.Parser();