@ttsc/vscode 0.11.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/LICENSE +21 -0
- package/README.md +39 -0
- package/bin/install.js +44 -0
- package/dist/ttsc-vscode-0.11.0.vsix +0 -0
- package/lib/extension.js +18258 -0
- package/lib/extension.js.map +7 -0
- package/package.json +94 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeongho Nam
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @ttsc/vscode
|
|
2
|
+
|
|
3
|
+
VSCode extension that runs the `ttscserver` Language Server for TypeScript-Go
|
|
4
|
+
projects. It surfaces ttsc plugin (lint/format) diagnostics alongside the
|
|
5
|
+
tsgo type-check diagnostics in the same publishDiagnostics stream and
|
|
6
|
+
exposes ttsc-owned code actions and commands.
|
|
7
|
+
|
|
8
|
+
## What it does
|
|
9
|
+
|
|
10
|
+
- Spawns `ttscserver` from the workspace's installed `ttsc` package (or a
|
|
11
|
+
user-supplied absolute path).
|
|
12
|
+
- Receives merged diagnostics, hovers, completions, definitions from the
|
|
13
|
+
embedded tsgo LSP server.
|
|
14
|
+
- Adds the ttsc-owned commands `ttsc.lint.fixAll`, `ttsc.format.document`,
|
|
15
|
+
and `ttsc.server.restart` to the command palette.
|
|
16
|
+
|
|
17
|
+
## Local install (testing)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# from the repo root
|
|
21
|
+
pnpm install
|
|
22
|
+
pnpm -F @ttsc/vscode build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then in VSCode:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
code --extensionDevelopmentPath=packages/vscode <your-project>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The extension activates on any TypeScript / TSX / JS / JSX file inside the
|
|
32
|
+
project. The Output channel "ttsc" shows the language server log.
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
| Setting | Default | Purpose |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `ttsc.serverPath` | `""` | Absolute path to the `ttscserver` binary. Empty means resolve from the workspace `ttsc` install. |
|
|
39
|
+
| `ttsc.trace.server` | `"off"` | LSP message tracing — set to `"messages"` or `"verbose"` for debugging. |
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const cp = require("node:child_process");
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const pkgRoot = path.resolve(__dirname, "..");
|
|
7
|
+
const distDir = path.join(pkgRoot, "dist");
|
|
8
|
+
const extensionId = "samchon.ttsc";
|
|
9
|
+
|
|
10
|
+
const sub = process.argv[2] ?? "install";
|
|
11
|
+
|
|
12
|
+
function findVsix() {
|
|
13
|
+
if (!fs.existsSync(distDir)) return null;
|
|
14
|
+
const hits = fs.readdirSync(distDir).filter((f) => f.endsWith(".vsix"));
|
|
15
|
+
return hits.length ? path.join(distDir, hits[0]) : null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function runCode(args, vsixForFallback) {
|
|
19
|
+
const r = cp.spawnSync("code", args, { stdio: "inherit" });
|
|
20
|
+
if (r.error && r.error.code === "ENOENT") {
|
|
21
|
+
console.error("`code` CLI not found on PATH.");
|
|
22
|
+
console.error("Either:");
|
|
23
|
+
console.error(" - Open VSCode, then run \"Shell Command: Install 'code' command in PATH\" from the command palette.");
|
|
24
|
+
if (vsixForFallback) {
|
|
25
|
+
console.error(` - Or install manually: VSCode > Extensions > \"...\" menu > Install from VSIX > ${vsixForFallback}`);
|
|
26
|
+
}
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
process.exit(r.status ?? 1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (sub === "install") {
|
|
33
|
+
const vsix = findVsix();
|
|
34
|
+
if (!vsix) {
|
|
35
|
+
console.error(`No .vsix bundled in ${distDir}. Reinstall @ttsc/vscode or report a packaging bug.`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
runCode(["--install-extension", vsix, "--force"], vsix);
|
|
39
|
+
} else if (sub === "uninstall") {
|
|
40
|
+
runCode(["--uninstall-extension", extensionId]);
|
|
41
|
+
} else {
|
|
42
|
+
console.error(`Usage: ttsc-vscode <install|uninstall>`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
Binary file
|