@effect/language-service 0.44.1 → 0.45.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 +21 -0
- package/cli.js +613 -558
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +141 -28
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +172 -33
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +141 -28
- package/transform.js.map +1 -1
package/README.md
CHANGED
|
@@ -282,6 +282,27 @@ The skipLeadingPath array can contain a set of prefixes to remove from the subpa
|
|
|
282
282
|
|
|
283
283
|
This pattern uses the package name + identifier. This usually works great if you have a flat structure, with one file per service/error.
|
|
284
284
|
|
|
285
|
+
## Using Key Patterns in custom API definitions
|
|
286
|
+
|
|
287
|
+
You can enforce and take advantage of the deterministicKeys rule also in your own custom API that provide an `extends MyApi("identifier")`-like experience, so basically only in extends clause of class declarations.
|
|
288
|
+
|
|
289
|
+
To do so, first you need to enable `extendedKeyDetection: true` in plugin options to enable slower detection of this custom patterns.
|
|
290
|
+
|
|
291
|
+
And then you'll need to add a JSDoc `/** @effect-identifier */` to the parameter where you expect to receive string identifier.
|
|
292
|
+
|
|
293
|
+
Let's say for example that you want to provide a Repository() API that is basically the same of Context.Tag, but prefixes the key identifier with 'Repository/'; the definition of the Resource API would be something like this:
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
export function Repository(/** @effect-identifier */ identifier: string) {
|
|
297
|
+
return Context.Tag("Repository/" + identifier)
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
and will be used as follows:
|
|
302
|
+
```ts
|
|
303
|
+
export class UserRepo extends Repository("Hello")<UserRepo, { /** ... */ }>() {}
|
|
304
|
+
```
|
|
305
|
+
|
|
285
306
|
## Known gotchas
|
|
286
307
|
|
|
287
308
|
### Svelte VSCode extension and SvelteKit
|