-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* show the content of registers * update roadmap for register * make tslint happy
- Loading branch information
Showing
5 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use strict"; | ||
|
||
import * as vscode from "vscode"; | ||
import * as node from "../node"; | ||
import {ModeHandler} from "../../mode/modeHandler"; | ||
import { Register} from '../../register/register'; | ||
|
||
export interface IRegisterCommandArguments extends node.ICommandArgs { | ||
arg?: string; | ||
} | ||
|
||
export class RegisterCommand extends node.CommandBase { | ||
protected _arguments : IRegisterCommandArguments; | ||
|
||
constructor(args : IRegisterCommandArguments) { | ||
super(); | ||
this._name = 'register'; | ||
this._shortName = 'reg'; | ||
this._arguments = args; | ||
} | ||
|
||
get arguments() : IRegisterCommandArguments{ | ||
return this._arguments; | ||
} | ||
|
||
async displayRegisterValue(register: string): Promise<void> { | ||
let result = (await Register.getByKey(register)).text; | ||
if (result instanceof Array) { | ||
result = result.join("\n").substr(0, 100); | ||
} | ||
vscode.window.showInformationMessage(`${register} ${result}`); | ||
} | ||
|
||
async execute(modeHandler: ModeHandler): Promise<void> { | ||
if (this.arguments.arg !== undefined && this.arguments.arg.length > 0) { | ||
await this.displayRegisterValue(this.arguments.arg); | ||
} else { | ||
vscode.window.showQuickPick(Register.getKeys()).then(async (val) => { | ||
await this.displayRegisterValue(val); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict"; | ||
|
||
import * as node from "../commands/register"; | ||
import {Scanner} from '../scanner'; | ||
|
||
export function parseRegisterCommandArgs(args: string): node.RegisterCommand { | ||
if (!args) { | ||
return new node.RegisterCommand({}); | ||
} | ||
|
||
let scanner = new Scanner(args); | ||
let name = scanner.nextWord(); | ||
|
||
return new node.RegisterCommand({ | ||
arg: name | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters