VSCode extension used by Talon Voice
VSCode extension used by my personal Talon scripts.
Available in the vscode marketplace as Andreas Talon
Note
If you find this extension helpful, consider sponsoring!
Commands
Many of the commands take arguments and return values that can only be used with the Command server
File commands
andreas.getFilename(): string
Get filename of active file.
andreas.copyFilename()
Copy filename of active file to clipboard.
andreas.newFile(name?: string)
Create new file. Uses selected text and current file extension as suggestion.
andreas.duplicateFile(name?: string)
Create duplicate/copy of active file.
andreas.renameFile(name?: string)
Rename active file.
andreas.removeFile()
Remove/delete the active file.
andreas.moveFile()
Move active file to new directory.
andreas.formatWorkspaceFiles()
Format workspace files.
andreas.searchFiles(query?: string)
Search files in workspace.
andreas.searchFilesOpenSelected()
Open selected files in search result.
andreas.searchFilesDeleteSelected()
Delete selected files in search result.
andreas.searchFilesToggleSelected()
Toggle selected files in search result.
Edit commands
andreas.generateRange(start: number = 1)
Generate numerical range. Starts from 1 by default
andreas.increment(value?: number)
Increment selected number.
andreas.decrement(value?: number)
Decrement selected number.
Navigation commands
andreas.openEditorAtIndex(index: number)
Open editor/tab at given index. Negative indices are counted from the back.
andreas.focusTab(hint: string)
Focus tab by hint. Hints range [A-ZZ].
andreas.goToLine(line: number)
Go to line number. 0-based index.
andreas.selectTo(line: number)
Select from current location to specified line.
andreas.lineMiddle()
Move cursor to middle of the current line.
Text commands
andreas.getDocumentText(): string | null
Get document text.
andreas.getSelectedText(): string[] | null
Get selected text.
andreas.getDictationContext(): {before: string, after: string} | null
Get text before and after selection. Used for context sensitive dictation.
andreas.getClassName(): string | null
Get class name. Useful for inserting constructors in C++/Java.
andreas.getOpenTagName(): string | null
Get name for open tag. Useful to close tag in HTML/XML.
Git commands
andreas.gitGetFirstAvailableBranch(branches: string[]): string | undefined
Get first available branch.
andreas.gitCheckout(...branches: string[])
Checkout git branch. Uses first branch that exists.
andreas.getGitFileURL({ useSelection?: boolean, useBranch?: boolean }): string
Get URL to Git repository file webpage. Optionally include selected line numbers.
andreas.getGitRepoURL(): string
Get URL to Git repository webpage.
andreas.getGitIssuesURL(): string
Get URL to Git repository issues webpage.
andreas.getGitNewIssueURL(): string
Get URL to Git repository new issue webpage.
andreas.getGitPullRequestsURL(): string
Get URL to Git repository pull requests webpage.
Other commands
andreas.getSetting(section: string, defaultValue?: T): T | undefined
Get setting from vscode
andreas.setSetting(section: string, value: any, configurationTarget?: "global" | "workspace" | "workspaceFolder")
Set setting for vscode, either globally or for the current workspace/folder
andreas.executeCommands(commands: string[])
Sequentially execute multiple commands. Useful for keybindings.
andreas.getWorkspaceFolders(): string[]
Get an array of file system paths for workspace folders
andreas.printCommands()
Print available commands.
The formatting options are described in @cursorless/talon-tools
Talon language features
- Adds document formatter for Talon files.
- Adds (go to) definitions for Talon actions, lists (incl dynamic) and captures.
- Adds hover for Talon actions, lists (incl dynamic) and captures.
- Adds code completion for Talon actions, lists and captures.
"[talon]": {
"editor.formatOnSave": false
},
"[talon-list]": {
"editor.formatOnSave": false
}
Quick fix code actions
- Convert line and block comments to JS/Java doc comments
Tree-sitter Query (.scm) language features
- Adds document formatter for scm files.
Snippet (.snippet) language features
- Adds syntax highlight for snippet files.
- Adds document formatter for snippet files.
- Adds code completion for fields in snippet files.
Talon command examples
Focus tabs view
bar tabs: user.run_rpc_command("andreas.tabs.focus")
Focus tab
tab {user.letter} [{user.letter}]:
user.run_rpc_command("andreas.focusTab", "{letter_1}{letter_2 or ''}")
Generate range
generate range [from <number_small>]:
user.run_rpc_command("andreas.generateRange", number_small or 1)
Search files queries:
apps finds files such as src/apps.ts.
apps/ finds files directly inside an apps directory, such as apps/my app.ts and src/apps/my-app.js.
apps/* finds files in apps and nested subdirectories, such as src/apps/sub/myApp.ts.
my app treats whitespace as a wildcard within a path segment, so it matches my app, my-app, and myApp.
my app does not match my/app, because whitespace is not treated as a directory wildcard.
Images
Code completion

On hover

Go to definition

Quick fix

Tab view

Search files results
Demo
YouTube - On hover and go to definition
YouTube - Tab view
YouTube - Format selected files
Build
$ npm install -g vsce
$ vsce package
Dependencies
Resources