codemode-lsp 0.3.1 → 0.3.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 +3 -0
- package/dist/index.js +16 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -117,6 +117,9 @@ reads and writes alike.
|
|
|
117
117
|
- `Reference.isWriteAccess` is always `false` (not exposed over standard LSP).
|
|
118
118
|
- `getDependencies` is syntactic — a local variable shadowing an import can
|
|
119
119
|
produce a false positive.
|
|
120
|
+
- A file created mid-script reports spurious "Cannot find module" errors for
|
|
121
|
+
tsconfig path aliases until it is flushed to disk; those diagnostics carry
|
|
122
|
+
`likelyFalsePositive: true` so verification gates can skip them.
|
|
120
123
|
|
|
121
124
|
## Eval
|
|
122
125
|
|
package/dist/index.js
CHANGED
|
@@ -209140,15 +209140,20 @@ ${text}`
|
|
|
209140
209140
|
const pendingCreation = this.buffer?.isPendingCreation(workspacePath.absPath);
|
|
209141
209141
|
return diagnostics.map((diagnostic) => {
|
|
209142
209142
|
let message = typeof diagnostic.message === "string" ? diagnostic.message : diagnostic.message.value;
|
|
209143
|
+
let likelyFalsePositive = false;
|
|
209143
209144
|
if (pendingCreation && /Cannot find module/i.test(message)) {
|
|
209145
|
+
likelyFalsePositive = true;
|
|
209144
209146
|
message += " [likely a FALSE POSITIVE: this file is newly created and not yet " + "on disk, so tsconfig path aliases do not resolve in it until the " + "script succeeds and it is flushed. If an existing file imports the " + "same module without errors, ignore this; verify with " + "getDiagnostics in a follow-up call after the flush.]";
|
|
209145
209147
|
}
|
|
209146
|
-
|
|
209148
|
+
const converted = {
|
|
209147
209149
|
file: workspacePath.relPath,
|
|
209148
209150
|
range: diagnostic.range,
|
|
209149
209151
|
message,
|
|
209150
209152
|
severity: severityName(diagnostic.severity)
|
|
209151
209153
|
};
|
|
209154
|
+
if (likelyFalsePositive)
|
|
209155
|
+
converted.likelyFalsePositive = true;
|
|
209156
|
+
return converted;
|
|
209152
209157
|
});
|
|
209153
209158
|
}
|
|
209154
209159
|
lineLooksExported(text, zeroBasedLine) {
|
|
@@ -215367,6 +215372,8 @@ interface Diagnostic {
|
|
|
215367
215372
|
range: Range;
|
|
215368
215373
|
message: string;
|
|
215369
215374
|
severity: "error" | "warning" | "info" | "hint";
|
|
215375
|
+
/** True when this is probably spurious (e.g. path-alias resolution on a file created this script) — exclude these from any abort/rollback gate. */
|
|
215376
|
+
likelyFalsePositive?: boolean;
|
|
215370
215377
|
}
|
|
215371
215378
|
|
|
215372
215379
|
interface Position {
|
|
@@ -215383,7 +215390,7 @@ var LSP_WRITE_INTERFACES = `interface WriteResult {
|
|
|
215383
215390
|
file: string;
|
|
215384
215391
|
/** All files affected — rename can fan out to many. */
|
|
215385
215392
|
filesChanged: string[];
|
|
215386
|
-
/** Fresh diagnostics for the affected files;
|
|
215393
|
+
/** Fresh diagnostics for the affected files; gate on severity "error" but skip likelyFalsePositive ones. */
|
|
215387
215394
|
diagnostics: Diagnostic[];
|
|
215388
215395
|
}`;
|
|
215389
215396
|
var LSP_READ_OP_SIGNATURES = ` /** File contents as a raw string (no line numbers). */
|
|
@@ -215554,9 +215561,13 @@ script's last expression, JSON-serialized.
|
|
|
215554
215561
|
- Diagnostics cover files touched this session only, never the whole project.
|
|
215555
215562
|
\`Diagnostic.range\` is zero-based; every other line/column is 1-based.
|
|
215556
215563
|
- On a file CREATED this script, "Cannot find module" for tsconfig path
|
|
215557
|
-
aliases (\`@/...\`) is usually
|
|
215558
|
-
|
|
215559
|
-
|
|
215564
|
+
aliases (\`@/...\`) is usually spurious — the file joins the TS project only
|
|
215565
|
+
once flushed to disk. Such diagnostics carry \`likelyFalsePositive: true\`;
|
|
215566
|
+
exclude them from any abort gate:
|
|
215567
|
+
\`d.severity === "error" && !d.likelyFalsePositive\`. For a strict
|
|
215568
|
+
verify-or-rollback workflow, split it across calls: do the writes in one
|
|
215569
|
+
script (so they flush), then check diagnostics — and restore originals if
|
|
215570
|
+
real errors remain — in a follow-up script.
|
|
215560
215571
|
|
|
215561
215572
|
## API
|
|
215562
215573
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codemode-lsp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Semantic code intelligence + refactoring MCP for TypeScript/JS: one LSP-backed execute tool — call graphs, impact analysis, symbol dependencies, atomic multi-file refactors",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"prepublishOnly": "bun run check && bun run build",
|
|
34
34
|
"generate:types": "bun run scripts/generate-types.ts",
|
|
35
35
|
"eval": "bun run scripts/eval.ts",
|
|
36
|
-
"check": "bun run typecheck && bun run lint && bun test",
|
|
36
|
+
"check": "bun run typecheck && bun run lint && bun test --parallel=4",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"lint": "biome check .",
|
|
39
39
|
"fix": "biome check --write .",
|