diff --git a/.gitignore b/.gitignore index c4aaa65..fa12d8d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ node_modules *.vsix *.todo *.vs +*.code-workspace scripts/generateJsonSchema.js \ No newline at end of file diff --git a/README.md b/README.md index cc3aa98..ce5bbd8 100644 --- a/README.md +++ b/README.md @@ -558,7 +558,29 @@ Example for a 2x2 grid: }, ``` -### `commands.runInTerminal` Create new terminal and send text +### `commands.focusTerminal` Focus specific terminal + +```js +"Focus newest non-task terminal": { + "command": "commands.focusTerminal", +}, +"Focus terminal named 'foobar' (string argument)": { + "command": "commands.focusTerminal", + "args": "foobar" +}, +"Focus terminal named 'foobar'": { + "command": "commands.focusTerminal", + "args": { + "target": "newest",// focus newest matching terminal; create new if no match + "name": "foobar",// if no match, assign a name to the new terminal + "icon": "zap",// if no match, assign a Codicon to the new terminal + "iconColor": "terminal.ansiCyan",// if no match, assign a color (from current theme) to the new terminal + // "cwd": "", + }, +}, +``` + +### `commands.runInTerminal` Send text to new (or specified) terminal ```js "Terminal => watch (string argument)": { @@ -572,6 +594,9 @@ Example for a 2x2 grid: "name": "watch", "reveal": true, "waitForExit": false,// will wait for terminal to exit before running next command + "reuse": "newest",// reuse newest same-named terminal; create new if no match + "icon": "zap",// if no match, assign a Codicon to the new terminal + "iconColor": "terminal.ansiCyan",// if no match, assign a color (from current theme) to the new terminal // "cwd": "", }, }, diff --git a/data/codiconNames.schema.json b/data/codiconNames.schema.json new file mode 100644 index 0000000..dcf7e0e --- /dev/null +++ b/data/codiconNames.schema.json @@ -0,0 +1,1053 @@ +{ + "$ref": "#/definitions/codiconName", + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "codiconName": { + "type": "string", + "enum": [ + "account", + "activate-breakpoints", + "add", + "alert", + "archive", + "array", + "arrow-both", + "arrow-circle-down", + "arrow-circle-left", + "arrow-circle-right", + "arrow-circle-up", + "arrow-down", + "arrow-left", + "arrow-right", + "arrow-small-down", + "arrow-small-left", + "arrow-small-right", + "arrow-small-up", + "arrow-swap", + "arrow-up", + "azure-devops", + "azure", + "beaker-stop", + "beaker", + "bell-dot", + "bell-slash-dot", + "bell-slash", + "bell", + "blank", + "bold", + "book", + "bookmark", + "bracket-dot", + "bracket-error", + "bracket", + "briefcase", + "broadcast", + "browser", + "bug", + "calendar", + "call-incoming", + "call-outgoing", + "case-sensitive", + "check-all", + "check", + "checklist", + "chevron-down", + "chevron-left", + "chevron-right", + "chevron-up", + "chrome-close", + "chrome-maximize", + "chrome-minimize", + "chrome-restore", + "circle-filled", + "circle-large-filled", + "circle-large-outline", + "circle-large", + "circle-outline", + "circle-slash", + "circle-small-filled", + "circle-small", + "circle", + "circuit-board", + "clear-all", + "clippy", + "clock", + "clone", + "close-all", + "close-dirty", + "close", + "cloud-download", + "cloud-upload", + "cloud", + "code", + "collapse-all", + "color-mode", + "combine", + "comment-add", + "comment-discussion", + "comment-draft", + "comment-unresolved", + "comment", + "compare-changes", + "compass-active", + "compass-dot", + "compass", + "console", + "copy", + "credit-card", + "dash", + "dashboard", + "database", + "debug-all", + "debug-alt-small", + "debug-alt", + "debug-breakpoint-conditional-disabled", + "debug-breakpoint-conditional-unverified", + "debug-breakpoint-conditional", + "debug-breakpoint-data-disabled", + "debug-breakpoint-data-unverified", + "debug-breakpoint-data", + "debug-breakpoint-disabled", + "debug-breakpoint-function-disabled", + "debug-breakpoint-function-unverified", + "debug-breakpoint-function", + "debug-breakpoint-log-disabled", + "debug-breakpoint-log-unverified", + "debug-breakpoint-log", + "debug-breakpoint-unsupported", + "debug-breakpoint-unverified", + "debug-breakpoint", + "debug-console", + "debug-continue-small", + "debug-continue", + "debug-coverage", + "debug-disconnect", + "debug-hint", + "debug-line-by-line", + "debug-pause", + "debug-rerun", + "debug-restart-frame", + "debug-restart", + "debug-reverse-continue", + "debug-stackframe-active", + "debug-stackframe-dot", + "debug-stackframe-focused", + "debug-stackframe", + "debug-start", + "debug-step-back", + "debug-step-into", + "debug-step-out", + "debug-step-over", + "debug-stop", + "debug", + "desktop-download", + "device-camera-video", + "device-camera", + "device-desktop", + "device-mobile", + "diff-added", + "diff-ignored", + "diff-modified", + "diff-removed", + "diff-renamed", + "diff", + "discard", + "edit", + "editor-layout", + "ellipsis", + "empty-window", + "error-small", + "error", + "exclude", + "expand-all", + "export", + "extensions", + "eye-closed", + "eye-unwatch", + "eye-watch", + "eye", + "feedback", + "file-add", + "file-binary", + "file-code", + "file-directory-create", + "file-directory", + "file-media", + "file-pdf", + "file-submodule", + "file-symlink-directory", + "file-symlink-file", + "file-text", + "file-zip", + "file", + "files", + "filter-filled", + "filter", + "flame", + "fold-down", + "fold-up", + "fold", + "folder-active", + "folder-library", + "folder-opened", + "folder", + "gather", + "gear", + "gift", + "gist-fork", + "gist-new", + "gist-private", + "gist-secret", + "gist", + "git-branch-create", + "git-branch-delete", + "git-branch", + "git-commit", + "git-compare", + "git-fork-private", + "git-merge", + "git-pull-request-abandoned", + "git-pull-request-closed", + "git-pull-request-create", + "git-pull-request-draft", + "git-pull-request-go-to-changes", + "git-pull-request-new-changes", + "git-pull-request", + "github-action", + "github-alt", + "github-inverted", + "github", + "globe", + "go-to-file", + "grabber", + "graph-left", + "graph-line", + "graph-scatter", + "graph", + "gripper", + "group-by-ref-type", + "heart-filled", + "heart", + "history", + "home", + "horizontal-rule", + "hubot", + "inbox", + "indent", + "info", + "inspect", + "issue-closed", + "issue-draft", + "issue-opened", + "issue-reopened", + "issues", + "italic", + "jersey", + "json", + "kebab-horizontal", + "kebab-vertical", + "key", + "keyboard", + "law", + "layers-active", + "layers-dot", + "layers", + "layout-activitybar-left", + "layout-activitybar-right", + "layout-centered", + "layout-menubar", + "layout-panel-center", + "layout-panel-justify", + "layout-panel-left", + "layout-panel-off", + "layout-panel-right", + "layout-panel", + "layout-sidebar-left-off", + "layout-sidebar-left", + "layout-sidebar-right-off", + "layout-sidebar-right", + "layout-statusbar", + "layout", + "library", + "light-bulb", + "lightbulb-autofix", + "lightbulb", + "link-external", + "link", + "list-filter", + "list-flat", + "list-ordered", + "list-selection", + "list-tree", + "list-unordered", + "live-share", + "loading", + "location", + "lock-small", + "lock", + "log-in", + "log-out", + "logo-github", + "magnet", + "mail-read", + "mail-reply", + "mail", + "map-filled", + "map", + "mark-github", + "markdown", + "megaphone", + "mention", + "menu", + "merge", + "microscope", + "milestone", + "mirror-private", + "mirror-public", + "mirror", + "more", + "mortar-board", + "move", + "multiple-windows", + "mute", + "new-file", + "new-folder", + "newline", + "no-newline", + "note", + "notebook-template", + "notebook", + "octoface", + "open-preview", + "organization-filled", + "organization-outline", + "organization", + "output", + "package", + "paintcan", + "pass-filled", + "pass", + "pencil", + "person-add", + "person-filled", + "person-follow", + "person-outline", + "person", + "pie-chart", + "pin", + "pinned-dirty", + "pinned", + "play-circle", + "play", + "plug", + "plus", + "preserve-case", + "preview", + "primitive-dot", + "primitive-square", + "project", + "pulse", + "question", + "quote", + "radio-tower", + "reactions", + "record-keys", + "record-small", + "record", + "redo", + "references", + "refresh", + "regex", + "remote-explorer", + "remote", + "remove-close", + "remove", + "repl", + "replace-all", + "replace", + "reply", + "repo-clone", + "repo-create", + "repo-delete", + "repo-force-push", + "repo-forked", + "repo-pull", + "repo-push", + "repo-sync", + "repo", + "report", + "request-changes", + "rocket", + "root-folder-opened", + "root-folder", + "rss", + "ruby", + "run-above", + "run-all", + "run-below", + "run-errors", + "run", + "save-all", + "save-as", + "save", + "screen-full", + "screen-normal", + "search-fuzzy", + "search-save", + "search-stop", + "search", + "selection", + "server-environment", + "server-process", + "server", + "settings-gear", + "settings", + "shield", + "sign-in", + "sign-out", + "smiley", + "sort-precedence", + "source-control", + "split-horizontal", + "split-vertical", + "squirrel", + "star-add", + "star-delete", + "star-empty", + "star-full", + "star-half", + "star", + "stop-circle", + "stop", + "symbol-array", + "symbol-boolean", + "symbol-class", + "symbol-color", + "symbol-constant", + "symbol-constructor", + "symbol-enum-member", + "symbol-enum", + "symbol-event", + "symbol-field", + "symbol-file", + "symbol-folder", + "symbol-function", + "symbol-interface", + "symbol-key", + "symbol-keyword", + "symbol-method", + "symbol-misc", + "symbol-module", + "symbol-namespace", + "symbol-null", + "symbol-number", + "symbol-numeric", + "symbol-object", + "symbol-operator", + "symbol-package", + "symbol-parameter", + "symbol-property", + "symbol-reference", + "symbol-ruler", + "symbol-snippet", + "symbol-string", + "symbol-struct", + "symbol-structure", + "symbol-text", + "symbol-type-parameter", + "symbol-unit", + "symbol-value", + "symbol-variable", + "sync-ignored", + "sync", + "table", + "tag-add", + "tag-remove", + "tag", + "target", + "tasklist", + "telescope", + "terminal-bash", + "terminal-cmd", + "terminal-debian", + "terminal-decoration-error", + "terminal-decoration-incomplete", + "terminal-decoration-mark", + "terminal-decoration-success", + "terminal-linux", + "terminal-powershell", + "terminal-tmux", + "terminal-ubuntu", + "terminal", + "text-size", + "three-bars", + "thumbsdown", + "thumbsup", + "tools", + "trash", + "trashcan", + "triangle-down", + "triangle-left", + "triangle-right", + "triangle-up", + "twitter", + "type-hierarchy-sub", + "type-hierarchy-super", + "type-hierarchy", + "unfold", + "ungroup-by-ref-type", + "unlock", + "unmute", + "unverified", + "variable-group", + "variable", + "verified-filled", + "verified", + "versions", + "vm-active", + "vm-connect", + "vm-outline", + "vm-running", + "vm", + "wand", + "warning", + "watch", + "whitespace", + "whole-word", + "window", + "word-wrap", + "workspace-trusted", + "workspace-unknown", + "workspace-untrusted", + "wrench-subaction", + "wrench", + "x", + "zap", + "zoom-in", + "zoom-out" + ], + "markdownEnumDescriptions": [ + "$(account)", + "$(activate-breakpoints)", + "$(add)", + "$(alert)", + "$(archive)", + "$(array)", + "$(arrow-both)", + "$(arrow-circle-down)", + "$(arrow-circle-left)", + "$(arrow-circle-right)", + "$(arrow-circle-up)", + "$(arrow-down)", + "$(arrow-left)", + "$(arrow-right)", + "$(arrow-small-down)", + "$(arrow-small-left)", + "$(arrow-small-right)", + "$(arrow-small-up)", + "$(arrow-swap)", + "$(arrow-up)", + "$(azure-devops)", + "$(azure)", + "$(beaker-stop)", + "$(beaker)", + "$(bell-dot)", + "$(bell-slash-dot)", + "$(bell-slash)", + "$(bell)", + "$(blank)", + "$(bold)", + "$(book)", + "$(bookmark)", + "$(bracket-dot)", + "$(bracket-error)", + "$(bracket)", + "$(briefcase)", + "$(broadcast)", + "$(browser)", + "$(bug)", + "$(calendar)", + "$(call-incoming)", + "$(call-outgoing)", + "$(case-sensitive)", + "$(check-all)", + "$(check)", + "$(checklist)", + "$(chevron-down)", + "$(chevron-left)", + "$(chevron-right)", + "$(chevron-up)", + "$(chrome-close)", + "$(chrome-maximize)", + "$(chrome-minimize)", + "$(chrome-restore)", + "$(circle-filled)", + "$(circle-large-filled)", + "$(circle-large-outline)", + "$(circle-large)", + "$(circle-outline)", + "$(circle-slash)", + "$(circle-small-filled)", + "$(circle-small)", + "$(circle)", + "$(circuit-board)", + "$(clear-all)", + "$(clippy)", + "$(clock)", + "$(clone)", + "$(close-all)", + "$(close-dirty)", + "$(close)", + "$(cloud-download)", + "$(cloud-upload)", + "$(cloud)", + "$(code)", + "$(collapse-all)", + "$(color-mode)", + "$(combine)", + "$(comment-add)", + "$(comment-discussion)", + "$(comment-draft)", + "$(comment-unresolved)", + "$(comment)", + "$(compare-changes)", + "$(compass-active)", + "$(compass-dot)", + "$(compass)", + "$(console)", + "$(copy)", + "$(credit-card)", + "$(dash)", + "$(dashboard)", + "$(database)", + "$(debug-all)", + "$(debug-alt-small)", + "$(debug-alt)", + "$(debug-breakpoint-conditional-disabled)", + "$(debug-breakpoint-conditional-unverified)", + "$(debug-breakpoint-conditional)", + "$(debug-breakpoint-data-disabled)", + "$(debug-breakpoint-data-unverified)", + "$(debug-breakpoint-data)", + "$(debug-breakpoint-disabled)", + "$(debug-breakpoint-function-disabled)", + "$(debug-breakpoint-function-unverified)", + "$(debug-breakpoint-function)", + "$(debug-breakpoint-log-disabled)", + "$(debug-breakpoint-log-unverified)", + "$(debug-breakpoint-log)", + "$(debug-breakpoint-unsupported)", + "$(debug-breakpoint-unverified)", + "$(debug-breakpoint)", + "$(debug-console)", + "$(debug-continue-small)", + "$(debug-continue)", + "$(debug-coverage)", + "$(debug-disconnect)", + "$(debug-hint)", + "$(debug-line-by-line)", + "$(debug-pause)", + "$(debug-rerun)", + "$(debug-restart-frame)", + "$(debug-restart)", + "$(debug-reverse-continue)", + "$(debug-stackframe-active)", + "$(debug-stackframe-dot)", + "$(debug-stackframe-focused)", + "$(debug-stackframe)", + "$(debug-start)", + "$(debug-step-back)", + "$(debug-step-into)", + "$(debug-step-out)", + "$(debug-step-over)", + "$(debug-stop)", + "$(debug)", + "$(desktop-download)", + "$(device-camera-video)", + "$(device-camera)", + "$(device-desktop)", + "$(device-mobile)", + "$(diff-added)", + "$(diff-ignored)", + "$(diff-modified)", + "$(diff-removed)", + "$(diff-renamed)", + "$(diff)", + "$(discard)", + "$(edit)", + "$(editor-layout)", + "$(ellipsis)", + "$(empty-window)", + "$(error-small)", + "$(error)", + "$(exclude)", + "$(expand-all)", + "$(export)", + "$(extensions)", + "$(eye-closed)", + "$(eye-unwatch)", + "$(eye-watch)", + "$(eye)", + "$(feedback)", + "$(file-add)", + "$(file-binary)", + "$(file-code)", + "$(file-directory-create)", + "$(file-directory)", + "$(file-media)", + "$(file-pdf)", + "$(file-submodule)", + "$(file-symlink-directory)", + "$(file-symlink-file)", + "$(file-text)", + "$(file-zip)", + "$(file)", + "$(files)", + "$(filter-filled)", + "$(filter)", + "$(flame)", + "$(fold-down)", + "$(fold-up)", + "$(fold)", + "$(folder-active)", + "$(folder-library)", + "$(folder-opened)", + "$(folder)", + "$(gather)", + "$(gear)", + "$(gift)", + "$(gist-fork)", + "$(gist-new)", + "$(gist-private)", + "$(gist-secret)", + "$(gist)", + "$(git-branch-create)", + "$(git-branch-delete)", + "$(git-branch)", + "$(git-commit)", + "$(git-compare)", + "$(git-fork-private)", + "$(git-merge)", + "$(git-pull-request-abandoned)", + "$(git-pull-request-closed)", + "$(git-pull-request-create)", + "$(git-pull-request-draft)", + "$(git-pull-request-go-to-changes)", + "$(git-pull-request-new-changes)", + "$(git-pull-request)", + "$(github-action)", + "$(github-alt)", + "$(github-inverted)", + "$(github)", + "$(globe)", + "$(go-to-file)", + "$(grabber)", + "$(graph-left)", + "$(graph-line)", + "$(graph-scatter)", + "$(graph)", + "$(gripper)", + "$(group-by-ref-type)", + "$(heart-filled)", + "$(heart)", + "$(history)", + "$(home)", + "$(horizontal-rule)", + "$(hubot)", + "$(inbox)", + "$(indent)", + "$(info)", + "$(inspect)", + "$(issue-closed)", + "$(issue-draft)", + "$(issue-opened)", + "$(issue-reopened)", + "$(issues)", + "$(italic)", + "$(jersey)", + "$(json)", + "$(kebab-horizontal)", + "$(kebab-vertical)", + "$(key)", + "$(keyboard)", + "$(law)", + "$(layers-active)", + "$(layers-dot)", + "$(layers)", + "$(layout-activitybar-left)", + "$(layout-activitybar-right)", + "$(layout-centered)", + "$(layout-menubar)", + "$(layout-panel-center)", + "$(layout-panel-justify)", + "$(layout-panel-left)", + "$(layout-panel-off)", + "$(layout-panel-right)", + "$(layout-panel)", + "$(layout-sidebar-left-off)", + "$(layout-sidebar-left)", + "$(layout-sidebar-right-off)", + "$(layout-sidebar-right)", + "$(layout-statusbar)", + "$(layout)", + "$(library)", + "$(light-bulb)", + "$(lightbulb-autofix)", + "$(lightbulb)", + "$(link-external)", + "$(link)", + "$(list-filter)", + "$(list-flat)", + "$(list-ordered)", + "$(list-selection)", + "$(list-tree)", + "$(list-unordered)", + "$(live-share)", + "$(loading)", + "$(location)", + "$(lock-small)", + "$(lock)", + "$(log-in)", + "$(log-out)", + "$(logo-github)", + "$(magnet)", + "$(mail-read)", + "$(mail-reply)", + "$(mail)", + "$(map-filled)", + "$(map)", + "$(mark-github)", + "$(markdown)", + "$(megaphone)", + "$(mention)", + "$(menu)", + "$(merge)", + "$(microscope)", + "$(milestone)", + "$(mirror-private)", + "$(mirror-public)", + "$(mirror)", + "$(more)", + "$(mortar-board)", + "$(move)", + "$(multiple-windows)", + "$(mute)", + "$(new-file)", + "$(new-folder)", + "$(newline)", + "$(no-newline)", + "$(note)", + "$(notebook-template)", + "$(notebook)", + "$(octoface)", + "$(open-preview)", + "$(organization-filled)", + "$(organization-outline)", + "$(organization)", + "$(output)", + "$(package)", + "$(paintcan)", + "$(pass-filled)", + "$(pass)", + "$(pencil)", + "$(person-add)", + "$(person-filled)", + "$(person-follow)", + "$(person-outline)", + "$(person)", + "$(pie-chart)", + "$(pin)", + "$(pinned-dirty)", + "$(pinned)", + "$(play-circle)", + "$(play)", + "$(plug)", + "$(plus)", + "$(preserve-case)", + "$(preview)", + "$(primitive-dot)", + "$(primitive-square)", + "$(project)", + "$(pulse)", + "$(question)", + "$(quote)", + "$(radio-tower)", + "$(reactions)", + "$(record-keys)", + "$(record-small)", + "$(record)", + "$(redo)", + "$(references)", + "$(refresh)", + "$(regex)", + "$(remote-explorer)", + "$(remote)", + "$(remove-close)", + "$(remove)", + "$(repl)", + "$(replace-all)", + "$(replace)", + "$(reply)", + "$(repo-clone)", + "$(repo-create)", + "$(repo-delete)", + "$(repo-force-push)", + "$(repo-forked)", + "$(repo-pull)", + "$(repo-push)", + "$(repo-sync)", + "$(repo)", + "$(report)", + "$(request-changes)", + "$(rocket)", + "$(root-folder-opened)", + "$(root-folder)", + "$(rss)", + "$(ruby)", + "$(run-above)", + "$(run-all)", + "$(run-below)", + "$(run-errors)", + "$(run)", + "$(save-all)", + "$(save-as)", + "$(save)", + "$(screen-full)", + "$(screen-normal)", + "$(search-fuzzy)", + "$(search-save)", + "$(search-stop)", + "$(search)", + "$(selection)", + "$(server-environment)", + "$(server-process)", + "$(server)", + "$(settings-gear)", + "$(settings)", + "$(shield)", + "$(sign-in)", + "$(sign-out)", + "$(smiley)", + "$(sort-precedence)", + "$(source-control)", + "$(split-horizontal)", + "$(split-vertical)", + "$(squirrel)", + "$(star-add)", + "$(star-delete)", + "$(star-empty)", + "$(star-full)", + "$(star-half)", + "$(star)", + "$(stop-circle)", + "$(stop)", + "$(symbol-array)", + "$(symbol-boolean)", + "$(symbol-class)", + "$(symbol-color)", + "$(symbol-constant)", + "$(symbol-constructor)", + "$(symbol-enum-member)", + "$(symbol-enum)", + "$(symbol-event)", + "$(symbol-field)", + "$(symbol-file)", + "$(symbol-folder)", + "$(symbol-function)", + "$(symbol-interface)", + "$(symbol-key)", + "$(symbol-keyword)", + "$(symbol-method)", + "$(symbol-misc)", + "$(symbol-module)", + "$(symbol-namespace)", + "$(symbol-null)", + "$(symbol-number)", + "$(symbol-numeric)", + "$(symbol-object)", + "$(symbol-operator)", + "$(symbol-package)", + "$(symbol-parameter)", + "$(symbol-property)", + "$(symbol-reference)", + "$(symbol-ruler)", + "$(symbol-snippet)", + "$(symbol-string)", + "$(symbol-struct)", + "$(symbol-structure)", + "$(symbol-text)", + "$(symbol-type-parameter)", + "$(symbol-unit)", + "$(symbol-value)", + "$(symbol-variable)", + "$(sync-ignored)", + "$(sync)", + "$(table)", + "$(tag-add)", + "$(tag-remove)", + "$(tag)", + "$(target)", + "$(tasklist)", + "$(telescope)", + "$(terminal-bash)", + "$(terminal-cmd)", + "$(terminal-debian)", + "$(terminal-decoration-error)", + "$(terminal-decoration-incomplete)", + "$(terminal-decoration-mark)", + "$(terminal-decoration-success)", + "$(terminal-linux)", + "$(terminal-powershell)", + "$(terminal-tmux)", + "$(terminal-ubuntu)", + "$(terminal)", + "$(text-size)", + "$(three-bars)", + "$(thumbsdown)", + "$(thumbsup)", + "$(tools)", + "$(trash)", + "$(trashcan)", + "$(triangle-down)", + "$(triangle-left)", + "$(triangle-right)", + "$(triangle-up)", + "$(twitter)", + "$(type-hierarchy-sub)", + "$(type-hierarchy-super)", + "$(type-hierarchy)", + "$(unfold)", + "$(ungroup-by-ref-type)", + "$(unlock)", + "$(unmute)", + "$(unverified)", + "$(variable-group)", + "$(variable)", + "$(verified-filled)", + "$(verified)", + "$(versions)", + "$(vm-active)", + "$(vm-connect)", + "$(vm-outline)", + "$(vm-running)", + "$(vm)", + "$(wand)", + "$(warning)", + "$(watch)", + "$(whitespace)", + "$(whole-word)", + "$(window)", + "$(word-wrap)", + "$(workspace-trusted)", + "$(workspace-unknown)", + "$(workspace-untrusted)", + "$(wrench-subaction)", + "$(wrench)", + "$(x)", + "$(zap)", + "$(zoom-in)", + "$(zoom-out)" + ] + } + } +} diff --git a/data/commands.schema.json b/data/commands.schema.json index 584a53a..c6a7a9f 100644 --- a/data/commands.schema.json +++ b/data/commands.schema.json @@ -9,6 +9,7 @@ { "$ref": "#/$defs/incrementSettingCommand" }, { "$ref": "#/$defs/toggleThemeCommand" }, { "$ref": "#/$defs/openFolderCommand" }, + { "$ref": "#/$defs/focusTerminalCommand" }, { "$ref": "#/$defs/runInTerminalCommand" }, { "$ref": "#/$defs/startDebuggingCommand" }, { "$ref": "#/$defs/setEditorLanguageCommand" }, @@ -736,6 +737,65 @@ } }, + "focusTerminalCommand": { + "if": { + "properties": { + "command": { + "const": "commands.focusTerminal" + } + } + }, + "then": { + "properties": { + "args": { + "oneOf": [ + { + "type": "string", + "markdownDescription": "A name to match against. \n_If omitted, focuses newest non-task terminal._ \n_If no match, creates new terminal with given name._" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "markdownDescription": "A name to match against (or to assign if creating a new terminal)." + }, + "icon": { + "$ref": "./codiconNames.schema.json", + "markdownDescription": "A codicon ID to assign to the icon (if creating a new terminal)." + }, + "iconColor": { + "$ref": "./themeColors.schema.json", + "markdownDescription": "A theme color ID to assign to the icon (if creating a new terminal)." + }, + "cwd": { + "type": "string", + "markdownDescription": "Specify the current working directory (if creating a new terminal)." + }, + "target": { + "type": "string", + "enum": [ + "newest", + "oldest", + "create new" + ], + "default": "newest", + "markdownEnumDescriptions": [ + "Will focus newest terminal with same \"name\". \n_If \"name\" property omitted, focuses newest non-task terminal._", + "Will focus oldest terminal with same \"name\". \n_If \"name\" property omitted, focuses oldest non-task terminal._", + "Will create a new terminal." + ], + "markdownDescription": "Specify which terminal to focus. \n_Creates new if no match._" + } + }, + "additionalProperties": false + } + ] + } + } + } + }, + "runInTerminalCommand": { "if": { "properties": { @@ -749,25 +809,51 @@ "args": { "oneOf": [ { - "type": "string" + "type": "string", + "markdownDescription": "Text to be sent to a new terminal." }, { "type": "object", "properties": { "text": { - "type": "string" + "type": "string", + "markdownDescription": "Text to be sent to the terminal." }, "name": { - "type": "string" + "type": "string", + "markdownDescription": "A name to assign to the terminal. \n_Used as a match criteria if property \"reuse\" also specified._" + }, + "icon": { + "$ref": "./codiconNames.schema.json", + "markdownDescription": "A codicon ID to assign to the icon (if creating a new terminal)." + }, + "iconColor": { + "$ref": "./themeColors.schema.json", + "markdownDescription": "A theme color ID to assign to the icon (if creating a new terminal)." }, "cwd": { - "type": "string" + "type": "string", + "markdownDescription": "Specify the current working directory (if creating a new terminal)." }, "reveal": { - "type": "boolean" + "type": "boolean", + "markdownDescription": "Whether to reveal & focus the terminal." }, "waitForExit": { - "type": "boolean" + "type": "boolean", + "markdownDescription": "Will wait for the terminal to exit before running next command." + }, + "reuse": { + "type": "string", + "enum": [ + "newest", + "oldest" + ], + "markdownEnumDescriptions": [ + "Will reuse newest terminal with same \"name\". \n_If \"name\" property omitted, reuses newest non-task terminal._", + "Will reuse oldest terminal with same \"name\". \n_If \"name\" property omitted, reuses oldest non-task terminal._" + ], + "markdownDescription": "Run \"text\" within an existing terminal. \n_Will create new if omitted or no match._" } }, "additionalProperties": false diff --git a/data/settings.schema.json b/data/settings.schema.json index 24f46c2..239ac97 100644 --- a/data/settings.schema.json +++ b/data/settings.schema.json @@ -110,7 +110,8 @@ }, "iconColor": { "type": "string", - "markdownDescription": "Use existing colors for icon [Color id list](https://code.visualstudio.com/api/references/theme-color)" + "markdownDescription": "Use existing colors for icon [Color id list](https://code.visualstudio.com/api/references/theme-color)", + "$ref": "themeColors.schema.json#/definitions/themeColors" }, "statusBar": { "$ref": "#/$defs/statusBar" diff --git a/data/themeColors.schema.json b/data/themeColors.schema.json new file mode 100644 index 0000000..22b19b4 --- /dev/null +++ b/data/themeColors.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/themeColors", + "definitions": { + "themeColors": { + "type": "string", + "anyOf": [ + { + "type": "string" + }, + { + "enum": ["activityBar.activeBorder","activityBar.background","activityBar.border","activityBar.foreground","activityBar.inactiveForeground","activityBarBadge.background","activityBarBadge.foreground","badge.background","badge.foreground","button.background","button.border","button.foreground","button.hoverBackground","button.secondaryBackground","button.secondaryForeground","button.secondaryHoverBackground","checkbox.background","checkbox.border","descriptionForeground","diffEditor.insertedLineBackground","diffEditor.insertedTextBackground","diffEditor.removedLineBackground","diffEditor.removedTextBackground","dropdown.background","dropdown.border","dropdown.foreground","dropdown.listBackground","editor.background","editor.findMatchBackground","editor.foreground","editor.inactiveSelectionBackground","editor.selectionHighlightBackground","editorGroup.border","editorGroupHeader.tabsBackground","editorGroupHeader.tabsBorder","editorGutter.addedBackground","editorGutter.deletedBackground","editorGutter.modifiedBackground","editorIndentGuide.activeBackground","editorIndentGuide.background","editorInlayHint.background","editorInlayHint.foreground","editorInlayHint.typeBackground","editorInlayHint.typeForeground","editorLineNumber.activeForeground","editorLineNumber.foreground","editorOverviewRuler.border","editorSuggestWidget.background","editorWidget.background","errorForeground","focusBorder","foreground","icon.foreground","input.background","input.border","input.foreground","input.placeholderForeground","inputOption.activeBackground","inputOption.activeBorder","inputOption.activeForeground","keybindingLabel.foreground","list.activeSelectionBackground","list.activeSelectionForeground","list.activeSelectionIconForeground","list.focusAndSelectionOutline","list.hoverBackground","menu.border","notebook.cellBorderColor","notebook.selectedCellBackground","notificationCenterHeader.background","notificationCenterHeader.foreground","notifications.background","notifications.border","notifications.foreground","panel.background","panel.border","panelInput.border","panelTitle.activeBorder","panelTitle.activeForeground","panelTitle.inactiveForeground","peekViewEditor.matchHighlightBackground","peekViewResult.background","peekViewResult.matchHighlightBackground","pickerGroup.border","pickerGroup.foreground","ports.iconRunningProcessForeground","progressBar.background","quickInput.background","quickInput.foreground","scrollbar.shadow","scrollbarSlider.activeBackground","scrollbarSlider.background","scrollbarSlider.hoverBackground","searchEditor.textInputBorder","settings.dropdownBackground","settings.dropdownBorder","settings.headerForeground","settings.modifiedItemIndicator","settings.numberInputBorder","settings.textInputBorder","sideBar.background","sideBar.border","sideBar.foreground","sideBarSectionHeader.background","sideBarSectionHeader.border","sideBarSectionHeader.foreground","sideBarTitle.foreground","statusBar.background","statusBar.border","statusBar.debuggingBackground","statusBar.debuggingForeground","statusBar.focusBorder","statusBar.foreground","statusBar.noFolderBackground","statusBarItem.errorBackground","statusBarItem.focusBorder","statusBarItem.prominentBackground","statusBarItem.remoteBackground","statusBarItem.remoteForeground","tab.activeBackground","tab.activeBorder","tab.activeBorderTop","tab.activeForeground","tab.border","tab.hoverBackground","tab.inactiveBackground","tab.inactiveForeground","tab.lastPinnedBorder","tab.unfocusedActiveBorder","tab.unfocusedActiveBorderTop","tab.unfocusedHoverBackground","terminal.foreground","terminal.inactiveSelectionBackground","terminal.tab.activeBorder","terminalCursor.foreground","textBlockQuote.background","textBlockQuote.border","textCodeBlock.background","textLink.activeForeground","textLink.foreground","textPreformat.foreground","textSeparator.foreground","titleBar.activeBackground","titleBar.activeForeground","titleBar.border","titleBar.inactiveBackground","titleBar.inactiveForeground","welcomePage.tileBackground","widget.border","activityBar.dropBorder","banner.background","banner.foreground","banner.iconForeground","breadcrumb.activeSelectionForeground","breadcrumb.background","breadcrumb.focusForeground","breadcrumb.foreground","breadcrumbPicker.background","button.separator","charts.blue","charts.foreground","charts.green","charts.lines","charts.orange","charts.purple","charts.red","charts.yellow","checkbox.foreground","checkbox.selectBackground","checkbox.selectBorder","commandCenter.activeBackground","commandCenter.activeBorder","commandCenter.activeForeground","commandCenter.background","commandCenter.border","commandCenter.foreground","commandCenter.inactiveBorder","commandCenter.inactiveForeground","debugConsole.errorForeground","debugConsole.infoForeground","debugConsole.sourceForeground","debugConsole.warningForeground","debugConsoleInputIcon.foreground","debugExceptionWidget.background","debugExceptionWidget.border","debugIcon.breakpointCurrentStackframeForeground","debugIcon.breakpointDisabledForeground","debugIcon.breakpointForeground","debugIcon.breakpointStackframeForeground","debugIcon.breakpointUnverifiedForeground","debugIcon.continueForeground","debugIcon.disconnectForeground","debugIcon.pauseForeground","debugIcon.restartForeground","debugIcon.startForeground","debugIcon.stepBackForeground","debugIcon.stepIntoForeground","debugIcon.stepOutForeground","debugIcon.stepOverForeground","debugIcon.stopForeground","debugTokenExpression.boolean","debugTokenExpression.error","debugTokenExpression.name","debugTokenExpression.number","debugTokenExpression.string","debugTokenExpression.value","debugToolBar.background","debugView.exceptionLabelBackground","debugView.exceptionLabelForeground","debugView.stateLabelBackground","debugView.stateLabelForeground","debugView.valueChangedHighlight","diffEditor.diagonalFill","disabledForeground","editor.findMatchHighlightBackground","editor.findRangeHighlightBackground","editor.focusedStackFrameHighlightBackground","editor.foldBackground","editor.hoverHighlightBackground","editor.inlineValuesBackground","editor.inlineValuesForeground","editor.lineHighlightBorder","editor.linkedEditingBackground","editor.rangeHighlightBackground","editor.selectionBackground","editor.snippetFinalTabstopHighlightBorder","editor.snippetTabstopHighlightBackground","editor.stackFrameHighlightBackground","editor.symbolHighlightBackground","editor.wordHighlightBackground","editor.wordHighlightStrongBackground","editor.wordHighlightTextBackground","editorActiveLineNumber.foreground","editorBracketHighlight.foreground1","editorBracketHighlight.foreground2","editorBracketHighlight.foreground3","editorBracketHighlight.foreground4","editorBracketHighlight.foreground5","editorBracketHighlight.foreground6","editorBracketHighlight.unexpectedBracket.foreground","editorBracketMatch.background","editorBracketMatch.border","editorBracketPairGuide.activeBackground1","editorBracketPairGuide.activeBackground2","editorBracketPairGuide.activeBackground3","editorBracketPairGuide.activeBackground4","editorBracketPairGuide.activeBackground5","editorBracketPairGuide.activeBackground6","editorBracketPairGuide.background1","editorBracketPairGuide.background2","editorBracketPairGuide.background3","editorBracketPairGuide.background4","editorBracketPairGuide.background5","editorBracketPairGuide.background6","editorCodeLens.foreground","editorCommentsWidget.rangeActiveBackground","editorCommentsWidget.rangeActiveBorder","editorCommentsWidget.rangeBackground","editorCommentsWidget.rangeBorder","editorCommentsWidget.resolvedBorder","editorCommentsWidget.unresolvedBorder","editorCursor.foreground","editorError.foreground","editorGhostText.foreground","editorGroup.dropBackground","editorGroup.dropIntoPromptBackground","editorGroup.dropIntoPromptForeground","editorGroupHeader.noTabsBackground","editorGutter.background","editorGutter.commentGlyphForground","editorGutter.commentRangeForeground","editorGutter.foldingControlForeground","editorHint.foreground","editorHoverWidget.background","editorHoverWidget.border","editorHoverWidget.foreground","editorHoverWidget.highlightForeground","editorHoverWidget.statusBarBackground","editorInfo.foreground","editorInlayHint.parameterBackground","editorInlayHint.parameterForeground","editorLightBulb.foreground","editorLightBulbAutoFix.foreground","editorLink.activeForeground","editorMarkerNavigation.background","editorMarkerNavigationError.background","editorMarkerNavigationError.headerBackground","editorMarkerNavigationInfo.background","editorMarkerNavigationInfo.headerBackground","editorMarkerNavigationWarning.background","editorMarkerNavigationWarning.headerBackground","editorOverviewRuler.addedForeground","editorOverviewRuler.bracketMatchForeground","editorOverviewRuler.commonContentForeground","editorOverviewRuler.currentContentForeground","editorOverviewRuler.deletedForeground","editorOverviewRuler.errorForeground","editorOverviewRuler.findMatchForeground","editorOverviewRuler.incomingContentForeground","editorOverviewRuler.infoForeground","editorOverviewRuler.modifiedForeground","editorOverviewRuler.rangeHighlightForeground","editorOverviewRuler.selectionHighlightForeground","editorOverviewRuler.warningForeground","editorOverviewRuler.wordHighlightForeground","editorOverviewRuler.wordHighlightStrongForeground","editorOverviewRuler.wordHighlightTextForeground","editorPane.background","editorRuler.foreground","editorStickyScroll.background","editorStickyScrollHover.background","editorSuggestWidget.border","editorSuggestWidget.focusHighlightForeground","editorSuggestWidget.foreground","editorSuggestWidget.highlightForeground","editorSuggestWidget.selectedBackground","editorSuggestWidget.selectedForeground","editorSuggestWidget.selectedIconForeground","editorSuggestWidgetStatus.foreground","editorUnicodeHighlight.background","editorUnicodeHighlight.border","editorUnnecessaryCode.opacity","editorWarning.foreground","editorWhitespace.foreground","editorWidget.border","editorWidget.foreground","extensionBadge.remoteBackground","extensionBadge.remoteForeground","extensionButton.background","extensionButton.foreground","extensionButton.hoverBackground","extensionButton.prominentBackground","extensionButton.prominentForeground","extensionButton.prominentHoverBackground","extensionButton.separator","extensionIcon.preReleaseForeground","extensionIcon.sponsorForeground","extensionIcon.starForeground","extensionIcon.verifiedForeground","inputOption.hoverBackground","inputValidation.errorBackground","inputValidation.errorBorder","inputValidation.infoBackground","inputValidation.infoBorder","inputValidation.warningBackground","inputValidation.warningBorder","interactive.activeCodeBorder","interactive.inactiveCodeBorder","issues.closed","issues.newIssueDecoration","issues.open","keybindingLabel.background","keybindingLabel.border","keybindingLabel.bottomBorder","keybindingTable.headerBackground","keybindingTable.rowsBackground","list.deemphasizedForeground","list.dropBackground","list.errorForeground","list.filterMatchBackground","list.focusHighlightForeground","list.focusOutline","list.highlightForeground","list.inactiveSelectionBackground","list.invalidItemForeground","list.warningForeground","listFilterWidget.background","listFilterWidget.noMatchesOutline","listFilterWidget.outline","listFilterWidget.shadow","menu.background","menu.foreground","menu.selectionBackground","menu.selectionForeground","menu.separatorBackground","menubar.selectionBackground","menubar.selectionForeground","merge.commonContentBackground","merge.commonHeaderBackground","merge.currentContentBackground","merge.currentHeaderBackground","merge.incomingContentBackground","merge.incomingHeaderBackground","mergeEditor.change.background","mergeEditor.change.word.background","mergeEditor.changeBase.background","mergeEditor.changeBase.word.background","mergeEditor.conflict.handled.minimapOverViewRuler","mergeEditor.conflict.handledFocused.border","mergeEditor.conflict.handledUnfocused.border","mergeEditor.conflict.input1.background","mergeEditor.conflict.input2.background","mergeEditor.conflict.unhandled.minimapOverViewRuler","mergeEditor.conflict.unhandledFocused.border","mergeEditor.conflict.unhandledUnfocused.border","mergeEditor.conflictingLines.background","minimap.errorHighlight","minimap.findMatchHighlight","minimap.foregroundOpacity","minimap.selectionHighlight","minimap.selectionOccurrenceHighlight","minimap.warningHighlight","minimapGutter.addedBackground","minimapGutter.deletedBackground","minimapGutter.modifiedBackground","minimapSlider.activeBackground","minimapSlider.background","minimapSlider.hoverBackground","notebook.cellEditorBackground","notebook.cellInsertionIndicator","notebook.cellStatusBarItemHoverBackground","notebook.cellToolbarSeparator","notebook.editorBackground","notebook.focusedCellBorder","notebook.focusedEditorBorder","notebook.inactiveFocusedCellBorder","notebook.selectedCellBorder","notebook.symbolHighlightBackground","notebookEditorOverviewRuler.runningCellForeground","notebookScrollbarSlider.activeBackground","notebookScrollbarSlider.background","notebookScrollbarSlider.hoverBackground","notebookStatusErrorIcon.foreground","notebookStatusRunningIcon.foreground","notebookStatusSuccessIcon.foreground","notificationCenter.border","notificationLink.foreground","notificationToast.border","notificationsErrorIcon.foreground","notificationsInfoIcon.foreground","notificationsWarningIcon.foreground","panel.dropBorder","panelSection.border","panelSection.dropBackground","panelSectionHeader.background","peekView.border","peekViewEditor.background","peekViewEditorGutter.background","peekViewEditorStickScroll.background","peekViewResult.fileForeground","peekViewResult.lineForeground","peekViewResult.selectionBackground","peekViewResult.selectionForeground","peekViewTitle.background","peekViewTitleDescription.foreground","peekViewTitleLabel.foreground","problemsErrorIcon.foreground","problemsInfoIcon.foreground","problemsWarningIcon.foreground","pullRequests.closed","pullRequests.draft","pullRequests.merged","pullRequests.notification","pullRequests.open","quickInputList.focusBackground","quickInputList.focusForeground","quickInputList.focusIconForeground","quickInputTitle.background","remoteHub.decorations.addedForegroundColor","remoteHub.decorations.conflictForegroundColor","remoteHub.decorations.deletedForegroundColor","remoteHub.decorations.incomingAddedForegroundColor","remoteHub.decorations.incomingDeletedForegroundColor","remoteHub.decorations.incomingModifiedForegroundColor","remoteHub.decorations.incomingRenamedForegroundColor","remoteHub.decorations.modifiedForegroundColor","remoteHub.decorations.possibleConflictForegroundColor","remoteHub.decorations.submoduleForegroundColor","remoteHub.decorations.workspaceRepositoriesView.hasUncommittedChangesForegroundColor","sash.hoverBorder","scm.providerBorder","searchEditor.findMatchBackground","settings.checkboxBackground","settings.checkboxBorder","settings.checkboxForeground","settings.dropdownForeground","settings.dropdownListBorder","settings.focusedRowBackground","settings.focusedRowBorder","settings.headerBorder","settings.numberInputBackground","settings.numberInputForeground","settings.rowHoverBackground","settings.sashBorder","settings.settingsHeaderHoverForeground","settings.textInputBackground","settings.textInputForeground","sideBar.dropBackground","sideBySideEditor.horizontalBorder","sideBySideEditor.verticalBorder","statusBar.debuggingBorder","statusBar.noFolderBorder","statusBar.noFolderForeground","statusBar.offlineBackground","statusBar.offlineBorder","statusBar.offlineForeground","statusBarItem.activeBackground","statusBarItem.compactHoverBackground","statusBarItem.errorForeground","statusBarItem.hoverBackground","statusBarItem.prominentForeground","statusBarItem.prominentHoverBackground","statusBarItem.warningBackground","statusBarItem.warningForeground","symbolIcon.arrayForeground","symbolIcon.booleanForeground","symbolIcon.classForeground","symbolIcon.colorForeground","symbolIcon.constantForeground","symbolIcon.constructorForeground","symbolIcon.enumeratorForeground","symbolIcon.enumeratorMemberForeground","symbolIcon.eventForeground","symbolIcon.fieldForeground","symbolIcon.fileForeground","symbolIcon.folderForeground","symbolIcon.functionForeground","symbolIcon.interfaceForeground","symbolIcon.keyForeground","symbolIcon.keywordForeground","symbolIcon.methodForeground","symbolIcon.moduleForeground","symbolIcon.namespaceForeground","symbolIcon.nullForeground","symbolIcon.numberForeground","symbolIcon.objectForeground","symbolIcon.operatorForeground","symbolIcon.packageForeground","symbolIcon.propertyForeground","symbolIcon.referenceForeground","symbolIcon.snippetForeground","symbolIcon.stringForeground","symbolIcon.structForeground","symbolIcon.textForeground","symbolIcon.typeParameterForeground","symbolIcon.unitForeground","symbolIcon.variableForeground","tab.activeModifiedBorder","tab.inactiveModifiedBorder","tab.unfocusedActiveBackground","tab.unfocusedActiveForeground","tab.unfocusedActiveModifiedBorder","tab.unfocusedInactiveBackground","tab.unfocusedInactiveForeground","tab.unfocusedInactiveModifiedBorder","terminal.ansiBlack","terminal.ansiBlue","terminal.ansiBrightBlack","terminal.ansiBrightBlue","terminal.ansiBrightCyan","terminal.ansiBrightGreen","terminal.ansiBrightMagenta","terminal.ansiBrightRed","terminal.ansiBrightWhite","terminal.ansiBrightYellow","terminal.ansiCyan","terminal.ansiGreen","terminal.ansiMagenta","terminal.ansiRed","terminal.ansiWhite","terminal.ansiYellow","terminal.border","terminal.dropBackground","terminal.findMatchBackground","terminal.findMatchHighlightBackground","terminal.selectionBackground","terminalCommandDecoration.defaultBackground","terminalCommandDecoration.errorBackground","terminalCommandDecoration.successBackground","terminalOverviewRuler.cursorForeground","terminalOverviewRuler.findMatchForeground","testing.iconErrored","testing.iconFailed","testing.iconPassed","testing.iconQueued","testing.iconSkipped","testing.iconUnset","testing.message.error.decorationForeground","testing.message.error.lineBackground","testing.message.info.decorationForeground","testing.peekBorder","testing.peekHeaderBackground","testing.runAction","toolbar.activeBackground","toolbar.hoverBackground","tree.inactiveIndentGuidesStroke","tree.indentGuidesStroke","tree.tableColumnsBorder","tree.tableOddRowsBackground","walkthrough.stepTitle.foreground","welcomeOverlay.background","welcomePage.progress.background","welcomePage.progress.foreground","welcomePage.tileBorder","welcomePage.tileHoverBackground","widget.shadow","activityBar.activeBackground","activityBar.activeFocusBorder","contrastActiveBorder","contrastBorder","debugToolBar.border","diffEditor.border","diffEditor.insertedTextBorder","diffEditor.removedTextBorder","diffEditorGutter.insertedLineBackground","diffEditorGutter.removedLineBackground","diffEditorOverview.insertedForeground","diffEditorOverview.removedForeground","editor.findMatchBorder","editor.findMatchHighlightBorder","editor.findRangeHighlightBorder","editor.lineHighlightBackground","editor.rangeHighlightBorder","editor.selectionForeground","editor.selectionHighlightBorder","editor.snippetFinalTabstopHighlightBackground","editor.snippetTabstopHighlightBorder","editor.symbolHighlightBorder","editor.wordHighlightBorder","editor.wordHighlightStrongBorder","editor.wordHighlightTextBorder","editorCursor.background","editorError.background","editorError.border","editorGhostText.background","editorGhostText.border","editorGroup.dropIntoPromptBorder","editorGroup.emptyBackground","editorGroup.focusedEmptyBorder","editorGroupHeader.border","editorHint.border","editorInfo.background","editorInfo.border","editorLineNumber.dimmedForeground","editorOverviewRuler.background","editorUnnecessaryCode.border","editorWarning.background","editorWarning.border","editorWidget.resizeBorder","inputValidation.errorForeground","inputValidation.infoForeground","inputValidation.warningForeground","list.filterMatchBorder","list.focusBackground","list.focusForeground","list.hoverForeground","list.inactiveFocusBackground","list.inactiveFocusOutline","list.inactiveSelectionForeground","list.inactiveSelectionIconForeground","menu.selectionBorder","menubar.selectionBorder","merge.border","minimap.background","notebook.cellHoverBackground","notebook.focusedCellBackground","notebook.inactiveSelectedCellBorder","notebook.outputContainerBackgroundColor","notebook.outputContainerBorderColor","panelSectionHeader.border","panelSectionHeader.foreground","peekViewEditor.matchHighlightBorder","quickInput.list.focusBackground","searchEditor.findMatchBorder","selection.background","tab.hoverBorder","tab.hoverForeground","tab.unfocusedHoverBorder","tab.unfocusedHoverForeground","terminal.background","terminal.findMatchBorder","terminal.findMatchHighlightBorder","terminal.selectionForeground","terminalCursor.background","testing.message.info.lineBackground","toolbar.hoverOutline","walkThrough.embeddedEditorBackground","welcomePage.background","window.activeBorder","window.inactiveBorder","profileBadge.background","profileBadge.foreground"] + } + ] + } + } +} \ No newline at end of file diff --git a/src/args.ts b/src/args.ts index 2ee8870..e852e1e 100644 --- a/src/args.ts +++ b/src/args.ts @@ -112,7 +112,10 @@ export const commandArgs: Record = { text: '', name: '', reveal: true, - cwd: '', + }, + [CommandId.FocusTerminal]: { + name: '', + target: 'newest', }, [CommandId.StartDebugging]: '', [CommandId.OpenExternal]: '', diff --git a/src/codiconNames.ts b/src/codiconNames.ts new file mode 100644 index 0000000..c27bf14 --- /dev/null +++ b/src/codiconNames.ts @@ -0,0 +1,527 @@ +export type CodiconName = typeof codiconNames[number]; + +/** + * @see https://github.com/microsoft/vscode-codicons/blob/main/src/template/mapping.json + */ +export const codiconNames = [ + 'account', + 'activate-breakpoints', + 'add', + 'alert', + 'archive', + 'array', + 'arrow-both', + 'arrow-circle-down', + 'arrow-circle-left', + 'arrow-circle-right', + 'arrow-circle-up', + 'arrow-down', + 'arrow-left', + 'arrow-right', + 'arrow-small-down', + 'arrow-small-left', + 'arrow-small-right', + 'arrow-small-up', + 'arrow-swap', + 'arrow-up', + 'azure-devops', + 'azure', + 'beaker-stop', + 'beaker', + 'bell-dot', + 'bell-slash-dot', + 'bell-slash', + 'bell', + 'blank', + 'bold', + 'book', + 'bookmark', + 'bracket-dot', + 'bracket-error', + 'bracket', + 'briefcase', + 'broadcast', + 'browser', + 'bug', + 'calendar', + 'call-incoming', + 'call-outgoing', + 'case-sensitive', + 'check-all', + 'check', + 'checklist', + 'chevron-down', + 'chevron-left', + 'chevron-right', + 'chevron-up', + 'chrome-close', + 'chrome-maximize', + 'chrome-minimize', + 'chrome-restore', + 'circle-filled', + 'circle-large-filled', + 'circle-large-outline', + 'circle-large', + 'circle-outline', + 'circle-slash', + 'circle-small-filled', + 'circle-small', + 'circle', + 'circuit-board', + 'clear-all', + 'clippy', + 'clock', + 'clone', + 'close-all', + 'close-dirty', + 'close', + 'cloud-download', + 'cloud-upload', + 'cloud', + 'code', + 'collapse-all', + 'color-mode', + 'combine', + 'comment-add', + 'comment-discussion', + 'comment-draft', + 'comment-unresolved', + 'comment', + 'compare-changes', + 'compass-active', + 'compass-dot', + 'compass', + 'console', + 'copy', + 'credit-card', + 'dash', + 'dashboard', + 'database', + 'debug-all', + 'debug-alt-small', + 'debug-alt', + 'debug-breakpoint-conditional-disabled', + 'debug-breakpoint-conditional-unverified', + 'debug-breakpoint-conditional', + 'debug-breakpoint-data-disabled', + 'debug-breakpoint-data-unverified', + 'debug-breakpoint-data', + 'debug-breakpoint-disabled', + 'debug-breakpoint-function-disabled', + 'debug-breakpoint-function-unverified', + 'debug-breakpoint-function', + 'debug-breakpoint-log-disabled', + 'debug-breakpoint-log-unverified', + 'debug-breakpoint-log', + 'debug-breakpoint-unsupported', + 'debug-breakpoint-unverified', + 'debug-breakpoint', + 'debug-console', + 'debug-continue-small', + 'debug-continue', + 'debug-coverage', + 'debug-disconnect', + 'debug-hint', + 'debug-line-by-line', + 'debug-pause', + 'debug-rerun', + 'debug-restart-frame', + 'debug-restart', + 'debug-reverse-continue', + 'debug-stackframe-active', + 'debug-stackframe-dot', + 'debug-stackframe-focused', + 'debug-stackframe', + 'debug-start', + 'debug-step-back', + 'debug-step-into', + 'debug-step-out', + 'debug-step-over', + 'debug-stop', + 'debug', + 'desktop-download', + 'device-camera-video', + 'device-camera', + 'device-desktop', + 'device-mobile', + 'diff-added', + 'diff-ignored', + 'diff-modified', + 'diff-removed', + 'diff-renamed', + 'diff', + 'discard', + 'edit', + 'editor-layout', + 'ellipsis', + 'empty-window', + 'error-small', + 'error', + 'exclude', + 'expand-all', + 'export', + 'extensions', + 'eye-closed', + 'eye-unwatch', + 'eye-watch', + 'eye', + 'feedback', + 'file-add', + 'file-binary', + 'file-code', + 'file-directory-create', + 'file-directory', + 'file-media', + 'file-pdf', + 'file-submodule', + 'file-symlink-directory', + 'file-symlink-file', + 'file-text', + 'file-zip', + 'file', + 'files', + 'filter-filled', + 'filter', + 'flame', + 'fold-down', + 'fold-up', + 'fold', + 'folder-active', + 'folder-library', + 'folder-opened', + 'folder', + 'gather', + 'gear', + 'gift', + 'gist-fork', + 'gist-new', + 'gist-private', + 'gist-secret', + 'gist', + 'git-branch-create', + 'git-branch-delete', + 'git-branch', + 'git-commit', + 'git-compare', + 'git-fork-private', + 'git-merge', + 'git-pull-request-abandoned', + 'git-pull-request-closed', + 'git-pull-request-create', + 'git-pull-request-draft', + 'git-pull-request-go-to-changes', + 'git-pull-request-new-changes', + 'git-pull-request', + 'github-action', + 'github-alt', + 'github-inverted', + 'github', + 'globe', + 'go-to-file', + 'grabber', + 'graph-left', + 'graph-line', + 'graph-scatter', + 'graph', + 'gripper', + 'group-by-ref-type', + 'heart-filled', + 'heart', + 'history', + 'home', + 'horizontal-rule', + 'hubot', + 'inbox', + 'indent', + 'info', + 'inspect', + 'issue-closed', + 'issue-draft', + 'issue-opened', + 'issue-reopened', + 'issues', + 'italic', + 'jersey', + 'json', + 'kebab-horizontal', + 'kebab-vertical', + 'key', + 'keyboard', + 'law', + 'layers-active', + 'layers-dot', + 'layers', + 'layout-activitybar-left', + 'layout-activitybar-right', + 'layout-centered', + 'layout-menubar', + 'layout-panel-center', + 'layout-panel-justify', + 'layout-panel-left', + 'layout-panel-off', + 'layout-panel-right', + 'layout-panel', + 'layout-sidebar-left-off', + 'layout-sidebar-left', + 'layout-sidebar-right-off', + 'layout-sidebar-right', + 'layout-statusbar', + 'layout', + 'library', + 'light-bulb', + 'lightbulb-autofix', + 'lightbulb', + 'link-external', + 'link', + 'list-filter', + 'list-flat', + 'list-ordered', + 'list-selection', + 'list-tree', + 'list-unordered', + 'live-share', + 'loading', + 'location', + 'lock-small', + 'lock', + 'log-in', + 'log-out', + 'logo-github', + 'magnet', + 'mail-read', + 'mail-reply', + 'mail', + 'map-filled', + 'map', + 'mark-github', + 'markdown', + 'megaphone', + 'mention', + 'menu', + 'merge', + 'microscope', + 'milestone', + 'mirror-private', + 'mirror-public', + 'mirror', + 'more', + 'mortar-board', + 'move', + 'multiple-windows', + 'mute', + 'new-file', + 'new-folder', + 'newline', + 'no-newline', + 'note', + 'notebook-template', + 'notebook', + 'octoface', + 'open-preview', + 'organization-filled', + 'organization-outline', + 'organization', + 'output', + 'package', + 'paintcan', + 'pass-filled', + 'pass', + 'pencil', + 'person-add', + 'person-filled', + 'person-follow', + 'person-outline', + 'person', + 'pie-chart', + 'pin', + 'pinned-dirty', + 'pinned', + 'play-circle', + 'play', + 'plug', + 'plus', + 'preserve-case', + 'preview', + 'primitive-dot', + 'primitive-square', + 'project', + 'pulse', + 'question', + 'quote', + 'radio-tower', + 'reactions', + 'record-keys', + 'record-small', + 'record', + 'redo', + 'references', + 'refresh', + 'regex', + 'remote-explorer', + 'remote', + 'remove-close', + 'remove', + 'repl', + 'replace-all', + 'replace', + 'reply', + 'repo-clone', + 'repo-create', + 'repo-delete', + 'repo-force-push', + 'repo-forked', + 'repo-pull', + 'repo-push', + 'repo-sync', + 'repo', + 'report', + 'request-changes', + 'rocket', + 'root-folder-opened', + 'root-folder', + 'rss', + 'ruby', + 'run-above', + 'run-all', + 'run-below', + 'run-errors', + 'run', + 'save-all', + 'save-as', + 'save', + 'screen-full', + 'screen-normal', + 'search-fuzzy', + 'search-save', + 'search-stop', + 'search', + 'selection', + 'server-environment', + 'server-process', + 'server', + 'settings-gear', + 'settings', + 'shield', + 'sign-in', + 'sign-out', + 'smiley', + 'sort-precedence', + 'source-control', + 'split-horizontal', + 'split-vertical', + 'squirrel', + 'star-add', + 'star-delete', + 'star-empty', + 'star-full', + 'star-half', + 'star', + 'stop-circle', + 'stop', + 'symbol-array', + 'symbol-boolean', + 'symbol-class', + 'symbol-color', + 'symbol-constant', + 'symbol-constructor', + 'symbol-enum-member', + 'symbol-enum', + 'symbol-event', + 'symbol-field', + 'symbol-file', + 'symbol-folder', + 'symbol-function', + 'symbol-interface', + 'symbol-key', + 'symbol-keyword', + 'symbol-method', + 'symbol-misc', + 'symbol-module', + 'symbol-namespace', + 'symbol-null', + 'symbol-number', + 'symbol-numeric', + 'symbol-object', + 'symbol-operator', + 'symbol-package', + 'symbol-parameter', + 'symbol-property', + 'symbol-reference', + 'symbol-ruler', + 'symbol-snippet', + 'symbol-string', + 'symbol-struct', + 'symbol-structure', + 'symbol-text', + 'symbol-type-parameter', + 'symbol-unit', + 'symbol-value', + 'symbol-variable', + 'sync-ignored', + 'sync', + 'table', + 'tag-add', + 'tag-remove', + 'tag', + 'target', + 'tasklist', + 'telescope', + 'terminal-bash', + 'terminal-cmd', + 'terminal-debian', + 'terminal-decoration-error', + 'terminal-decoration-incomplete', + 'terminal-decoration-mark', + 'terminal-decoration-success', + 'terminal-linux', + 'terminal-powershell', + 'terminal-tmux', + 'terminal-ubuntu', + 'terminal', + 'text-size', + 'three-bars', + 'thumbsdown', + 'thumbsup', + 'tools', + 'trash', + 'trashcan', + 'triangle-down', + 'triangle-left', + 'triangle-right', + 'triangle-up', + 'twitter', + 'type-hierarchy-sub', + 'type-hierarchy-super', + 'type-hierarchy', + 'unfold', + 'ungroup-by-ref-type', + 'unlock', + 'unmute', + 'unverified', + 'variable-group', + 'variable', + 'verified-filled', + 'verified', + 'versions', + 'vm-active', + 'vm-connect', + 'vm-outline', + 'vm-running', + 'vm', + 'wand', + 'warning', + 'watch', + 'whitespace', + 'whole-word', + 'window', + 'word-wrap', + 'workspace-trusted', + 'workspace-unknown', + 'workspace-untrusted', + 'wrench-subaction', + 'wrench', + 'x', + 'zap', + 'zoom-in', + 'zoom-out', +] as const; diff --git a/src/commands.ts b/src/commands.ts index f88a4e4..0683aa1 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -3,6 +3,7 @@ import { assignKeybindingCommand } from './commands/assignKeybindingCommand'; import { clipboardWriteCommand } from './commands/clipboardWriteCommand'; import { deleteCommandCommand } from './commands/deleteCommandCommand'; import { escapeCommandUriArgumentCommand } from './commands/escapeCommandUriArgumentCommand'; +import { focusTerminalCommand } from './commands/focusTerminalCommand'; import { incrementSettingCommand } from './commands/incrementSettingCommand'; import { newCommandCommand, newCommandInFolderCommand } from './commands/newCommandCommand'; import { newFolderCommand } from './commands/newFolderCommand'; @@ -60,6 +61,7 @@ export const enum CommandId { OpenFolder = 'commands.openFolder', ShowNotification = 'commands.showNotification', ShowStatusBarNotification = 'commands.showStatusBarNotification', + FocusTerminal = 'commands.focusTerminal', RunInTerminal = 'commands.runInTerminal', StartDebugging = 'commands.startDebugging', ToggleTheme = 'commands.toggleTheme', @@ -98,6 +100,7 @@ export function registerExtensionCommands() { commands.registerCommand(CommandId.OpenFolder, openFolderCommand); commands.registerCommand(CommandId.ShowNotification, showNotificationCommand); commands.registerCommand(CommandId.ShowStatusBarNotification, showStatusBarNotificationCommand); + commands.registerCommand(CommandId.FocusTerminal, focusTerminalCommand); commands.registerCommand(CommandId.RunInTerminal, runInTerminalCommand); commands.registerCommand(CommandId.StartDebugging, startDebuggingCommand); commands.registerCommand(CommandId.ToggleTheme, toggleThemeCommand); diff --git a/src/commands/focusTerminalCommand.ts b/src/commands/focusTerminalCommand.ts new file mode 100644 index 0000000..d1cd92b --- /dev/null +++ b/src/commands/focusTerminalCommand.ts @@ -0,0 +1,57 @@ +import { Terminal, TerminalOptions, ThemeColor, ThemeIcon, window } from 'vscode'; +import { CodiconName } from '../codiconNames'; + +export interface FocusTerminalArgs { + name?: string; + icon?: CodiconName; + iconColor?: string; + cwd?: string; + target?: 'create new' | 'newest' | 'oldest'; +} + +/** + * Ideally, this would be terminals that are not running tasks? + */ +const nonTaskTerminals: Set = new Set(); + +export function focusTerminalCommand(arg: FocusTerminalArgs | string, deferShow?: boolean): Terminal { + const terminals = window.terminals; + const targetTerminalOptions: TerminalOptions = {}; + let targetTerminal: Terminal | undefined; + let shouldAttemptReuse = true; + let shouldMatchNewest = true; + + if (!arg || typeof arg === 'string') { + targetTerminalOptions.name = arg; + } else if (arg) { + shouldAttemptReuse = arg.target !== 'create new'; + shouldMatchNewest = !arg.target || arg.target !== 'oldest'; + targetTerminalOptions.name = arg.name; + targetTerminalOptions.cwd = arg.cwd; + targetTerminalOptions.color = arg.iconColor && new ThemeColor(arg.iconColor); + targetTerminalOptions.iconPath = arg.icon && new ThemeIcon(arg.icon); + } + + if (shouldAttemptReuse) { + if (!targetTerminalOptions.name) { + targetTerminalOptions.name = undefined; + terminals.forEach(term => term.creationOptions.name === undefined && nonTaskTerminals.add(term)); + nonTaskTerminals.forEach(nonTaskTerm => !terminals.includes(nonTaskTerm) && nonTaskTerminals.delete(nonTaskTerm)); + const termsToQuery = shouldMatchNewest ? [...nonTaskTerminals].reverse() : [...nonTaskTerminals]; + targetTerminal = termsToQuery[0]; + } else { + const termsToQuery = shouldMatchNewest ? [...terminals].reverse() : terminals; + targetTerminal = termsToQuery.find(term => term.name === targetTerminalOptions.name); + } + } + + targetTerminal ||= window.createTerminal(targetTerminalOptions); + + nonTaskTerminals.add(targetTerminal); + + if (!deferShow) { + targetTerminal.show(); + } + + return targetTerminal; +} diff --git a/src/commands/runInTerminalCommand.ts b/src/commands/runInTerminalCommand.ts index 8df7e27..494df26 100644 --- a/src/commands/runInTerminalCommand.ts +++ b/src/commands/runInTerminalCommand.ts @@ -1,43 +1,58 @@ import { Disposable, window } from 'vscode'; +import { CodiconName } from '../codiconNames'; +import { CommandId } from '../commands'; +import { FocusTerminalArgs, focusTerminalCommand } from './focusTerminalCommand'; interface RunInTerminalArgs { text?: string; name?: string; + icon?: CodiconName; + iconColor?: string; cwd?: string; reveal?: boolean; waitForExit?: boolean; + reuse?: Exclude; } -let onDidCloseTerminalDisposable: Disposable; +export async function runInTerminalCommand(arg: RunInTerminalArgs | string): Promise { + let onDidCloseTerminalDisposable: Disposable; -export async function runInTerminalCommand(arg: RunInTerminalArgs | string): Promise { return new Promise((resolve, reject) => { + if (arg === undefined) { + window.showErrorMessage(`No "args" property provided for "${CommandId.RunInTerminal}" command.`); + return; + } + if (typeof arg === 'string') { const newTerm = window.createTerminal(); newTerm.sendText(arg); newTerm.show(); } else { if (!arg.text) { - window.showErrorMessage('No "text" property provided.'); + window.showErrorMessage(`No "text" property provided in "args" of "${CommandId.RunInTerminal}" command.`); return; - } - const newTerm = window.createTerminal({ - name: arg.name, - cwd: arg.cwd, - }); - if (arg.waitForExit) { - onDidCloseTerminalDisposable = window.onDidCloseTerminal(closedTerminal => { - if (closedTerminal.name === newTerm.name) { - resolve(true); - onDidCloseTerminalDisposable?.dispose(); - } - }); } else { - resolve(false); - } - newTerm.sendText(arg.text); - if (arg.reveal) { - newTerm.show(); + const targetTerminal = focusTerminalCommand({ + ...arg, + target: arg.reuse ?? 'create new', + }, true); + + if (arg.waitForExit) { + onDidCloseTerminalDisposable = window.onDidCloseTerminal(closedTerminal => { + if (closedTerminal.name === targetTerminal.name) { + resolve(); + onDidCloseTerminalDisposable?.dispose(); + } + }); + } else { + resolve(); + } + + targetTerminal.sendText(arg.text); + + if (arg.reveal) { + targetTerminal.show(); + } } } }); diff --git a/src/types.ts b/src/types.ts index 89eaf71..c4d87c0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,5 @@ + + export interface ExtensionConfig { /** * Main config. Items to show in Tree View.