@stateward/language-server 1.0.1-rc.1 → 1.0.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
@@ -11,3 +11,19 @@ npm install --save-dev @stateward/language-server
11
11
  Start it with `npx stateward-language-server`. It talks over stdin and stdout and checks the
12
12
  project of the nearest `stateward.config.ts`. The VS Code extension uses the copy installed in your
13
13
  project, else its own.
14
+
15
+ ## What you see
16
+
17
+ - Findings as diagnostics, as you type, with the rule id and the change to make.
18
+ - Quick fixes, each tried on a copy of your code first: one that would not compile is not offered.
19
+ "Ignore this case here" writes a `// stateward-ignore` comment with the rule.
20
+ - Inlay hints after a function's signature with the errors it can throw (`throws NotFoundError`),
21
+ and after a `catch` variable with the errors its `try` can throw (with the errors pack).
22
+ - Places stateward could not check, as faint hints; baselined findings, faintly.
23
+
24
+ ## Docs
25
+
26
+ - [Every rule](https://github.com/khoing1111/ts-stateward/blob/main/docs/rules/README.md), with
27
+ what it finds and its severity.
28
+ - [The config file](https://github.com/khoing1111/ts-stateward/blob/main/docs/user/config.md).
29
+ - [The VS Code extension](https://github.com/khoing1111/ts-stateward/blob/main/packages/vscode/README.md).
package/dist/server.js CHANGED
@@ -114,20 +114,6 @@ export function startServer(connection, { idleMs = ENGINE_IDLE_MS, cacheDir = (p
114
114
  .all()
115
115
  .filter((document) => isTypeScriptFile(document.uri))
116
116
  .map((document) => [toTypeScriptPath(fileURLToPath(document.uri)), document.version]));
117
- /**
118
- * The version each open file document had when it was opened, by path (`toTypeScriptPath`): one
119
- * still at that version holds the text it was opened with, so its fast pass may take its results
120
- * from the cache.
121
- */
122
- const versionsAtOpen = new Map();
123
- /** The files of `files` whose document is unedited since it was opened. */
124
- const uneditedSinceOpen = (files) => {
125
- const now = openVersions();
126
- return files.filter((file) => {
127
- const version = now.get(toTypeScriptPath(file));
128
- return version !== undefined && version === versionsAtOpen.get(toTypeScriptPath(file));
129
- });
130
- };
131
117
  /** The engine of the config `file` belongs to, if it runs. */
132
118
  const engineOf = (file) => {
133
119
  const configFile = locator.configOf(file);
@@ -367,9 +353,7 @@ export function startServer(connection, { idleMs = ENGINE_IDLE_MS, cacheDir = (p
367
353
  if (targets.length === 0)
368
354
  return;
369
355
  try {
370
- // A document just opened usually holds the text the saved results were computed on: its
371
- // findings then come from the cache, with no type checking (a large app's first findings).
372
- const result = editor.checkFiles(targets, open, uneditedSinceOpen(targets));
356
+ const result = editor.checkFiles(targets, open);
373
357
  for (const file of targets) {
374
358
  const merged = mergeFastPass({ file, fast: result });
375
359
  // Only the file rules ran: the project rules' entries are not matched here.
@@ -693,9 +677,6 @@ export function startServer(connection, { idleMs = ENGINE_IDLE_MS, cacheDir = (p
693
677
  }
694
678
  });
695
679
  documents.onDidOpen((event) => {
696
- if (event.document.uri.startsWith("file:")) {
697
- versionsAtOpen.set(toTypeScriptPath(fileURLToPath(event.document.uri)), event.document.version);
698
- }
699
680
  engineForDocument(event.document.uri);
700
681
  });
701
682
  documents.onDidChangeContent((event) => {
@@ -722,9 +703,6 @@ export function startServer(connection, { idleMs = ENGINE_IDLE_MS, cacheDir = (p
722
703
  void runFull(engine).catch(logUnexpected);
723
704
  });
724
705
  documents.onDidClose((event) => {
725
- if (event.document.uri.startsWith("file:")) {
726
- versionsAtOpen.delete(toTypeScriptPath(fileURLToPath(event.document.uri)));
727
- }
728
706
  if (!isSyncedFile(event.document.uri))
729
707
  return;
730
708
  const engine = engineOf(fileURLToPath(event.document.uri));
@@ -960,11 +938,6 @@ export function startServer(connection, { idleMs = ENGINE_IDLE_MS, cacheDir = (p
960
938
  const editor = checkerOf(params.textDocument.uri);
961
939
  if (document === undefined || editor === undefined)
962
940
  return [];
963
- // Hints come from a full pass's summaries, and the client is asked again after each one: before
964
- // the first, answering would build and bind the programs ahead of the open file's findings.
965
- const engine = guarded(() => engineOf(fileURLToPath(document.uri)));
966
- if (refreshHints && engine?.firstFullDone !== true)
967
- return [];
968
941
  const hints = guarded(() => {
969
942
  const index = buildLineIndex(document.getText());
970
943
  const found = editor.inlayHints(fileURLToPath(document.uri), (kind) => hintEnabled(hintSettings, kind));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stateward/language-server",
3
- "version": "1.0.1-rc.1",
3
+ "version": "1.0.1",
4
4
  "description": "The stateward language server: exclusive states and predictable code paths in any editor that speaks LSP, with findings, quick fixes and hints.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,12 +41,12 @@
41
41
  "dependencies": {
42
42
  "vscode-languageserver": "^11.0.0",
43
43
  "vscode-languageserver-textdocument": "^1.0.16",
44
- "@stateward/core": "1.0.1-rc.1"
44
+ "@stateward/core": "1.0.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/react": "^19.3.0",
48
48
  "react": "^19.3.1",
49
49
  "vscode-jsonrpc": "10.0.0",
50
- "@stateward/plugin-react-context": "1.0.1-rc.1"
50
+ "@stateward/plugin-react-context": "1.0.1"
51
51
  }
52
52
  }