@noldova/terminal 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module.json +4 -4
- package/package.json +6 -6
- package/settings.json +11 -0
- package/src/api/window.d.ts +57 -0
- package/src/api/window.js +1 -1
- package/src/enums/shell-family.js +1 -0
- package/src/models/completion-candidate.js +8 -1
- package/src/models/describe-group.js +11 -0
- package/src/models/known-description.js +18 -0
- package/src/models/program-call.js +15 -0
- package/src/models/tool-command.js +15 -0
- package/src/models/tool-word.js +15 -0
- package/src/resources.js +272 -0
- package/src/runtime-part.js +2 -1
- package/src/services/command-describer.js +133 -0
- package/src/services/command-tracker.js +8 -0
- package/src/services/completion-source.js +85 -52
- package/src/services/posix-shell-adapter.js +14 -1
- package/src/services/powershell-shell-adapter.js +13 -0
- package/src/services/pseudo-terminal.js +9 -3
- package/src/services/shell-adapters.js +11 -4
- package/src/services/shell-integration.js +17 -0
- package/src/services/terminal-host.js +34 -17
- package/src/services/terminal-session.js +15 -3
- package/src/services/wsl-shell-adapter.js +60 -0
package/src/resources.js
CHANGED
|
@@ -11,6 +11,8 @@ import { MarkKind } from "./enums/mark-kind.js";
|
|
|
11
11
|
import { SystemRequirement } from "./enums/system-requirement.js";
|
|
12
12
|
import { PowerShellCmdlet } from "./models/powershell-cmdlet.js";
|
|
13
13
|
import { PowerShellParameter } from "./models/powershell-parameter.js";
|
|
14
|
+
import { ToolCommand } from "./models/tool-command.js";
|
|
15
|
+
import { ToolWord } from "./models/tool-word.js";
|
|
14
16
|
export class Resources {
|
|
15
17
|
static highWatermark = 1_048_576;
|
|
16
18
|
static lowWatermark = 262_144;
|
|
@@ -24,6 +26,7 @@ export class Resources {
|
|
|
24
26
|
static promptDrawWaitMilliseconds = 10_000;
|
|
25
27
|
static foregroundPollMilliseconds = 50;
|
|
26
28
|
static cursorAnswerMilliseconds = 500;
|
|
29
|
+
static cursorRequestFrameMilliseconds = 100;
|
|
27
30
|
static maximumKeptRuns = 100;
|
|
28
31
|
static scrollback = 1_000;
|
|
29
32
|
static terminalHistoryFlags = "w+";
|
|
@@ -61,6 +64,8 @@ export class Resources {
|
|
|
61
64
|
static pathReset = "Path";
|
|
62
65
|
static temporaryFolderProperty = "Temp=";
|
|
63
66
|
static temporaryFolderReset = "Temp";
|
|
67
|
+
static homeProperty = "Home=";
|
|
68
|
+
static homeReset = "Home";
|
|
64
69
|
static maximumPathValueLength = 19_456;
|
|
65
70
|
static namesProperty = "Names=";
|
|
66
71
|
static namesReset = "Names";
|
|
@@ -76,6 +81,8 @@ export class Resources {
|
|
|
76
81
|
static windowsPathListSeparator = ";";
|
|
77
82
|
static optionsProperty = "Options=";
|
|
78
83
|
static optionsBound = "1";
|
|
84
|
+
static folderKeysProperty = "FolderKeys=";
|
|
85
|
+
static folderKeysBound = "1";
|
|
79
86
|
static autocdName = "*/";
|
|
80
87
|
static suffixAliasNameStart = "*.";
|
|
81
88
|
static suffixStart = ".";
|
|
@@ -159,6 +166,7 @@ export class Resources {
|
|
|
159
166
|
static loginArgument = "-l";
|
|
160
167
|
static shellVariable = "SHELL";
|
|
161
168
|
static pathVariable = "PATH";
|
|
169
|
+
static homeVariable = "HOME";
|
|
162
170
|
static pathExtensionsVariable = "PATHEXT";
|
|
163
171
|
static defaultPathExtensions = ".COM;.EXE;.BAT;.CMD";
|
|
164
172
|
static windowsProgramExtension = /\.(?:com|exe|bat|cmd|ps1)$/u;
|
|
@@ -301,12 +309,69 @@ export class Resources {
|
|
|
301
309
|
static npmCommand = "npm";
|
|
302
310
|
static npmRunCommands = ["run", "run-script"];
|
|
303
311
|
static packageFile = "package.json";
|
|
312
|
+
static toolCommands = [
|
|
313
|
+
new ToolCommand("npm", [
|
|
314
|
+
new ToolWord("install", "Install a package and the packages it depends on"), new ToolWord("ci", "Install exactly what package-lock.json locks"),
|
|
315
|
+
new ToolWord("run", "Run a script from package.json"), new ToolWord("test", "Run the test script"), new ToolWord("start", "Run the start script"),
|
|
316
|
+
new ToolWord("stop", "Run the stop script"), new ToolWord("restart", "Run the restart script"), new ToolWord("exec", "Run a command from a package"),
|
|
317
|
+
new ToolWord("uninstall", "Remove a package"), new ToolWord("update", "Update packages to the newest versions their ranges allow"),
|
|
318
|
+
new ToolWord("outdated", "List packages with newer versions"), new ToolWord("ls", "List installed packages"),
|
|
319
|
+
new ToolWord("audit", "Check packages for known vulnerabilities"), new ToolWord("init", "Create a package.json"),
|
|
320
|
+
new ToolWord("pack", "Pack the package into an archive"), new ToolWord("publish", "Publish the package to the registry"),
|
|
321
|
+
new ToolWord("version", "Change the package's version"), new ToolWord("view", "Show a package's registry details"),
|
|
322
|
+
new ToolWord("link", "Link a package folder in place of an installed one"), new ToolWord("prune", "Remove packages nothing depends on"),
|
|
323
|
+
new ToolWord("dedupe", "Reduce duplicate packages"), new ToolWord("rebuild", "Rebuild installed packages"), new ToolWord("cache", "Manage the package cache"),
|
|
324
|
+
new ToolWord("config", "Manage npm's settings"), new ToolWord("explain", "Explain why a package is installed"),
|
|
325
|
+
new ToolWord("search", "Search the registry"), new ToolWord("login", "Sign in to the registry"), new ToolWord("logout", "Sign out of the registry"),
|
|
326
|
+
new ToolWord("whoami", "Show the signed-in user"), new ToolWord("doctor", "Check npm's environment"), new ToolWord("help", "Show npm's help")
|
|
327
|
+
]),
|
|
328
|
+
new ToolCommand("git", [
|
|
329
|
+
new ToolWord("status", "Show the working tree's state"), new ToolWord("add", "Stage changes for the next commit"),
|
|
330
|
+
new ToolWord("commit", "Record the staged changes"), new ToolWord("push", "Send commits to a remote"), new ToolWord("pull", "Fetch and merge from a remote"),
|
|
331
|
+
new ToolWord("fetch", "Download from a remote without merging"), new ToolWord("checkout", "Switch branches or restore files"),
|
|
332
|
+
new ToolWord("switch", "Switch branches"), new ToolWord("branch", "List, create or delete branches"), new ToolWord("merge", "Join another branch into this one"),
|
|
333
|
+
new ToolWord("rebase", "Reapply commits on top of another base"), new ToolWord("log", "Show the commit history"), new ToolWord("diff", "Show changes"),
|
|
334
|
+
new ToolWord("show", "Show a commit or another object"), new ToolWord("restore", "Restore files in the working tree"),
|
|
335
|
+
new ToolWord("reset", "Move the branch to another commit"), new ToolWord("revert", "Record a commit that undoes another"),
|
|
336
|
+
new ToolWord("stash", "Set changes aside"), new ToolWord("tag", "List, create or delete tags"), new ToolWord("remote", "Manage remotes"),
|
|
337
|
+
new ToolWord("clone", "Copy a repository"), new ToolWord("init", "Create a repository"), new ToolWord("cherry-pick", "Apply another commit's changes"),
|
|
338
|
+
new ToolWord("blame", "Show who changed each line"), new ToolWord("clean", "Remove untracked files"), new ToolWord("rm", "Remove files from the index"),
|
|
339
|
+
new ToolWord("mv", "Move or rename a file"), new ToolWord("grep", "Search tracked files"), new ToolWord("bisect", "Find the commit that brought a bug"),
|
|
340
|
+
new ToolWord("reflog", "Show where references have been"), new ToolWord("worktree", "Manage more working trees"), new ToolWord("config", "Manage git's settings")
|
|
341
|
+
]),
|
|
342
|
+
new ToolCommand("dotnet", [
|
|
343
|
+
new ToolWord("build", "Build a project"), new ToolWord("run", "Build and run a project"), new ToolWord("test", "Run a project's tests"),
|
|
344
|
+
new ToolWord("new", "Create a project from a template"), new ToolWord("restore", "Restore a project's dependencies"), new ToolWord("publish", "Publish a project for deployment"),
|
|
345
|
+
new ToolWord("pack", "Pack a project into a NuGet package"), new ToolWord("clean", "Remove a project's build output"), new ToolWord("add", "Add a package or reference"),
|
|
346
|
+
new ToolWord("remove", "Remove a package or reference"), new ToolWord("list", "List a project's packages or references"), new ToolWord("sln", "Manage a solution's projects"),
|
|
347
|
+
new ToolWord("format", "Format code to its style settings"), new ToolWord("watch", "Rebuild and rerun on file changes"), new ToolWord("tool", "Manage .NET tools"),
|
|
348
|
+
new ToolWord("workload", "Manage optional workloads"), new ToolWord("nuget", "Run NuGet commands")
|
|
349
|
+
]),
|
|
350
|
+
new ToolCommand("docker", [
|
|
351
|
+
new ToolWord("run", "Create and start a container"), new ToolWord("ps", "List containers"), new ToolWord("build", "Build an image"),
|
|
352
|
+
new ToolWord("images", "List images"), new ToolWord("pull", "Download an image"), new ToolWord("push", "Upload an image"),
|
|
353
|
+
new ToolWord("exec", "Run a command in a running container"), new ToolWord("logs", "Show a container's logs"), new ToolWord("start", "Start a container"),
|
|
354
|
+
new ToolWord("stop", "Stop a container"), new ToolWord("restart", "Restart a container"), new ToolWord("rm", "Remove a container"),
|
|
355
|
+
new ToolWord("rmi", "Remove an image"), new ToolWord("compose", "Run multi-container applications"), new ToolWord("inspect", "Show an object's details"),
|
|
356
|
+
new ToolWord("cp", "Copy files to or from a container"), new ToolWord("kill", "Kill a running container"), new ToolWord("tag", "Name an image"),
|
|
357
|
+
new ToolWord("network", "Manage networks"), new ToolWord("volume", "Manage volumes"), new ToolWord("system", "Manage Docker itself"),
|
|
358
|
+
new ToolWord("login", "Sign in to a registry"), new ToolWord("logout", "Sign out of a registry")
|
|
359
|
+
])
|
|
360
|
+
];
|
|
361
|
+
static nodeScriptExtensions = [".js", ".mjs", ".cjs", ".ts", ".mts", ".cts"];
|
|
362
|
+
static nodeCommand = "node";
|
|
363
|
+
static npxCommand = "npx";
|
|
364
|
+
static packageBinFolder = ["node_modules", ".bin"];
|
|
365
|
+
static packageBinExtension = /\.(?:cmd|ps1)$/iu;
|
|
304
366
|
static completionCommandMilliseconds = 2_000;
|
|
305
367
|
static completionReadMilliseconds = 1_000;
|
|
306
368
|
static runFolderReadMilliseconds = 1_000;
|
|
307
369
|
static completionConcurrentReads = 2;
|
|
308
370
|
static powerShellOptionsKeys = "\u001b[24~o";
|
|
309
371
|
static zshOptionsKeys = "\u001b[24;7~";
|
|
372
|
+
static powerShellFolderKeys = "\u001b[24~d";
|
|
373
|
+
static zshFolderKeys = "\u001b[23;7~";
|
|
374
|
+
static folderEncoding = "hex";
|
|
310
375
|
static optionsMilliseconds = 500;
|
|
311
376
|
static firstOptionsMilliseconds = 3_500;
|
|
312
377
|
static powerShellLookupMilliseconds = 10_000;
|
|
@@ -316,6 +381,35 @@ export class Resources {
|
|
|
316
381
|
static powerShellLookupModulePathReset = "the session's PSModulePath was reset";
|
|
317
382
|
static powerShellLookupNamesTooLong = "the shell's last list of its names was too long to send";
|
|
318
383
|
static powerShellLookupNamesUnreported = "the shell has sent no list of its names yet";
|
|
384
|
+
static describeMilliseconds = 10_000;
|
|
385
|
+
static maximumDescribedLength = 200;
|
|
386
|
+
static describedNamePattern = /^[\p{L}\p{N}._+@%:,][\p{L}\p{N}._+@%:,-]*$/u;
|
|
387
|
+
static describedSeparator = "\t";
|
|
388
|
+
static whatisScript = "whatis \"$@\" 2>/dev/null; exit 0";
|
|
389
|
+
static whatisScriptName = "describe";
|
|
390
|
+
static whatisDash = /\s+-\s+/u;
|
|
391
|
+
static whatisEntry = /^\s*([^\s(]+)\s*\(([^)]*)\)/u;
|
|
392
|
+
static whatisEntrySeparator = ",";
|
|
393
|
+
static whatisSections = ["1", "8", "6"];
|
|
394
|
+
static whatisRuns = 4;
|
|
395
|
+
static whatisNamesPerRun = 6;
|
|
396
|
+
static describeRetryMilliseconds = 300_000;
|
|
397
|
+
static zshNoStartupArgument = "-f";
|
|
398
|
+
static bashStartupVariable = "BASH_ENV";
|
|
399
|
+
static formatDescribeFailed(count, message) {
|
|
400
|
+
return `The lookup of ${count} ${count === 1 ? "command's description" : "commands' descriptions"} gave up, so they show none: ${message}`;
|
|
401
|
+
}
|
|
402
|
+
static formatPowerShellDescribeScript(names) {
|
|
403
|
+
return `$ErrorActionPreference = 'SilentlyContinue'
|
|
404
|
+
$names = @(${names.map(t => `'${t}'`).join(", ")})
|
|
405
|
+
for ($index = 0; $index -lt $names.Count; $index++) {
|
|
406
|
+
$command = Get-Command -Name $names[$index] | Select-Object -First 1
|
|
407
|
+
if ($command.CommandType -eq 'Alias') { $command = $command.ResolvedCommand }
|
|
408
|
+
if (-not $command) { continue }
|
|
409
|
+
$text = if ($command.CommandType -eq 'Application') { $command.FileVersionInfo.FileDescription } else { (Get-Help -Name $command.Name).Synopsis }
|
|
410
|
+
if ($text -and -not ([string]$text).Trim().StartsWith($command.Name, [StringComparison]::OrdinalIgnoreCase)) { [string]$index + [char]9 + ([string]$text -replace '[\r\n]+', ' ') }
|
|
411
|
+
}`;
|
|
412
|
+
}
|
|
319
413
|
static powerShellLookupNamePattern = /^[\p{L}\p{N}._+@%:,-]+$/u;
|
|
320
414
|
static powerShellImplicitVerb = "Get-";
|
|
321
415
|
static powerShellBuiltins = [
|
|
@@ -325,6 +419,59 @@ export class Resources {
|
|
|
325
419
|
"Select-String", "Set-Content", "Set-Location", "Sort-Object", "Split-Path", "Start-Process", "Stop-Process", "Test-Path", "Where-Object",
|
|
326
420
|
"Write-Host", "Write-Output", "cat", "cd", "cls", "copy", "del", "dir", "echo", "exit", "ls", "md", "move", "pwd", "ren", "rm", "type"
|
|
327
421
|
];
|
|
422
|
+
static powerShellDescriptions = new Map([
|
|
423
|
+
["clear-host", "Clear the screen"],
|
|
424
|
+
["copy-item", "Copy files, folders or other items"],
|
|
425
|
+
["foreach-object", "Run a script block for each object in the pipeline"],
|
|
426
|
+
["get-childitem", "List the files and folders in a location"],
|
|
427
|
+
["get-command", "List the commands PowerShell can run"],
|
|
428
|
+
["get-content", "Read the content of a file"],
|
|
429
|
+
["get-date", "Get the current date and time"],
|
|
430
|
+
["get-help", "Show help about a command or a topic"],
|
|
431
|
+
["get-item", "Get the file, folder or other item at a path"],
|
|
432
|
+
["get-location", "Show the current folder"],
|
|
433
|
+
["get-module", "List the modules loaded or available"],
|
|
434
|
+
["get-process", "List the running processes"],
|
|
435
|
+
["import-module", "Load a module into the session"],
|
|
436
|
+
["invoke-restmethod", "Send a web request and read the response as data"],
|
|
437
|
+
["invoke-webrequest", "Send a web request and get the response"],
|
|
438
|
+
["join-path", "Join a path and a child path into one path"],
|
|
439
|
+
["measure-object", "Count objects or measure their properties"],
|
|
440
|
+
["move-item", "Move or rename files, folders or other items"],
|
|
441
|
+
["new-item", "Create a file, folder or other item"],
|
|
442
|
+
["out-file", "Write the output to a file"],
|
|
443
|
+
["pop-location", "Go back to the folder last saved by Push-Location"],
|
|
444
|
+
["push-location", "Save the current folder and go to another"],
|
|
445
|
+
["remove-item", "Delete files, folders or other items"],
|
|
446
|
+
["rename-item", "Rename an item"],
|
|
447
|
+
["resolve-path", "Resolve wildcards in a path to full paths"],
|
|
448
|
+
["select-object", "Pick properties or objects from the pipeline"],
|
|
449
|
+
["select-string", "Find text in strings or files"],
|
|
450
|
+
["set-content", "Write content to a file, replacing what it held"],
|
|
451
|
+
["set-location", "Change the current folder"],
|
|
452
|
+
["sort-object", "Sort objects by their property values"],
|
|
453
|
+
["split-path", "Get part of a path, such as its parent folder or file name"],
|
|
454
|
+
["start-process", "Start a program or open a file"],
|
|
455
|
+
["stop-process", "Stop running processes"],
|
|
456
|
+
["test-path", "Check whether a path exists"],
|
|
457
|
+
["where-object", "Keep the objects that match a condition"],
|
|
458
|
+
["write-host", "Write text to the screen"],
|
|
459
|
+
["write-output", "Send objects down the pipeline"],
|
|
460
|
+
["cat", "Read the content of a file"],
|
|
461
|
+
["cd", "Change the current folder"],
|
|
462
|
+
["cls", "Clear the screen"],
|
|
463
|
+
["copy", "Copy files, folders or other items"],
|
|
464
|
+
["del", "Delete files, folders or other items"],
|
|
465
|
+
["dir", "List the files and folders in a location"],
|
|
466
|
+
["echo", "Send objects down the pipeline"],
|
|
467
|
+
["ls", "List the files and folders in a location"],
|
|
468
|
+
["move", "Move or rename files, folders or other items"],
|
|
469
|
+
["pwd", "Show the current folder"],
|
|
470
|
+
["ren", "Rename an item"],
|
|
471
|
+
["rm", "Delete files, folders or other items"],
|
|
472
|
+
["type", "Read the content of a file"],
|
|
473
|
+
["md", "Create a folder"]
|
|
474
|
+
]);
|
|
328
475
|
static programFilesVariable = "ProgramFiles";
|
|
329
476
|
static programFilesX86Variable = "ProgramFiles(x86)";
|
|
330
477
|
static localAppDataVariable = "LOCALAPPDATA";
|
|
@@ -350,6 +497,7 @@ export class Resources {
|
|
|
350
497
|
static windowsPowerShellName = "Windows PowerShell";
|
|
351
498
|
static windowsPowerShellPath = ["System32", "WindowsPowerShell", "v1.0", "powershell.exe"];
|
|
352
499
|
static cmdId = "cmd";
|
|
500
|
+
static resizeQuietShellIds = [Resources.windowsPowerShellId, Resources.pwshId, Resources.cmdId];
|
|
353
501
|
static cmdName = "Command Prompt";
|
|
354
502
|
static cmdPath = ["System32", "cmd.exe"];
|
|
355
503
|
static gitBashId = "git-bash";
|
|
@@ -363,6 +511,8 @@ export class Resources {
|
|
|
363
511
|
static wslIdPrefix = "wsl-";
|
|
364
512
|
static wslPath = ["System32", "wsl.exe"];
|
|
365
513
|
static wslDistributionArgument = "-d";
|
|
514
|
+
static wslExecArgument = "--exec";
|
|
515
|
+
static wslShareRoot = "\\\\wsl.localhost\\";
|
|
366
516
|
static wslDockerPrefix = "docker-desktop";
|
|
367
517
|
static wslDefaultFlag = "1";
|
|
368
518
|
static wslOtherFlag = "0";
|
|
@@ -501,6 +651,24 @@ export class Resources {
|
|
|
501
651
|
static commandHasControls = "The value must be one line, without control characters.";
|
|
502
652
|
static noKeys = "The value must not be empty.";
|
|
503
653
|
static bashExecutable = "bash";
|
|
654
|
+
static wslExecutable = "wsl";
|
|
655
|
+
static wslEnvironmentVariable = "WSLENV";
|
|
656
|
+
static wslEnvironmentSeparator = ":";
|
|
657
|
+
static wslPathFlag = "/p";
|
|
658
|
+
static wslStartShell = "/bin/sh";
|
|
659
|
+
static wslStartArgument = "-c";
|
|
660
|
+
static integrationFolderVariable = "NOLDOVA_TERMINAL_FOLDER";
|
|
661
|
+
static shellIntegrationWslStart = `f="$NOLDOVA_TERMINAL_FOLDER"
|
|
662
|
+
unset NOLDOVA_TERMINAL_FOLDER
|
|
663
|
+
s="$(getent passwd "$(id -un)" 2>/dev/null | cut -d: -f7)"
|
|
664
|
+
[ -n "$s" ] || s="\${SHELL:-/bin/sh}"
|
|
665
|
+
case "\${s##*/}" in
|
|
666
|
+
bash) if [ -r "$f/noldova.bash" ]; then exec "$s" --init-file "$f/noldova.bash" -i; fi ;;
|
|
667
|
+
zsh) if [ -r "$f/.zshenv" ]; then unset NOLDOVA_TERMINAL_LOGIN; ZDOTDIR="$f" exec "$s" -l; fi ;;
|
|
668
|
+
esac
|
|
669
|
+
if [ -n "\${NOLDOVA_TERMINAL_NOTE-}" ]; then printf '%s' "$NOLDOVA_TERMINAL_NOTE"; fi
|
|
670
|
+
unset NOLDOVA_TERMINAL_NONCE_FILE NOLDOVA_TERMINAL_LOGIN NOLDOVA_TERMINAL_NOTE
|
|
671
|
+
exec "$s" -l`;
|
|
504
672
|
static zshExecutable = "zsh";
|
|
505
673
|
static pwshExecutable = "pwsh";
|
|
506
674
|
static windowsPowerShellExecutable = "powershell";
|
|
@@ -1128,6 +1296,12 @@ if [ -n "\${__noldova_nonce_read-}" ] && [ -z "\${__noldova_nonce-}" ]; then
|
|
|
1128
1296
|
__noldova_capped_mark "$__noldova_temp" ${Resources.maximumPathValueLength} ${Resources.temporaryFolderProperty} ${Resources.temporaryFolderReset}
|
|
1129
1297
|
fi
|
|
1130
1298
|
fi
|
|
1299
|
+
# The distribution's home, once at the first prompt, in a WSL shell, so the terminal reads ~ in the distribution's own file system.
|
|
1300
|
+
if [ -n "\${WSL_DISTRO_NAME-}" ] && [ -z "\${__noldova_home+set}" ]; then
|
|
1301
|
+
__noldova_home="$HOME"
|
|
1302
|
+
builtin export -n __noldova_home
|
|
1303
|
+
__noldova_capped_mark "$__noldova_home" ${Resources.maximumPathValueLength} ${Resources.homeProperty} ${Resources.homeReset}
|
|
1304
|
+
fi
|
|
1131
1305
|
# bash 5.3's compgen -V lists the names into a variable, with no subshell. An older bash lists them in a subshell, a few milliseconds on
|
|
1132
1306
|
# Linux or macOS, but over 50 in Git Bash, whose fork is slow, so an older Git Bash sends no names and no command shows as missing there.
|
|
1133
1307
|
# Functions starting with _, as bash-completion's hundreds are, are left out; the terminal never shows such a name as missing.
|
|
@@ -1371,6 +1545,10 @@ Remove-Variable -Name __NoldovaProfile -Scope Global -ErrorAction SilentlyContin
|
|
|
1371
1545
|
$Global:__NoldovaOptionsSent = $Global:__NoldovaOptions
|
|
1372
1546
|
$marks += __NoldovaMark 'P' "${Resources.optionsProperty}$(if ($Global:__NoldovaOptions) { '${Resources.optionsBound}' } else { '0' })"
|
|
1373
1547
|
}
|
|
1548
|
+
if ($Global:__NoldovaFolderKeys -ne $Global:__NoldovaFolderKeysSent) {
|
|
1549
|
+
$Global:__NoldovaFolderKeysSent = $Global:__NoldovaFolderKeys
|
|
1550
|
+
$marks += __NoldovaMark 'P' "${Resources.folderKeysProperty}$(if ($Global:__NoldovaFolderKeys) { '${Resources.folderKeysBound}' } else { '0' })"
|
|
1551
|
+
}
|
|
1374
1552
|
$Global:__NoldovaHistoryId = $historyId
|
|
1375
1553
|
$Global:__NoldovaHasPrompted = $true
|
|
1376
1554
|
$text = (& $Global:__NoldovaPrompt) -join ''
|
|
@@ -1423,15 +1601,59 @@ Remove-Variable -Name __NoldovaProfile -Scope Global -ErrorAction SilentlyContin
|
|
|
1423
1601
|
[Console]::Write("$mark$([char] 0x07)")
|
|
1424
1602
|
}
|
|
1425
1603
|
|
|
1604
|
+
# The hidden folder binding reads the folder as UTF-8 in hex digits up to Enter, which nothing shows, moves there and draws the prompt
|
|
1605
|
+
# again, so no command, history entry or echoed line comes of it. Any other key ends it where it is. The keys come from PSReadLine's own
|
|
1606
|
+
# queue, which its reading thread fills, as Console's would race it for them.
|
|
1607
|
+
function Global:__NoldovaChangeFolder {
|
|
1608
|
+
$hex = ''
|
|
1609
|
+
while ($true) {
|
|
1610
|
+
$char = $Global:__NoldovaReadKey.Invoke($null, $null).KeyChar
|
|
1611
|
+
if ([int] $char -in 10, 13) {
|
|
1612
|
+
break
|
|
1613
|
+
}
|
|
1614
|
+
if ("$char" -cnotmatch '^[0-9a-f]$') {
|
|
1615
|
+
return
|
|
1616
|
+
}
|
|
1617
|
+
$hex += $char
|
|
1618
|
+
}
|
|
1619
|
+
try {
|
|
1620
|
+
$bytes = [byte[]] -split ($hex -replace '..', '0x$& ')
|
|
1621
|
+
Set-Location -LiteralPath ([Text.Encoding]::UTF8.GetString($bytes)) -ErrorAction Stop
|
|
1622
|
+
}
|
|
1623
|
+
catch {
|
|
1624
|
+
}
|
|
1625
|
+
# PSReadLine draws the prompt again through Console, in the console's code page, which would turn the folder's name in the prompt and its
|
|
1626
|
+
# mark into a best fit; the shell draws it through the host, in Unicode.
|
|
1627
|
+
$encoding = [Console]::OutputEncoding
|
|
1628
|
+
try {
|
|
1629
|
+
[Console]::OutputEncoding = New-Object Text.UTF8Encoding $false
|
|
1630
|
+
[Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
|
|
1631
|
+
}
|
|
1632
|
+
finally {
|
|
1633
|
+
[Console]::OutputEncoding = $encoding
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1426
1637
|
# Only where PSReadLine reads the line, and not where a profile bound F12 or a chord starting with it, which the chord would take over; each
|
|
1427
1638
|
# prompt reports whether it is in place.
|
|
1428
1639
|
$Global:__NoldovaOptions = $false
|
|
1429
1640
|
$Global:__NoldovaOptionsSent = $false
|
|
1641
|
+
$Global:__NoldovaFolderKeys = $false
|
|
1642
|
+
$Global:__NoldovaFolderKeysSent = $false
|
|
1643
|
+
$Global:__NoldovaReadKey = $null
|
|
1430
1644
|
if (Get-Command -Name Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue) {
|
|
1431
1645
|
try {
|
|
1432
1646
|
if (-not (Get-PSReadLineKeyHandler -Bound | Where-Object { $_.Key -eq 'F12' -or $_.Key -like 'F12,*' })) {
|
|
1433
1647
|
Set-PSReadLineKeyHandler -Chord 'F12,o' -ScriptBlock { __NoldovaOptions } -ErrorAction Stop
|
|
1434
1648
|
$Global:__NoldovaOptions = $true
|
|
1649
|
+
# The folder binding reads keys through PSReadLine's own reader, which ConstrainedLanguage refuses and a version without it lacks.
|
|
1650
|
+
if ($ExecutionContext.SessionState.LanguageMode -eq 'FullLanguage') {
|
|
1651
|
+
$Global:__NoldovaReadKey = [Microsoft.PowerShell.PSConsoleReadLine].GetMethod('ReadKey', [Reflection.BindingFlags] 'NonPublic, Static', $null, [Type[]] @(), $null)
|
|
1652
|
+
}
|
|
1653
|
+
if ($null -ne $Global:__NoldovaReadKey) {
|
|
1654
|
+
Set-PSReadLineKeyHandler -Chord 'F12,d' -ScriptBlock { __NoldovaChangeFolder } -ErrorAction Stop
|
|
1655
|
+
$Global:__NoldovaFolderKeys = $true
|
|
1656
|
+
}
|
|
1435
1657
|
}
|
|
1436
1658
|
}
|
|
1437
1659
|
catch {
|
|
@@ -1559,6 +1781,12 @@ if [[ -n "\${__noldova_nonce_read-}" && -z "\${__noldova_nonce-}" ]]; then
|
|
|
1559
1781
|
builtin typeset -g +x __noldova_path
|
|
1560
1782
|
__noldova_capped_mark "$PATH" ${Resources.maximumPathValueLength} ${Resources.pathProperty} ${Resources.pathReset}
|
|
1561
1783
|
fi
|
|
1784
|
+
# The distribution's home, once at the first prompt, in a WSL shell, so the terminal reads ~ in the distribution's own file system.
|
|
1785
|
+
if [[ -n "\${WSL_DISTRO_NAME-}" && -z "\${__noldova_home+set}" ]]; then
|
|
1786
|
+
__noldova_home="$HOME"
|
|
1787
|
+
builtin typeset -g +x __noldova_home
|
|
1788
|
+
__noldova_capped_mark "$HOME" ${Resources.maximumPathValueLength} ${Resources.homeProperty} ${Resources.homeReset}
|
|
1789
|
+
fi
|
|
1562
1790
|
# The aliases, functions, builtins and keywords, apart by spaces, so the terminal can tell a typed command the shell wouldn't find.
|
|
1563
1791
|
# Functions starting with _, as compinit's completion functions are, are left out; the terminal never shows such a name as missing. Each
|
|
1564
1792
|
# suffix alias adds *.<suffix>, and autocd adds */, as a file with that suffix and a folder's name run too.
|
|
@@ -1588,6 +1816,14 @@ if [[ -n "\${__noldova_nonce_read-}" && -z "\${__noldova_nonce-}" ]]; then
|
|
|
1588
1816
|
__noldova_options_sent="$options"
|
|
1589
1817
|
__noldova_mark P "${Resources.optionsProperty}$options"
|
|
1590
1818
|
fi
|
|
1819
|
+
builtin local folder_keys=0
|
|
1820
|
+
if [[ -o zle ]] && (( \${+widgets[__noldova_change_folder]} )); then
|
|
1821
|
+
folder_keys=${Resources.folderKeysBound}
|
|
1822
|
+
fi
|
|
1823
|
+
if [[ "$folder_keys" != "\${__noldova_folder_keys_sent-0}" ]]; then
|
|
1824
|
+
__noldova_folder_keys_sent="$folder_keys"
|
|
1825
|
+
__noldova_mark P "${Resources.folderKeysProperty}$folder_keys"
|
|
1826
|
+
fi
|
|
1591
1827
|
__noldova_escape "$PWD" escaped
|
|
1592
1828
|
__noldova_mark P "Cwd=$escaped"
|
|
1593
1829
|
if (( __noldova_in_command )); then
|
|
@@ -1676,6 +1912,28 @@ if [[ -n "\${__noldova_nonce_read-}" && -z "\${__noldova_nonce-}" ]]; then
|
|
|
1676
1912
|
builtin printf '%s\\007' "$mark"
|
|
1677
1913
|
}
|
|
1678
1914
|
|
|
1915
|
+
# The hidden folder binding reads the folder as UTF-8 in hex digits up to Enter, which nothing shows, moves there, runs the prompt hooks and
|
|
1916
|
+
# draws the prompt again, so no command, history entry or echoed line comes of it. Any other key ends it where it is.
|
|
1917
|
+
__noldova_change_folder() {
|
|
1918
|
+
builtin setopt local_options no_xtrace extended_glob
|
|
1919
|
+
builtin local hex= key folder hook
|
|
1920
|
+
while :; do
|
|
1921
|
+
builtin read -k 1 key || builtin return 0
|
|
1922
|
+
[[ "$key" == $'\\r' || "$key" == $'\\n' ]] && builtin break
|
|
1923
|
+
[[ "$key" == [0-9a-f] ]] || builtin return 0
|
|
1924
|
+
hex+="$key"
|
|
1925
|
+
done
|
|
1926
|
+
builtin printf -v folder '%b' "\${hex//(#m)??/\\\\x$MATCH}"
|
|
1927
|
+
builtin cd -- "$folder" 2>/dev/null
|
|
1928
|
+
if (( \${+functions[precmd]} )); then
|
|
1929
|
+
precmd
|
|
1930
|
+
fi
|
|
1931
|
+
for hook in $precmd_functions; do
|
|
1932
|
+
"$hook"
|
|
1933
|
+
done
|
|
1934
|
+
builtin zle reset-prompt
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1679
1937
|
# Not where the person's startup files bound Ctrl+Alt+F12 in one of the keymaps, which the binding would take over.
|
|
1680
1938
|
if [[ -o zle ]]; then
|
|
1681
1939
|
__noldova_options_free=1
|
|
@@ -1691,6 +1949,20 @@ if [[ -n "\${__noldova_nonce_read-}" && -z "\${__noldova_nonce-}" ]]; then
|
|
|
1691
1949
|
fi
|
|
1692
1950
|
builtin unset __noldova_keymap __noldova_options_free
|
|
1693
1951
|
fi
|
|
1952
|
+
# The folder binding is Ctrl+Alt+F11, on the same terms.
|
|
1953
|
+
if [[ -o zle ]]; then
|
|
1954
|
+
__noldova_folder_free=1
|
|
1955
|
+
for __noldova_keymap in emacs viins vicmd; do
|
|
1956
|
+
[[ "$(builtin bindkey -M "$__noldova_keymap" '\\e[23;7~' 2>/dev/null)" == *' undefined-key' ]] || __noldova_folder_free=0
|
|
1957
|
+
done
|
|
1958
|
+
if (( __noldova_folder_free )); then
|
|
1959
|
+
builtin zle -N __noldova_change_folder
|
|
1960
|
+
for __noldova_keymap in emacs viins vicmd; do
|
|
1961
|
+
builtin bindkey -M "$__noldova_keymap" '\\e[23;7~' __noldova_change_folder
|
|
1962
|
+
done
|
|
1963
|
+
fi
|
|
1964
|
+
builtin unset __noldova_keymap __noldova_folder_free
|
|
1965
|
+
fi
|
|
1694
1966
|
|
|
1695
1967
|
precmd_functions=(__noldova_capture $precmd_functions __noldova_precmd)
|
|
1696
1968
|
preexec_functions+=(__noldova_preexec)
|
package/src/runtime-part.js
CHANGED
|
@@ -14,6 +14,7 @@ import { RequestClient } from "./models/request-client.js";
|
|
|
14
14
|
import { TerminalEvents } from "./models/terminal-events.js";
|
|
15
15
|
import { Resources } from "./resources.js";
|
|
16
16
|
import { AgentTerminals } from "./services/agent-terminals.js";
|
|
17
|
+
import { CommandDescriber } from "./services/command-describer.js";
|
|
17
18
|
import { CommandRunner } from "./services/command-runner.js";
|
|
18
19
|
import { CompletionSource } from "./services/completion-source.js";
|
|
19
20
|
import { ContextPtySpawner } from "./services/context-pty-spawner.js";
|
|
@@ -54,7 +55,7 @@ export class RuntimePart {
|
|
|
54
55
|
environment.start();
|
|
55
56
|
try {
|
|
56
57
|
const events = new TerminalEvents(context.declareEvent(TerminalNames.outputEvent), context.declareEvent(TerminalNames.exitedEvent), context.declareEvent(TerminalNames.restartedEvent), context.declareEvent(TerminalNames.titleChangedEvent), context.declareEvent(TerminalNames.cwdChangedEvent), context.declareEvent(TerminalNames.detachedEvent), context.declareEvent(TerminalNames.closedEvent), context.declareEvent(TerminalNames.openedEvent), context.declareEvent(TerminalNames.launchCommandEndedEvent), context.declareEvent(TerminalNames.runOpenedEvent), context.declareEvent(TerminalNames.runEndedEvent), context.declareEvent(TerminalNames.renamedEvent), context.declareEvent(TerminalNames.commandAddedEvent), context.declareEvent(TerminalNames.commandStartedEvent), context.declareEvent(TerminalNames.outputStartedEvent), context.declareEvent(TerminalNames.outputPrintedEvent), context.declareEvent(TerminalNames.commandEndedEvent), context.declareEvent(TerminalNames.promptStartedEvent), context.declareEvent(TerminalNames.screenChangedEvent));
|
|
57
|
-
const host = new TerminalHost(new ContextPtySpawner(context), reader, new ShellIntegration(writer, tmpdir(), context.log, access, context.settings, process.platform), new TerminalHistoryFolder(writer, reader, signaller, tmpdir(), process.pid, context.log, access), new ShellLocator(process.platform, process.arch, process.env, ShellLocator.readUserShell(), reader, runner, context.log), process.platform, release(), new LatestEnvironment(environment, process.env), homedir(), context.log, events, new SavedTerminals(context.database, context.log), new CompletionSource(reader, runner, process.platform, homedir(), context.log));
|
|
58
|
+
const host = new TerminalHost(new ContextPtySpawner(context), reader, new ShellIntegration(writer, tmpdir(), context.log, access, context.settings, process.platform), new TerminalHistoryFolder(writer, reader, signaller, tmpdir(), process.pid, context.log, access), new ShellLocator(process.platform, process.arch, process.env, ShellLocator.readUserShell(), reader, runner, context.log), process.platform, release(), new LatestEnvironment(environment, process.env), homedir(), context.log, events, new SavedTerminals(context.database, context.log), new CompletionSource(reader, runner, process.platform, homedir(), context.log), new CommandDescriber(runner, context.log));
|
|
58
59
|
for (const name of TerminalNames.methods)
|
|
59
60
|
context.registerMethod(name, { handleAsync: t => host.handleAsync(name, t.payload, RequestClient.fromContext(t)) });
|
|
60
61
|
context.onClientClosed(t => host.closeConnectionAsync(t.connection, t.window));
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { TerminalCommandDescription, TerminalCommandDescriptions, TerminalShellKind } from "@noldova/terminal.protocol";
|
|
9
|
+
import { CommandFailedException } from "../exceptions/command-failed.exception.js";
|
|
10
|
+
import { DescribeGroup } from "../models/describe-group.js";
|
|
11
|
+
import { KnownDescription } from "../models/known-description.js";
|
|
12
|
+
import { Resources } from "../resources.js";
|
|
13
|
+
export class CommandDescriber {
|
|
14
|
+
runner;
|
|
15
|
+
log;
|
|
16
|
+
known = new Map();
|
|
17
|
+
constructor(runner, log) {
|
|
18
|
+
this.runner = runner;
|
|
19
|
+
this.log = log;
|
|
20
|
+
}
|
|
21
|
+
async describeAsync(kind, program, names, environment) {
|
|
22
|
+
const asked = [...new Set(names)].filter(t => Resources.describedNamePattern.test(t));
|
|
23
|
+
const isPowerShell = kind === TerminalShellKind.PowerShell;
|
|
24
|
+
if (!isPowerShell && kind !== TerminalShellKind.Bash && kind !== TerminalShellKind.Zsh)
|
|
25
|
+
return new TerminalCommandDescriptions([]);
|
|
26
|
+
const perRun = isPowerShell ? Number.POSITIVE_INFINITY : Resources.whatisNamesPerRun;
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
const groups = [];
|
|
29
|
+
const describe = name => {
|
|
30
|
+
const own = isPowerShell ? Resources.powerShellDescriptions.get(name.toLowerCase()) : undefined;
|
|
31
|
+
if (!Object.isUndefined(own))
|
|
32
|
+
return Promise.resolve(own);
|
|
33
|
+
const key = JSON.stringify([kind, program, isPowerShell ? name.toLowerCase() : name]);
|
|
34
|
+
const known = this.known.get(key);
|
|
35
|
+
if (!Object.isUndefined(known) && known.isFresh(now))
|
|
36
|
+
return known.description;
|
|
37
|
+
let group = groups.at(-1);
|
|
38
|
+
if (Object.isUndefined(group) || group.names.length === perRun) {
|
|
39
|
+
group = new DescribeGroup();
|
|
40
|
+
groups.push(group);
|
|
41
|
+
}
|
|
42
|
+
group.names.push(name);
|
|
43
|
+
const entry = new KnownDescription(group.answer.promise.then(t => {
|
|
44
|
+
if (!Object.isNull(t))
|
|
45
|
+
return t.get(name) ?? null;
|
|
46
|
+
entry.failedAt = Date.now();
|
|
47
|
+
return null;
|
|
48
|
+
}, (error) => {
|
|
49
|
+
this.known.delete(key);
|
|
50
|
+
throw error;
|
|
51
|
+
}));
|
|
52
|
+
this.known.set(key, entry);
|
|
53
|
+
return entry.description;
|
|
54
|
+
};
|
|
55
|
+
const pending = asked.map(async (name) => {
|
|
56
|
+
const description = await describe(name);
|
|
57
|
+
return Object.isNull(description) ? null : new TerminalCommandDescription(name, description);
|
|
58
|
+
});
|
|
59
|
+
const shellEnvironment = Object.fromEntries(Object.entries(environment)
|
|
60
|
+
.filter(([t]) => t !== Resources.bashStartupVariable));
|
|
61
|
+
for (let lane = 0; lane < Resources.whatisRuns; lane++)
|
|
62
|
+
void this.runAsync(groups.filter((_t, i) => i % Resources.whatisRuns === lane), kind, program, shellEnvironment);
|
|
63
|
+
const items = await Promise.all(pending);
|
|
64
|
+
return new TerminalCommandDescriptions(items.flatMap(t => Object.isNull(t) ? [] : [t]));
|
|
65
|
+
}
|
|
66
|
+
async runAsync(groups, kind, program, environment) {
|
|
67
|
+
for (const group of groups) {
|
|
68
|
+
try {
|
|
69
|
+
group.answer.resolve(await this.lookUpAsync(kind, program, group.names, environment));
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
group.answer.reject(error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async lookUpAsync(kind, program, names, environment) {
|
|
77
|
+
try {
|
|
78
|
+
if (kind === TerminalShellKind.PowerShell) {
|
|
79
|
+
const output = await this.runner.runAsync(program, [...Resources.environmentReadArguments,
|
|
80
|
+
Buffer.from(Resources.formatPowerShellDescribeScript(names), Resources.utf16Encoding).toString(Resources.base64Encoding)], Resources.describeMilliseconds, environment);
|
|
81
|
+
return CommandDescriber.readPowerShell(output, names);
|
|
82
|
+
}
|
|
83
|
+
const output = await this.runner.runAsync(program, [...kind === TerminalShellKind.Zsh ? [Resources.zshNoStartupArgument] : [],
|
|
84
|
+
...Resources.posixOneShotArguments, Resources.whatisScript, Resources.whatisScriptName, ...names], Resources.describeMilliseconds, environment);
|
|
85
|
+
return CommandDescriber.readWhatis(output, names);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (!(error instanceof CommandFailedException))
|
|
89
|
+
throw error;
|
|
90
|
+
this.log.write(Resources.formatDescribeFailed(names.length, error.message));
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
static readPowerShell(output, names) {
|
|
95
|
+
const found = new Map();
|
|
96
|
+
for (const line of output.split(Resources.lineBreaks)) {
|
|
97
|
+
const tab = line.indexOf(Resources.describedSeparator);
|
|
98
|
+
const index = Number(line.slice(0, tab));
|
|
99
|
+
const name = names[index];
|
|
100
|
+
const description = tab > 0 ? CommandDescriber.toLine(line.slice(tab + 1)) : null;
|
|
101
|
+
if (!Object.isUndefined(name) && !Object.isNull(description))
|
|
102
|
+
found.set(name, description);
|
|
103
|
+
}
|
|
104
|
+
return found;
|
|
105
|
+
}
|
|
106
|
+
static readWhatis(output, names) {
|
|
107
|
+
const asked = new Set(names);
|
|
108
|
+
const found = new Map();
|
|
109
|
+
const ranks = new Map();
|
|
110
|
+
for (const line of output.split(Resources.lineBreaks)) {
|
|
111
|
+
const dash = Resources.whatisDash.exec(line);
|
|
112
|
+
const description = Object.isNull(dash) ? null : CommandDescriber.toLine(line.slice(dash.index + dash[0].length));
|
|
113
|
+
if (Object.isNull(dash) || Object.isNull(description))
|
|
114
|
+
continue;
|
|
115
|
+
for (const [index, entry] of line.slice(0, dash.index).split(Resources.whatisEntrySeparator).entries()) {
|
|
116
|
+
const page = Resources.whatisEntry.exec(entry);
|
|
117
|
+
const name = page?.[1] ?? "";
|
|
118
|
+
const section = page?.[2] ?? "";
|
|
119
|
+
const rank = Resources.whatisSections.findIndex(t => section.startsWith(t));
|
|
120
|
+
const order = (rank < 0 ? Resources.whatisSections.length : rank) * 2 + (index === 0 ? 0 : 1);
|
|
121
|
+
if (asked.has(name) && order < (ranks.get(name) ?? Number.POSITIVE_INFINITY)) {
|
|
122
|
+
found.set(name, description);
|
|
123
|
+
ranks.set(name, order);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return found;
|
|
128
|
+
}
|
|
129
|
+
static toLine(text) {
|
|
130
|
+
const line = text.replace(Resources.controlCharacters, " ").replace(Resources.whitespaceRuns, " ").trim();
|
|
131
|
+
return line.length === 0 ? null : [...line].slice(0, Resources.maximumDescribedLength).join("");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -27,12 +27,14 @@ export class CommandTracker {
|
|
|
27
27
|
path = null;
|
|
28
28
|
isPathReset = false;
|
|
29
29
|
temporaryFolder = null;
|
|
30
|
+
home = null;
|
|
30
31
|
modulePath = null;
|
|
31
32
|
isModulePathReset = false;
|
|
32
33
|
names = null;
|
|
33
34
|
isNamesReset = false;
|
|
34
35
|
builtins = null;
|
|
35
36
|
hasOptionsBinding = false;
|
|
37
|
+
hasFolderBinding = false;
|
|
36
38
|
isLoaded = false;
|
|
37
39
|
lastCommand = null;
|
|
38
40
|
prompts = 0;
|
|
@@ -106,6 +108,10 @@ export class CommandTracker {
|
|
|
106
108
|
this.temporaryFolder = mark.value.slice(Resources.temporaryFolderProperty.length);
|
|
107
109
|
else if (mark.value === Resources.temporaryFolderReset)
|
|
108
110
|
this.temporaryFolder = null;
|
|
111
|
+
else if (mark.value?.startsWith(Resources.homeProperty) === true)
|
|
112
|
+
this.home = mark.value.slice(Resources.homeProperty.length);
|
|
113
|
+
else if (mark.value === Resources.homeReset)
|
|
114
|
+
this.home = null;
|
|
109
115
|
else if (mark.value?.startsWith(Resources.modulePathProperty) === true) {
|
|
110
116
|
this.modulePath = mark.value.slice(Resources.modulePathProperty.length);
|
|
111
117
|
this.isModulePathReset = false;
|
|
@@ -128,6 +134,8 @@ export class CommandTracker {
|
|
|
128
134
|
this.builtins = null;
|
|
129
135
|
else if (mark.value?.startsWith(Resources.optionsProperty) === true)
|
|
130
136
|
this.hasOptionsBinding = mark.value.slice(Resources.optionsProperty.length) === Resources.optionsBound;
|
|
137
|
+
else if (mark.value?.startsWith(Resources.folderKeysProperty) === true)
|
|
138
|
+
this.hasFolderBinding = mark.value.slice(Resources.folderKeysProperty.length) === Resources.folderKeysBound;
|
|
131
139
|
break;
|
|
132
140
|
}
|
|
133
141
|
}
|