@ttsc/vscode 0.14.0 → 0.14.2

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
@@ -1,58 +1,124 @@
1
- # `@ttsc/vscode`
1
+ # ttsc for VS Code
2
2
 
3
3
  ![banner of @ttsc/vscode](https://ttsc.dev/og.jpg)
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
- VS Code extension for [`ttsc`](https://ttsc.dev) projects. It shows TypeScript-Go diagnostics and `@ttsc/lint` lint and format inside your editor.
7
+ Bring [`ttsc`](https://ttsc.dev) plugin diagnostics into VS Code.
8
8
 
9
- ## Setup
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.
10
10
 
11
- ### Requirements
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
 
13
- - **VS Code** 1.94 or later
14
- - **Node.js** 18 or later
15
- - **`ttsc`, `@ttsc/lint`, and `@typescript/native-preview` in your project.** `@typescript/native-preview` is the TypeScript-Go engine `ttsc` runs on; it is a separate package that `ttsc` does not bundle.
13
+ ![VS Code showing ttsc lint diagnostics](images/screenshot.png)
14
+
15
+ ## Requirements
16
+
17
+ - **VS Code** 1.94 or later.
18
+ - **Node.js** 18 or later.
19
+ - A workspace with `tsconfig.json` or `jsconfig.json`.
20
+ - Project-installed `ttsc`, `@typescript/native-preview`, and the `ttsc` plugins you want editor diagnostics from.
21
+
22
+ Install the common project dependencies:
16
23
 
17
24
  ```bash
18
- npm install -D ttsc @ttsc/lint @typescript/native-preview
25
+ npm install -D ttsc @typescript/native-preview @ttsc/lint
19
26
  ```
20
27
 
21
- ### Install
28
+ `@ttsc/lint` is optional for TypeScript-Go language features, but required for the lint and format commands shown below.
22
29
 
23
- Not on the VS Code Marketplace yet. Run `npx @ttsc/vscode`; it downloads the package and installs the bundled `.vsix` into VS Code, nothing to keep as a dependency:
30
+ ## Install
31
+
32
+ Install from the VS Code Marketplace by searching `ttsc` and choosing the extension by `samchon`.
33
+
34
+ From a shell, the short installer is:
24
35
 
25
36
  ```bash
26
37
  npx @ttsc/vscode
27
38
  ```
28
39
 
29
- If the `code` CLI isn't on your `PATH`, run **Shell Command: Install 'code' command in PATH** from VS Code's command palette, then re-run `npx @ttsc/vscode`.
40
+ The direct VS Code CLI form is:
41
+
42
+ ```bash
43
+ code --install-extension samchon.ttsc
44
+ ```
45
+
46
+ To uninstall the npm-installed copy:
47
+
48
+ ```bash
49
+ npx @ttsc/vscode uninstall
50
+ ```
51
+
52
+ Both shell commands use the `code` CLI. If it isn't on your `PATH`, run **Shell Command: Install 'code' command in PATH** from VS Code's command palette.
53
+
54
+ ## Configuration
55
+
56
+ ### `lint.config.ts`
57
+
58
+ At the project root, this drives both the lint rules and the formatter. Without it the extension still type-checks, but `@ttsc/lint` diagnostics and formatting do nothing:
59
+
60
+ ```ts
61
+ // lint.config.ts
62
+ import type { ITtscLintConfig } from "@ttsc/lint";
63
+
64
+ export default {
65
+ rules: {
66
+ "no-var": "error",
67
+ "prefer-const": "error",
68
+ "typescript/no-explicit-any": "warning",
69
+ "typescript/no-floating-promises": "error",
70
+ },
71
+ format: {
72
+ printWidth: 100,
73
+ singleQuote: true,
74
+ trailingComma: "all",
75
+ },
76
+ } satisfies ITtscLintConfig;
77
+ ```
30
78
 
31
- ### Format on save
79
+ ### `.vscode/settings.json`
32
80
 
33
- Set `samchon.ttsc` as the default formatter and turn on `editor.formatOnSave` in `.vscode/settings.json`:
81
+ Set `samchon.ttsc` as the default formatter and turn on `editor.formatOnSave`:
34
82
 
35
83
  ```jsonc
36
- "[typescript][typescriptreact]": {
37
- "editor.defaultFormatter": "samchon.ttsc",
38
- "editor.formatOnSave": true
84
+ {
85
+ "[typescript][typescriptreact]": {
86
+ "editor.defaultFormatter": "samchon.ttsc",
87
+ "editor.formatOnSave": true
88
+ }
39
89
  }
40
90
  ```
41
91
 
42
- Lint **fixes** stay off-save by default because they can change code meaning. Run `ttsc: Fix all lint issues` from the command palette, or opt in with `"editor.codeActionsOnSave": { "source.fixAll.ttsc": "explicit" }`.
92
+ Lint fixes stay off-save by default because they can change code meaning. Run `ttsc: Fix all lint issues` from the command palette, or opt in on manual saves:
43
93
 
44
- The format rules come from your project's `lint.config`, so format-on-save does nothing until that config has a `format` block.
94
+ ```jsonc
95
+ {
96
+ "editor.codeActionsOnSave": {
97
+ "source.fixAll.ttsc": "explicit"
98
+ }
99
+ }
100
+ ```
45
101
 
46
102
  ## What it adds
47
103
 
48
104
  - TypeScript-Go diagnostics, hover, navigation, and completions.
49
- - `@ttsc/lint` lint diagnostics, plus `ttsc: Fix all lint issues` and `ttsc: Format document` in the command palette.
50
- - Format on save with `@ttsc/lint`'s rules, shown above.
51
- - Monorepo-aware: each package uses its own `tsconfig` and `lint.config`.
105
+ - `@ttsc/lint` diagnostics and code actions, including `source.fixAll.ttsc`.
106
+ - Diagnostics reported by other LSP-capable `ttsc` plugins.
107
+ - `ttsc: Fix all lint issues`, `ttsc: Format document`, and `ttsc: Restart language server` in the command palette.
108
+ - Format on save with the `format` block from `lint.config.*`.
109
+ - Multi-root workspace support. Each package can use its own `ttsc`, `@typescript/native-preview`, `tsconfig.json`, and `lint.config.*`.
110
+
111
+ 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.
52
112
 
53
113
  ## Troubleshooting
54
114
 
55
- No diagnostics? Confirm `ttsc` runs in the project (`npx ttsc --version`), then check **View → Output → ttsc** for the server log. For LSP tracing, set `ttsc.trace.server` to `"verbose"`.
115
+ No diagnostics? Work through these in order:
116
+
117
+ 1. Confirm the workspace has a `tsconfig.json` or `jsconfig.json`.
118
+ 2. Confirm `ttsc` resolves in the project: `npx ttsc --version`.
119
+ 3. Confirm the project itself checks: `npx ttsc --noEmit`.
120
+ 4. Open **View → Output → ttsc** and read the server log.
121
+ 5. For full LSP tracing, set `ttsc.trace.server` to `"verbose"` and reload the window.
56
122
 
57
123
  ## Sponsors
58
124
 
package/bin/install.js CHANGED
@@ -23,9 +23,16 @@ function createCodeCommand(
23
23
  return {
24
24
  command: env.ComSpec || "cmd.exe",
25
25
  args: ["/d", "/s", "/c", quoteWindowsCommand(["code", ...args])],
26
+ // The `/c` payload is ALREADY fully quoted. Node's Windows spawn escapes
27
+ // each arg again unless told not to, turning `""code" …"` into
28
+ // `"\"\"code\" …\""`, which cmd.exe sees as one un-runnable token (the
29
+ // CVE-2024-27980 argument-escaping change, Node 18.20.2+/20.12.2+). Pass
30
+ // the payload verbatim so cmd's `/s` strips the outer quotes and runs
31
+ // `code …`.
32
+ options: { windowsVerbatimArguments: true },
26
33
  };
27
34
  }
28
- return { command: "code", args };
35
+ return { command: "code", args, options: {} };
29
36
  }
30
37
 
31
38
  function quoteWindowsCommand(args) {
@@ -38,7 +45,10 @@ function quoteWindowsArg(arg) {
38
45
 
39
46
  function spawnCode(args, vsixForFallback) {
40
47
  const command = createCodeCommand(args);
41
- const r = cp.spawnSync(command.command, command.args, { stdio: "inherit" });
48
+ const r = cp.spawnSync(command.command, command.args, {
49
+ stdio: "inherit",
50
+ ...command.options,
51
+ });
42
52
  if (r.error && r.error.code === "ENOENT") {
43
53
  printCodeNotFound(vsixForFallback);
44
54
  process.exit(1);
Binary file
Binary file
package/package.json CHANGED
@@ -1,25 +1,43 @@
1
1
  {
2
2
  "name": "@ttsc/vscode",
3
3
  "displayName": "ttsc",
4
- "description": "Run the project-selected ttscserver in VS Code with TypeScript-Go and ttsc plugin LSP features.",
5
- "version": "0.14.0",
4
+ "description": "Show ttsc plugin diagnostics in VS Code, with @ttsc/lint errors, fix-all actions, and formatter support.",
5
+ "version": "0.14.2",
6
6
  "publisher": "samchon",
7
+ "icon": "images/icon.png",
7
8
  "license": "MIT",
8
9
  "author": "Jeongho Nam",
9
10
  "publishConfig": {
10
11
  "access": "public"
11
12
  },
13
+ "homepage": "https://ttsc.dev",
12
14
  "repository": {
13
15
  "type": "git",
14
16
  "url": "https://github.com/samchon/ttsc",
15
17
  "directory": "packages/vscode"
16
18
  },
19
+ "bugs": {
20
+ "url": "https://github.com/samchon/ttsc/issues"
21
+ },
17
22
  "engines": {
18
23
  "vscode": "^1.94.0",
19
24
  "node": ">=18"
20
25
  },
21
26
  "categories": [
22
- "Programming Languages"
27
+ "Programming Languages",
28
+ "Linters",
29
+ "Formatters"
30
+ ],
31
+ "keywords": [
32
+ "typescript",
33
+ "typescript-go",
34
+ "tsgo",
35
+ "lint",
36
+ "linter",
37
+ "formatter",
38
+ "prettier",
39
+ "lsp",
40
+ "ttsc"
23
41
  ],
24
42
  "extensionKind": [
25
43
  "workspace"
@@ -31,6 +49,7 @@
31
49
  "files": [
32
50
  "bin",
33
51
  "dist",
52
+ "images",
34
53
  "lib",
35
54
  "LICENSE",
36
55
  "README.md"
@@ -81,12 +100,12 @@
81
100
  "devDependencies": {
82
101
  "@types/node": "^25.3.0",
83
102
  "@types/vscode": "^1.94.0",
84
- "@typescript/native-preview": "7.0.0-dev.20260519.1",
103
+ "@typescript/native-preview": "7.0.0-dev.20260421.2",
85
104
  "@vscode/vsce": "^3.6.1",
86
105
  "esbuild": "^0.25.12",
87
106
  "rimraf": "^6.1.2",
88
107
  "vscode-languageclient": "^9.0.1",
89
- "ttsc": "0.14.0"
108
+ "ttsc": "0.14.2"
90
109
  },
91
110
  "scripts": {
92
111
  "build": "rimraf lib dist && node build/build.cjs"