@adecore/lsp 0.54.2 → 0.54.4

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
@@ -3,7 +3,7 @@
3
3
  [![npm](https://img.shields.io/npm/v/@adecore/lsp)](https://www.npmjs.com/package/@adecore/lsp)
4
4
  [![Docs](https://img.shields.io/badge/docs-adecore.dev-blue)](https://adecore.dev/lsp/)
5
5
 
6
- A client for the Language Server Protocol 3.17, without a DOM and without Node or Bun APIs, so it runs in a backend, a utility process or a page. It also defines `LanguageService`, the interface [`@adecore/editor-react`](https://adecore.dev/editor-react/) asks its features through. It starts no server: the app hands it a transport.
6
+ A client for the Language Server Protocol 3.17, without a DOM and without Node or Bun APIs, so it runs in a backend, a utility process or a page. It also defines `LanguageService`, the interface [`@adecore/editor-react`](https://adecore.dev/editor-react/) asks its features through. It starts no server. The app hands it a transport.
7
7
 
8
8
  ## Install
9
9
 
package/dist/document.js CHANGED
@@ -4,8 +4,8 @@ import { TextMirror } from './text-mirror.js';
4
4
  /* The delay of the VS Code language client for servers with full sync. */
5
5
  const FULL_SYNC_DELAY_MS = 200;
6
6
  /*
7
- * One open text document in one session. It owns the version: every change raises it by one, and a
8
- * result that arrives for an older version is refused, so nothing computed for a text that is gone
7
+ * One open text document in one session. It owns the version, which every change raises by one. It
8
+ * refuses a result that arrives for an older version, so nothing computed for a text that is gone
9
9
  * reaches the caller.
10
10
  */
11
11
  export class LspDocument {
package/dist/testing.js CHANGED
@@ -4,7 +4,7 @@ export { createMemoryTransportPair } from './transport.js';
4
4
  /*
5
5
  * A language server for tests, on the far end of a transport. It answers the handshake, keeps the
6
6
  * text of every document it was told about the way a real server does, and answers whatever a test
7
- * registers with `handle`; any other request is refused as unsupported.
7
+ * registers with `handle`. It refuses any other request as unsupported.
8
8
  */
9
9
  export class FakeLanguageServer {
10
10
  connection;
@@ -30,8 +30,8 @@ function ancestorsOf(uri) {
30
30
  * - A create over a file that is there is refused, unless it says `overwrite` (planned as an overwrite) or
31
31
  * `ignoreIfExists` (left out). A rename onto a target that is there works the same way; a rename of
32
32
  * something that is not there is always refused. Without `source.exists`, that is left to the host.
33
- * - A delete of something that is not there is refused unless it says `ignoreIfNotExists`. Emptiness of a
34
- * folder cannot be told, so deleting a folder, or anything that exists and is no text file when the source
33
+ * - A delete of something that is not there is refused unless it says `ignoreIfNotExists`. The plan cannot tell
34
+ * whether a folder is empty, so deleting a folder, or anything that exists and is no text file when the source
35
35
  * cannot say which, needs `recursive`.
36
36
  * - Text edits to a URI after it was deleted or renamed away are refused. Edits to a renamed file are read
37
37
  * from where it stood, and edits to a file the plan makes become its text.
@@ -220,7 +220,7 @@ export async function planWorkspaceOperations(edit, source) {
220
220
  }
221
221
  const recursive = change.options?.recursive === true;
222
222
  if (found.kind !== 'text' && !recursive && (await folderAt(found.readUri ?? change.uri))) {
223
- throw new LspError(`${change.uri} is a folder, or cannot be told from one, and is only deleted with recursive set`);
223
+ throw new LspError(`${change.uri} may be a folder, so deleting it needs recursive set`);
224
224
  }
225
225
  forget(change.uri);
226
226
  overlay.set(change.uri, null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/lsp",
3
- "version": "0.54.2",
3
+ "version": "0.54.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -20,7 +20,7 @@
20
20
  "test": "bun test --conditions=source"
21
21
  },
22
22
  "dependencies": {
23
- "@adecore/utils": "0.54.2"
23
+ "@adecore/utils": "0.54.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/bun": "^1.4.4",
package/src/document.ts CHANGED
@@ -53,8 +53,8 @@ import { TextMirror } from './text-mirror.ts';
53
53
  const FULL_SYNC_DELAY_MS = 200;
54
54
 
55
55
  /*
56
- * One open text document in one session. It owns the version: every change raises it by one, and a
57
- * result that arrives for an older version is refused, so nothing computed for a text that is gone
56
+ * One open text document in one session. It owns the version, which every change raises by one. It
57
+ * refuses a result that arrives for an older version, so nothing computed for a text that is gone
58
58
  * reaches the caller.
59
59
  */
60
60
  export class LspDocument {
package/src/session.ts CHANGED
@@ -62,8 +62,8 @@ export interface LspSessionOptions {
62
62
  completionItemDefaults?: readonly string[];
63
63
  /*
64
64
  * The resource operations the host carries out for a workspace edit, announced to servers. Defaults to create
65
- * and rename. The failure handling is `abort`: the client stops at the first change that fails, and the changes
66
- * that already ran are not rolled back.
65
+ * and rename. The failure handling is `abort`. The client stops at the first change that fails and does not
66
+ * roll back the changes that already ran.
67
67
  */
68
68
  resourceOperations?: readonly ResourceOperationKind[];
69
69
  onConfiguration?: (item: ConfigurationItem) => unknown | Promise<unknown>;
package/src/testing.ts CHANGED
@@ -28,7 +28,7 @@ export interface ReceivedMessage {
28
28
  /*
29
29
  * A language server for tests, on the far end of a transport. It answers the handshake, keeps the
30
30
  * text of every document it was told about the way a real server does, and answers whatever a test
31
- * registers with `handle`; any other request is refused as unsupported.
31
+ * registers with `handle`. It refuses any other request as unsupported.
32
32
  */
33
33
  export class FakeLanguageServer {
34
34
  readonly connection: JsonRpcConnection;
@@ -21,10 +21,10 @@ export interface WorkspaceEditSource {
21
21
  /* The text of a file; null when there is no such text file, which also covers folders and files that are not text. */
22
22
  read(uri: string): Promise<WorkspaceEditText | null>;
23
23
  /*
24
- * Whether anything is at the URI: a file of any kind or a folder. Asked only after `read` answered null.
25
- * Without it, what `read` has no text for is of unknown existence: a rename or delete of it is planned and
26
- * left to the host (`ignoreIfNotExists` cannot be honored), and a create or rename onto it is planned as no
27
- * overwrite, so the host has to refuse a target that is there.
24
+ * Whether anything is at the URI, a file of any kind or a folder. Asked only after `read` answered null.
25
+ * Without it, the plan cannot tell whether a URI without text exists. It plans a rename or delete of it and
26
+ * leaves the check to the host (`ignoreIfNotExists` cannot be honored), and plans a create or rename onto it
27
+ * without overwrite, so the host has to refuse a target that is there.
28
28
  */
29
29
  exists?(uri: string): Promise<boolean>;
30
30
  /* Whether the URI is a folder. Without it, anything that exists and is no text file may be a folder, so deleting it needs `recursive`. */
@@ -139,8 +139,8 @@ function ancestorsOf(uri: string): string[] {
139
139
  * - A create over a file that is there is refused, unless it says `overwrite` (planned as an overwrite) or
140
140
  * `ignoreIfExists` (left out). A rename onto a target that is there works the same way; a rename of
141
141
  * something that is not there is always refused. Without `source.exists`, that is left to the host.
142
- * - A delete of something that is not there is refused unless it says `ignoreIfNotExists`. Emptiness of a
143
- * folder cannot be told, so deleting a folder, or anything that exists and is no text file when the source
142
+ * - A delete of something that is not there is refused unless it says `ignoreIfNotExists`. The plan cannot tell
143
+ * whether a folder is empty, so deleting a folder, or anything that exists and is no text file when the source
144
144
  * cannot say which, needs `recursive`.
145
145
  * - Text edits to a URI after it was deleted or renamed away are refused. Edits to a renamed file are read
146
146
  * from where it stood, and edits to a file the plan makes become its text.
@@ -376,7 +376,7 @@ export async function planWorkspaceOperations(edit: WorkspaceEdit, source: Works
376
376
  const recursive = change.options?.recursive === true;
377
377
 
378
378
  if (found.kind !== 'text' && !recursive && (await folderAt(found.readUri ?? change.uri))) {
379
- throw new LspError(`${change.uri} is a folder, or cannot be told from one, and is only deleted with recursive set`);
379
+ throw new LspError(`${change.uri} may be a folder, so deleting it needs recursive set`);
380
380
  }
381
381
 
382
382
  forget(change.uri);