Update access.ts

Added highlight feature with toggle
This commit is contained in:
Pedro Alvarez 2022-04-12 13:42:06 -05:00 committed by GitHub
parent 30248966bf
commit b49e861346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,8 @@
import * as vscode from 'vscode';
import { CommandEntry } from './commandEntry';
import { ConfigurationTarget, workspace} from 'vscode';
var highlightToggle = 0;
var color = "#14afc0";
// Accessibility Commands
export const accessCommands: CommandEntry[] = [
@ -39,6 +42,10 @@ export const accessCommands: CommandEntry[] = [
name: 'mind-reader.resetEditorScale',
callback: resetEditorScale,
},
{
name: 'mind-reader.highlightCurrentLine',
callback: highlightCurrentLine,
},
];
@ -66,3 +73,19 @@ function resetEditorScale(): void {
vscode.commands.executeCommand('workbench.action.zoomReset');
}
async function highlightCurrentLine(){
const config = vscode.workspace.getConfiguration('workbench');
const config2 = config.get('colorCustomizations');
switch (highlightToggle) {
case 0:
config2["editor.lineHighlightBackground"] = color;
await config.update('colorCustomizations', config2, ConfigurationTarget.Global, true);
highlightToggle = 1;
break;
case 1:
config2["editor.lineHighlightBackground"] = null;
await config.update('colorCustomizations', config2, ConfigurationTarget.Global, true);
highlightToggle = 0;
break;
}
}