@ttsc/vscode 0.19.3 → 0.20.0

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/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/ttsc/blob/master/LICENSE) [![NPM Version](https://img.shields.io/npm/v/@ttsc/vscode.svg)](https://www.npmjs.com/package/@ttsc/vscode) [![NPM Downloads](https://img.shields.io/npm/dm/@ttsc/vscode.svg)](https://www.npmjs.com/package/@ttsc/vscode) [![Build Status](https://github.com/samchon/ttsc/workflows/test/badge.svg)](https://github.com/samchon/ttsc/actions?query=workflow%3Atest) [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://ttsc.dev/docs) [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
6
6
 
7
- Bring [`ttsc`](https://ttsc.dev) plugin diagnostics into VS Code.
7
+ Bring TypeScript-Go and supported [`ttsc`](https://ttsc.dev) plugin features into one VS Code session.
8
8
 
9
- When `@ttsc/lint` or another LSP-capable `ttsc` plugin like `typia` reports a compile-time diagnostic, this extension shows it in the editor next to normal TypeScript errors.
9
+ The extension keeps TypeScript-Go completion and diagnostics in one `ttscserver` stream with `@ttsc/lint` diagnostics, suggestions, fix-all actions, formatting, and completion published by lint project rules.
10
10
 
11
11
  Use it when the project already runs `ttsc`. Add `@ttsc/lint` when you also want lint diagnostics, fix-all actions, and formatting in the editor.
12
12
 
@@ -102,7 +102,8 @@ Lint fixes stay off-save by default because they can change code meaning. Run `t
102
102
  ## What it adds
103
103
 
104
104
  - TypeScript-Go diagnostics, hover, navigation, and completions.
105
- - `@ttsc/lint` diagnostics and code actions, including `source.fixAll.ttsc`.
105
+ - `@ttsc/lint` diagnostics, suggestions, code actions, and `source.fixAll.ttsc`.
106
+ - JSDoc completion from a built-in lint rule and project-indexed completion from contributor rules that publish it.
106
107
  - Diagnostics reported by other LSP-capable `ttsc` plugins.
107
108
  - `ttsc: Fix all lint issues`, `ttsc: Format document`, and `ttsc: Restart language server` in the command palette.
108
109
  - Format on save with the `format` block from `lint.config.*`.
@@ -110,6 +111,8 @@ Lint fixes stay off-save by default because they can change code meaning. Run `t
110
111
 
111
112
  Save the file before relying on lint diagnostics or running the command-palette lint and format commands. Format-on-save works on the live editor buffer.
112
113
 
114
+ Completion uses the live editor buffer. Enable `jsdoc/check-tag-names` to try built-in lint completion inside a `/** ... */` block. The [Lint in VS Code guide](https://ttsc.dev/docs/lint/editor) covers that workflow and contributor project indexes.
115
+
113
116
  ## Troubleshooting
114
117
 
115
118
  No diagnostics? Work through these in order:
@@ -120,6 +123,8 @@ No diagnostics? Work through these in order:
120
123
  4. Open **View → Output → ttsc** and read the server log.
121
124
  5. For full LSP tracing, set `ttsc.trace.server` to `"verbose"` and reload the window.
122
125
 
126
+ If diagnostics work but lint completion does not, press Ctrl+Space after `@` inside a JSDoc block. After changing the lint config or project-indexed inputs, save the file: the completion corpus is rediscovered in the background on save. `ttsc: Restart language server` is still needed for a completion trigger character the session never advertised, which the **ttsc** output channel names when it appears.
127
+
123
128
  ## Sponsors
124
129
 
125
130
  [![Sponsors](https://raw.githubusercontent.com/samchon/sponsor-images/refs/heads/master/public/circle.png)](https://github.com/sponsors/samchon)
package/bin/install.js CHANGED
@@ -22,15 +22,19 @@ function createCodeCommand(
22
22
  ) {
23
23
  if (platform === "win32") {
24
24
  const launcher = findWindowsCodeCommand(env, deps);
25
+ const commandShim = createWindowsCommandShim([launcher, ...args]);
25
26
  return {
26
27
  command: env.ComSpec || "cmd.exe",
27
- args: ["/d", "/s", "/c", quoteWindowsCommand([launcher, ...args])],
28
+ args: ["/d", "/s", "/c", commandShim.payload],
28
29
  // The `/c` payload is already fully quoted. Node's Windows spawn escapes
29
30
  // each arg again unless told not to, turning `""code.cmd" ...` into
30
31
  // `"\"\"code.cmd\" ...\""`, which cmd.exe sees as one un-runnable token
31
32
  // after the CVE-2024-27980 argument-escaping change. Pass the payload
32
33
  // verbatim so cmd's `/s` strips the outer quotes and runs `code.cmd ...`.
33
- options: { windowsVerbatimArguments: true },
34
+ options: {
35
+ env: { ...env, ...commandShim.environment },
36
+ windowsVerbatimArguments: true,
37
+ },
34
38
  };
35
39
  }
36
40
  return { command: "code", args, options: {} };
@@ -78,12 +82,24 @@ function findWindowsCodeCommand(env = process.env, deps = {}) {
78
82
  return candidates.find((candidate) => existsSync(candidate)) ?? "code.cmd";
79
83
  }
80
84
 
81
- function quoteWindowsCommand(args) {
82
- return `"${args.map(quoteWindowsArg).join(" ")}"`;
85
+ function createWindowsCommandShim(args) {
86
+ const prefix = "TTSC_VSCODE_COMMAND_SHIM_ARG_";
87
+ const environment = Object.fromEntries(
88
+ args.map((arg, index) => [prefix + index, quoteWindowsArg(arg)]),
89
+ );
90
+ return {
91
+ environment,
92
+ // cmd expands every placeholder exactly once. The environment values are
93
+ // already Windows-command-line arguments, so their literal `%` segments do
94
+ // not expand again and their quotes continue to protect shell metacharacters.
95
+ payload: `"${args.map((_, index) => `%${prefix}${index}%`).join(" ")}"`,
96
+ };
83
97
  }
84
98
 
85
99
  function quoteWindowsArg(arg) {
86
- return `"${String(arg).replace(/"/g, '\\"').replace(/%/g, "%%")}"`;
100
+ return `"${String(arg)
101
+ .replace(/(\\*)"/g, "$1$1\\\"")
102
+ .replace(/(\\*)$/, "$1$1")}"`;
87
103
  }
88
104
 
89
105
  function spawnCode(args, vsixForFallback) {
@@ -160,5 +176,4 @@ module.exports = {
160
176
  findWindowsCodeCommand,
161
177
  findVsix,
162
178
  main,
163
- quoteWindowsCommand,
164
179
  };
package/lib/extension.js CHANGED
@@ -18271,9 +18271,11 @@ function createServerLaunchCommand(launcher, candidate, platform = process.platf
18271
18271
  return { command: process.execPath, args: [launcher, ...args] };
18272
18272
  }
18273
18273
  if (platform === "win32" && isWindowsCommandLauncher(launcher)) {
18274
+ const commandShim = createWindowsCommandShim([launcher, ...args]);
18274
18275
  return {
18275
18276
  command: env.ComSpec || "cmd.exe",
18276
- args: ["/d", "/s", "/c", quoteWindowsCommand([launcher, ...args])],
18277
+ args: ["/d", "/s", "/c", commandShim.payload],
18278
+ commandShimEnvironment: commandShim.environment,
18277
18279
  windowsVerbatimArguments: true
18278
18280
  };
18279
18281
  }
@@ -18285,12 +18287,13 @@ function createServerExecutable(launcher, candidate, platform = process.platform
18285
18287
  return {
18286
18288
  command: launch.command,
18287
18289
  args: launch.args,
18288
- options: options && launch.windowsVerbatimArguments ? { ...options, windowsVerbatimArguments: true } : options
18290
+ options: options && launch.windowsVerbatimArguments ? {
18291
+ ...options,
18292
+ env: { ...options.env, ...launch.commandShimEnvironment },
18293
+ windowsVerbatimArguments: true
18294
+ } : options
18289
18295
  };
18290
18296
  }
18291
- function quoteWindowsCommand(args) {
18292
- return `"${args.map(quoteWindowsArg).join(" ")}"`;
18293
- }
18294
18297
  function createDocumentSelectorPattern(ctor, root) {
18295
18298
  return new ctor(root, "**/*");
18296
18299
  }
@@ -18413,8 +18416,21 @@ function isJavaScriptLauncher(launcher) {
18413
18416
  function isWindowsCommandLauncher(launcher) {
18414
18417
  return [".cmd", ".bat"].includes(import_node_path.default.extname(launcher).toLowerCase());
18415
18418
  }
18419
+ function createWindowsCommandShim(args) {
18420
+ const prefix = "TTSC_VSCODE_COMMAND_SHIM_ARG_";
18421
+ const environment = Object.fromEntries(
18422
+ args.map((arg, index) => [prefix + index, quoteWindowsArg(arg)])
18423
+ );
18424
+ return {
18425
+ environment,
18426
+ // cmd expands every placeholder exactly once. The environment values are
18427
+ // already Windows-command-line arguments, so their literal `%` segments do
18428
+ // not expand again and their quotes continue to protect shell metacharacters.
18429
+ payload: `"${args.map((_, index) => `%${prefix}${index}%`).join(" ")}"`
18430
+ };
18431
+ }
18416
18432
  function quoteWindowsArg(arg) {
18417
- return `"${String(arg).replace(/"/g, '\\"').replace(/%/g, "%%")}"`;
18433
+ return `"${String(arg).replace(/(\\*)"/g, '$1$1\\"').replace(/(\\*)$/, "$1$1")}"`;
18418
18434
  }
18419
18435
  function resolveTsgoBinary(base) {
18420
18436
  try {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ttsc/vscode",
3
3
  "displayName": "ttsc",
4
- "description": "Show ttsc plugin diagnostics in VS Code, with @ttsc/lint errors, fix-all actions, and formatter support.",
5
- "version": "0.19.3",
4
+ "description": "TypeScript-Go and ttsc plugin diagnostics, completions, lint actions, and formatting for VS Code.",
5
+ "version": "0.20.0",
6
6
  "publisher": "samchon",
7
7
  "icon": "images/icon.png",
8
8
  "license": "MIT",
@@ -105,7 +105,7 @@
105
105
  "rimraf": "^6.1.2",
106
106
  "typescript": "^7.0.2",
107
107
  "vscode-languageclient": "^9.0.1",
108
- "ttsc": "0.19.3"
108
+ "ttsc": "0.20.0"
109
109
  },
110
110
  "scripts": {
111
111
  "build": "rimraf lib dist && node build/build.cjs"