Firstly, it was the tool-based emergency system designed around the capability API of a VS Code IDE. As maximum and convenient, flexible, super-fast Extreme programming (XP) platform was aimed at the create more features, methods, and capabilities for emergency cases arising from sudden bugs out of new updates, rules, changes, .etc. Allowing programmers to design temporary or permanent solution in no-time.
Yes, I’m using it for a long time, in spite of their “you can’t use the entire XP framework in many situations”, And I’m used to it now. You right, it shouldn’t stop you from using as many of the practices as possible given your context.
Visual Studio Code USEFUL PANEL Adds a panel for accessing frequently used files, Internet addresses, programs, commands, snippets. Beefed up by "Webpack Config" like behavior configure module. |
This is derived work based on Favorites Panel by Sabitov Vladimir. Extended with our development kit for specific extreme urgency cases.
It’s running only when active “Useful Panel”, triggers automatically when its first starts, or for all time when configuration compiles errors. Always triggers automatically on save and it is automatically enabled or can’t be disabled.
The specific links on the panel allow you easily navigate to the line which describes its arguments parameter. Set the {_nav:1}, to generate a default sample when the document will be saved.
The extension will initial demo configuration if none in .vscode/.favoritesSideBar.js.
() => {
const howTo = {
...
}
"favoritesSideBar": {
commands ": [ {
...
}
]
}
}
List of available icons
Sandbox environment-variables. Includes:
{
require,
_, // lodash
vscode,
env.name // extension name
env.workspaceFolder // project root directory
env.сontext // vscode.ExtensionContext
env.prettier // integrated AutoFormat configuration
}
// env.prettier.semi = false
// env.prettier["singleQuote"] = true
$$$masterScript$$$
- ✨bonus✨ generate master script, outside commands block samples, for general config body of code.{_nav:1},
or {_nav:<whatever>},
- generate navigation default sample.{help:1},
or {help:<whatever>},
- generate generate “HOW TO” commands branch.{end:1},
or {end:<whatever>},
- generate “config” end “about” commands.Easy navigate between your files references via the different !include… tags using ‘f12’ / ‘Go to Definition’.
{
"label": "lowercase ➜ UPPER CASE",
"description": "",
"icon": "debug-step-out",
"command": "runCommand",
"arguments": [
"editor.action.transformToUppercase"
]
}
Settings for opening file in project
{
"label": "README",
"description": "- read me",
"command": "openFile",
"arguments": ["README.MD"]
}
Settings for opening file in project
{
"label": "Hosts",
"description": "Windows hosts file",
"command": "openFile",
"arguments": ["C:\\Windows\\System32\\drivers\\etc\\hosts", "external"]
}
command: workbench.action.findInFiles
arguments:
{
"label": "Find in files",
"description": "",
"command": "runCommand",
"arguments": ["workbench.action.findInFiles", {"query": "SearchPattern", "triggerSearch": true}],
},
Search and insert text by regexp pattern. Searches until the first match.
{
"label": "Replace",
"description": "",
"icon": "find-replace",
"command": "insertNewCode",
"arguments": ["ui/components/tableItem.ts", "<td className=\"col-date-time\">", "<div className=\"new\">NewText</div>", "before"],
}
Search and replace text by regexp pattern. Searches until the first match.
{
"label": "Replace",
"description": "",
"icon": "find-replace",
"command": "insertNewCode",
"arguments": ["ui/components/tableItem.ts", "<td className=\"col-date-time\">", "<div className=\"WOW\"></div>", "replace"]
}
Search and replace text by regexp pattern. Searches all match.
{
"label": "ReplaceAll",
"description": "",
"icon": "find-replace",
"command": "insertNewCode",
"arguments": ["ui/components/tableItem.ts", "<td className=\"col-date-time\">", "<div className=\"WOW\"></div>", "replaceALL"]
}
toLineConfigNavigate
- string, line number, RegExpsetTimeout_worker
- basic setTimeout
on “in-thread mechanism” for “smart” delaying work.onSave
- inject feature in to onSave handle of VSCode corejumpTo
- part of inner navigation system to navigate in your code, moving between commands positions easily and quickly.
cmd
- basic, lines, parameter switchesnode
- eval, scriptterminal
- scripts, text, environment-variablessel
- mutate selection string(runCommand) Samples:
{
label: "CMD",
description: "1",
icon: "play",
command: "runCommand",
arguments: [
"cmd",
`
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
--user-data-dir="D:\\sets\\Chrome\\plnx.acc"
https://observablehq.com/@observablehq/a-taste-of-observable?collection=@observablehq/overview
`,
],
}
{
id: "ID is needed only for [label,description] identify collision issues!",
label: "CMD",
description: "2",
icon: "play",
command: "runCommand",
arguments: [
"cmd",
'"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"',
'--user-data-dir="D:\\sets\\Chrome\\plnx.acc"',
"https://observablehq.com/@observablehq/a-taste-of-observable?collection=@observablehq/overview",
],
}
list silent
{
label: "CMD",
description: "3: list,git ...",
icon: "github",
command: "runCommand",
arguments: [
"cmd",
"list silent",
`
cd /D "D:\\<your git directory>"
git config user.email "<your git email>"
git config user.name "<your git name>"
git config core.autocrlf true
git checkout -b main
git remote rm origin
git remote add origin https://<your git name>:<your git password>@github.com/<your git name>/<your git repo>.git
git rm -r --cached <repo force forder for delete> -f
git add ./
git commit -m "main ✨ HOW TO commit"
git push origin main -u -f
`,
],
}
{
label: "node",
description: "2: server",
icon: "beaker",
command: "runCommand",
arguments: [
"node",
"-e",
`
var http = require('http'),
// open = require('open'),
server;
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\\n');
});
server.listen(1337, '127.0.0.1',function(){
// console.log('Launching the browser on http://127.0.0.1:1337!');
// open('http://127.0.0.1:1337');
});
`,
],
}
{
label: "node",
description: "1: error no module",
icon: "beaker",
command: "runCommand",
arguments: [
"node",
"./node_modules/prettier/bin-prettier",
"./<your>.js",
"--write",
],
}
package.json
scripts{
label: "dev:spa",
description: "",
icon: "chevron-right",
command: "runCommand",
arguments: ["terminal", "quasar dev -m spa"],
}
{
label: "TERMINAL",
description: "1: block",
icon: "terminal",
command: "runCommand",
arguments: [
"terminal",
`
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
--user-data-dir="D:\\sets\\Chrome\\plnx.acc"
https://observablehq.com/@observablehq/a-taste-of-observable?collection=@observablehq/overview
`,
],
}
environment-variables
{
label: "TERMINAL",
description: "2: lines params",
icon: "terminal",
command: "runCommand",
arguments: [
"terminal",
"cls",
'echo "Hello terminal world"',
`node -e "console.log('%chello %s','color:yellow', 'node','prettier : ${howTo.prettier()}');"`,
`echo "Hello extension сontext" && echo "${howTo.сontext()}"`,
`echo "Hello code.exe" && code -v`,
`echo "Hello vscode" && echo "${howTo.vscode.version}"`,
],
}
{
label: "camelCase",
description: "",
icon: "ellipsis",
command: "runCommand",
arguments: ["sel", (_sel) => _.camelCase(_sel)],
}
{
label: "cmd",
description: "",
icon: "arrow-small-right",
command: "toLineConfigNavigate",
arguments: [
'"C:\\Program Files (x86)\\Google\\Chrome\\',
],
}
{
label: "How To",
description: "",
icon: "arrow-small-right",
command: "toLineConfigNavigate",
arguments: [
497,
],
}
{
label: "Commands",
description: "",
icon: "arrow-small-right",
command: "toLineConfigNavigate",
arguments: [
/ return \{[\w\W]*commands: \[/i
],
}
/**
* @example
setTimeoutWorker( 0 // it kill all Workers by timeoutId , (…args) => { args[0].cb = (opt, next) => {
print([opt])
next()
} })
*/
const setTimeoutWorker = (
intervalMin,
_next
) => {
if (
typeof intervalMin === "function"
) {
_next = intervalMin
intervalMin = 0.1
}
const timeoutId = "308"
if (typeof _next === "function") {
vscode.commands
.executeCommand(
`${env.name}.setTimeout_worker`,
timeoutId,
intervalMin
)
.then((_tick) => {
_next(_tick)
// print([_tick])
})
.catch((err) => { })
} else if (!intervalMin) {
vscode.commands
.executeCommand(
`${env.name}.setTimeout_worker`,
timeoutId,
intervalMin
)
.then((_tick) => {
// print([_tick])
})
.catch((err) => { })
}
}
vscode.commands.executeCommand(
`${env.name}.onSave`,
["${workspaceFolder}/README.md"],
/*
(f, cmd,
ed:{
txt: string,
replace: (txt: string, before?: Function | undefined, after?: Function | undefined): void
},
errors{
add(error: string): void,
show(): void
},
tm: (): string,
print: (_v: any): void
) =>void
*/
(f, cmd) => {
tryFn(() => {
const path = require("path")
const pathFrom = (_s) => {
var p = _s
.trim()
.split(
/^\$\{workspaceFolder\}/i
)
if (p.length > 1) {
p = [
env.workspaceFolder,
...p.slice(1),
]
}
return path.join(
p
.join("")
.split(/[\\/]/gi)
.join("/")
)
}
// print([pathFrom("D:\\sites\\GitHub\\git-user\\repo\\README.md"),pathFrom("${workSpacefolder}\\README.md")])
// utils.print([f,`${env.workspaceFolder}\\README.md`,"D:\\sites\\GitHub\\git-user\\README.md"])
const workspaceFolder =
env.workspaceFolder
const dest = pathFrom(
"<repo local forder>"
)
cmd([
"cmd",
"list silent-off",
`
COPY /Y "${workspaceFolder}\\README.md" "${path.join(
dest,
"README.md"
)}"
cd /D "${dest}"
git config user.email "<your git email>"
git config user.name "<your git name>"
git config core.autocrlf true
git checkout -b main
git remote rm origin
git remote add origin https://<your git name>:<your Personal access token>@github.com/<your git name>/<your git repo>.git
git rm -r --cached <repo force forder for delete> -f
git add ./
git commit -m "main ✨ commit on Save"
git push origin main -u -f
`,
])
})
}
)
vscode.commands.executeCommand(`${env.name}.jumpTo`, (ti: TreeItem) => {})
jumpTo
.More information in the changelog