@ttsc/vscode 0.14.0-dev.20260529.2 → 0.14.1
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,59 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ttsc for VS Code
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
[](https://github.com/samchon/ttsc/blob/master/LICENSE) [](https://www.npmjs.com/package/@ttsc/vscode) [](https://www.npmjs.com/package/@ttsc/vscode) [](https://github.com/samchon/ttsc/actions?query=workflow%3Atest) [](https://ttsc.dev/docs) [](https://discord.gg/E94XhzrUCZ)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Bring [`ttsc`](https://ttsc.dev) plugin diagnostics into VS Code.
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+

|
|
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 @
|
|
25
|
+
npm install -D ttsc @typescript/native-preview @ttsc/lint
|
|
19
26
|
```
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
`@ttsc/lint` is optional for TypeScript-Go language features, but required for the lint and format commands shown below.
|
|
22
29
|
|
|
23
|
-
|
|
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
|
-
npm install -D @ttsc/vscode
|
|
27
37
|
npx @ttsc/vscode
|
|
28
38
|
```
|
|
29
39
|
|
|
30
|
-
|
|
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
|
+
```
|
|
31
78
|
|
|
32
|
-
###
|
|
79
|
+
### `.vscode/settings.json`
|
|
33
80
|
|
|
34
|
-
Set `samchon.ttsc` as the default formatter and turn on `editor.formatOnSave
|
|
81
|
+
Set `samchon.ttsc` as the default formatter and turn on `editor.formatOnSave`:
|
|
35
82
|
|
|
36
83
|
```jsonc
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
84
|
+
{
|
|
85
|
+
"[typescript][typescriptreact]": {
|
|
86
|
+
"editor.defaultFormatter": "samchon.ttsc",
|
|
87
|
+
"editor.formatOnSave": true
|
|
88
|
+
}
|
|
40
89
|
}
|
|
41
90
|
```
|
|
42
91
|
|
|
43
|
-
Lint
|
|
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:
|
|
44
93
|
|
|
45
|
-
|
|
94
|
+
```jsonc
|
|
95
|
+
{
|
|
96
|
+
"editor.codeActionsOnSave": {
|
|
97
|
+
"source.fixAll.ttsc": "explicit"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
46
101
|
|
|
47
102
|
## What it adds
|
|
48
103
|
|
|
49
104
|
- TypeScript-Go diagnostics, hover, navigation, and completions.
|
|
50
|
-
- `@ttsc/lint`
|
|
51
|
-
-
|
|
52
|
-
-
|
|
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.
|
|
53
112
|
|
|
54
113
|
## Troubleshooting
|
|
55
114
|
|
|
56
|
-
No diagnostics?
|
|
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.
|
|
57
122
|
|
|
58
123
|
## Sponsors
|
|
59
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) {
|
|
@@ -36,17 +43,25 @@ function quoteWindowsArg(arg) {
|
|
|
36
43
|
return `"${String(arg).replace(/"/g, '\\"').replace(/%/g, "%%")}"`;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
function
|
|
46
|
+
function spawnCode(args, vsixForFallback) {
|
|
40
47
|
const command = createCodeCommand(args);
|
|
41
|
-
const r = cp.spawnSync(command.command, command.args, {
|
|
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);
|
|
45
55
|
}
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
return r.status ?? 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function runCode(args, vsixForFallback) {
|
|
60
|
+
const status = spawnCode(args, vsixForFallback);
|
|
61
|
+
if (process.platform === "win32" && status !== 0) {
|
|
62
|
+
printCodeFailed(status, vsixForFallback);
|
|
48
63
|
}
|
|
49
|
-
process.exit(
|
|
64
|
+
process.exit(status);
|
|
50
65
|
}
|
|
51
66
|
|
|
52
67
|
function printCodeNotFound(vsixForFallback) {
|
|
@@ -81,6 +96,9 @@ function main(argv = process.argv.slice(2)) {
|
|
|
81
96
|
);
|
|
82
97
|
process.exit(1);
|
|
83
98
|
}
|
|
99
|
+
// Remove any previously installed version first so versions do not pile up
|
|
100
|
+
// in VS Code. Ignore its exit status: the extension may not be installed.
|
|
101
|
+
spawnCode(["--uninstall-extension", extensionId], vsix);
|
|
84
102
|
runCode(["--install-extension", vsix, "--force"], vsix);
|
|
85
103
|
} else if (sub === "uninstall") {
|
|
86
104
|
runCode(["--uninstall-extension", extensionId]);
|
|
Binary file
|
package/images/icon.png
ADDED
|
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": "
|
|
5
|
-
"version": "0.14.
|
|
4
|
+
"description": "Show ttsc plugin diagnostics in VS Code, with @ttsc/lint errors, fix-all actions, and formatter support.",
|
|
5
|
+
"version": "0.14.1",
|
|
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.
|
|
103
|
+
"@typescript/native-preview": "7.0.0-dev.20260519.1",
|
|
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.
|
|
108
|
+
"ttsc": "0.14.1"
|
|
90
109
|
},
|
|
91
110
|
"scripts": {
|
|
92
111
|
"build": "rimraf lib dist && node build/build.cjs"
|