codemode-lsp 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -207819,6 +207819,9 @@ class TransactionalBuffer {
207819
207819
  }
207820
207820
  return false;
207821
207821
  }
207822
+ isPendingCreation(absPath) {
207823
+ return this.files.get(absPath)?.state === "created";
207824
+ }
207822
207825
  getText(absPath, relPath) {
207823
207826
  const tracked = this.track(absPath);
207824
207827
  if (tracked.state === "deleted") {
@@ -207941,6 +207944,10 @@ class TransactionalBuffer {
207941
207944
  } else if (file2.state === "created") {
207942
207945
  mkdirSync(dirname(absPath), { recursive: true });
207943
207946
  writeFileSync(absPath, file2.current ?? "", "utf8");
207947
+ if (file2.lspVisible) {
207948
+ this.client.didClose(absPath);
207949
+ this.client.didOpen(absPath, file2.current ?? "");
207950
+ }
207944
207951
  changes.push({
207945
207952
  absPath,
207946
207953
  kind: "created",
@@ -209130,12 +209137,19 @@ ${text}`
209130
209137
  const workspacePath = this.workspacePathFromUri(uri);
209131
209138
  if (!workspacePath)
209132
209139
  return [];
209133
- return diagnostics.map((diagnostic) => ({
209134
- file: workspacePath.relPath,
209135
- range: diagnostic.range,
209136
- message: typeof diagnostic.message === "string" ? diagnostic.message : diagnostic.message.value,
209137
- severity: severityName(diagnostic.severity)
209138
- }));
209140
+ const pendingCreation = this.buffer?.isPendingCreation(workspacePath.absPath);
209141
+ return diagnostics.map((diagnostic) => {
209142
+ let message = typeof diagnostic.message === "string" ? diagnostic.message : diagnostic.message.value;
209143
+ if (pendingCreation && /Cannot find module/i.test(message)) {
209144
+ 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
+ }
209146
+ return {
209147
+ file: workspacePath.relPath,
209148
+ range: diagnostic.range,
209149
+ message,
209150
+ severity: severityName(diagnostic.severity)
209151
+ };
209152
+ });
209139
209153
  }
209140
209154
  lineLooksExported(text, zeroBasedLine) {
209141
209155
  return /^\s*export\b/.test(lineContext(text, zeroBasedLine));
@@ -215539,6 +215553,10 @@ script's last expression, JSON-serialized.
215539
215553
  rejected.
215540
215554
  - Diagnostics cover files touched this session only, never the whole project.
215541
215555
  \`Diagnostic.range\` is zero-based; every other line/column is 1-based.
215556
+ - On a file CREATED this script, "Cannot find module" for tsconfig path
215557
+ aliases (\`@/...\`) is usually a false positive — the file joins the TS
215558
+ project only once flushed to disk. Such diagnostics are tagged in-band;
215559
+ don't roll back over them alone.
215542
215560
 
215543
215561
  ## API
215544
215562
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemode-lsp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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",