@effect/language-service 0.45.1 → 0.47.0
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 -2
- package/cli.js +5806 -456
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +40 -6
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +53 -10
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +40 -6
- package/transform.js.map +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ And you're done! You'll now be able to use a set of refactors and diagnostics th
|
|
|
63
63
|
- Warn on missing service dependencies in `Effect.Service` declarations
|
|
64
64
|
- Warn when `Effect.Service` is used with a primitive type instead of an object type
|
|
65
65
|
- Warn when schema classes override the default constructor behavior
|
|
66
|
+
- Warn when `@effect-diagnostics-next-line` comments have no effect (i.e., they don't suppress any diagnostic)
|
|
66
67
|
|
|
67
68
|
### Completions
|
|
68
69
|
|
|
@@ -110,6 +111,7 @@ Few options can be provided alongside the initialization of the Language Service
|
|
|
110
111
|
"floatingEffect": "warning" // example for a rule, allowed values are off,error,warning,message,suggestion
|
|
111
112
|
},
|
|
112
113
|
"diagnosticsName": true, // controls whether to include the rule name in diagnostic messages (default: true)
|
|
114
|
+
"missingDiagnosticNextLine": "warning", // controls the severity of warnings for unused @effect-diagnostics-next-line comments (default: "warning", allowed values: off,error,warning,message,suggestion)
|
|
113
115
|
"quickinfo": true, // controls Effect quickinfo (default: true)
|
|
114
116
|
"quickinfoEffectParameters": "whenTruncated", // (default: "whenTruncated") controls when to display effect type parameters always,never,whenTruncated
|
|
115
117
|
"quickinfoMaximumLength": -1, // controls how long can be the types in the quickinfo hover (helps with very long type to improve perfs, defaults to -1 for no truncation, can be any number eg. 1000 and TS will try to fit as much as possible in that budget, higher number means more info.)
|
|
@@ -154,7 +156,7 @@ If everything goes smoothly, something along these lines should be printed out:
|
|
|
154
156
|
/node_modules/typescript/lib/_tsc.js patched successfully.
|
|
155
157
|
```
|
|
156
158
|
|
|
157
|
-
Now the CLI has patched the tsc binary and the typescript library to raise
|
|
159
|
+
Now the CLI has patched the tsc binary and the typescript library to raise Effect diagnostics even at build time if the plugin is configured in your tsconfig!
|
|
158
160
|
|
|
159
161
|
As the command output suggests, you may need to delete your tsbuildinfo files or perform a full rebuild in order to re-check previously existing files.
|
|
160
162
|
|
|
@@ -202,13 +204,29 @@ index.ts:3:1 - error TS3: Effect must be yielded or assigned to a variable.
|
|
|
202
204
|
Found 1 error in index.ts:3
|
|
203
205
|
```
|
|
204
206
|
|
|
207
|
+
## Effect-Language-Service CLI
|
|
208
|
+
|
|
209
|
+
The effect language service plugin comes with a builtin CLI tool that can be used to perform various utilities, checks and setups. Since it relies on typescript, we recommend to install it locally and run it locally to ensure it loads the same typescript version of your project rather than a global installation that may resolve to use a different TS version from the one of your project.
|
|
210
|
+
|
|
211
|
+
### `effect-language-service diagnostics`
|
|
212
|
+
Provides a way to get through a CLI the list of Effect specific diagnostics; without patching your typescript installation. A --file option may be used to get diagnostics for a specific file, or --project with a tsconfig file to get an entire project.
|
|
213
|
+
|
|
214
|
+
### `effect-language-service check`
|
|
215
|
+
This command runs a check of the setup of the patching mechanism of the LSP, to understand if typescript has been patched or not.
|
|
216
|
+
|
|
217
|
+
### `effect-language-service patch`
|
|
218
|
+
Patches (or re-patches) your local TypeScript installation to provide Effect diagnostics at build time.
|
|
219
|
+
|
|
220
|
+
### `effect-language-service unpatch`
|
|
221
|
+
Revery any previously applied patch to the local TypeScript installation.
|
|
222
|
+
|
|
205
223
|
## Configuring diagnostics
|
|
206
224
|
|
|
207
225
|
You can either disable or change the severity of specific diagnostics by using comments in your code.
|
|
208
226
|
|
|
209
227
|
```ts
|
|
210
228
|
// @effect-diagnostics effect/floatingEffect:off
|
|
211
|
-
Effect.succeed(1); // This will not be reported as a floating
|
|
229
|
+
Effect.succeed(1); // This will not be reported as a floating Effect
|
|
212
230
|
|
|
213
231
|
// @effect-diagnostics effect/floatingEffect:error
|
|
214
232
|
Effect.succeed(1); // This will be reported as a floating effect
|
|
@@ -303,6 +321,7 @@ and will be used as follows:
|
|
|
303
321
|
export class UserRepo extends Repository("Hello")<UserRepo, { /** ... */ }>() {}
|
|
304
322
|
```
|
|
305
323
|
|
|
324
|
+
|
|
306
325
|
## Known gotchas
|
|
307
326
|
|
|
308
327
|
### Svelte VSCode extension and SvelteKit
|