@effect/language-service 0.23.5 → 0.24.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 +12 -11
- package/cli.js +30946 -0
- package/cli.js.map +1 -0
- package/index.js +4686 -267
- package/index.js.map +1 -1
- package/package.json +4 -1
- package/transform.js +248 -44
- package/transform.js.map +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This package implements a TypeScript language service plugin that allows additio
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
1. `npm install @effect/language-service --save-dev` in your project
|
|
8
|
-
2.
|
|
8
|
+
2. Inside your tsconfig.json, you should add the plugin configuration as follows:
|
|
9
9
|
```jsonc
|
|
10
10
|
{
|
|
11
11
|
"compilerOptions": {
|
|
@@ -22,10 +22,10 @@ This package implements a TypeScript language service plugin that allows additio
|
|
|
22
22
|
3. Ensure that you have installed TypeScript locally in your project and set your editor to use your workspace TypeScript version.
|
|
23
23
|
|
|
24
24
|
- In VSCode you can do this by pressing "F1" and typing "TypeScript: Select TypeScript version". Then select "Use workspace version". If that option does not appear, TypeScript is not installed locally in your node_modules.
|
|
25
|
-
- In JetBrains you may have to disable the Vue language service, and
|
|
26
|
-
- In NVim with nvim-vtsls you should refer to [how to enable TypeScript plugins in
|
|
25
|
+
- In JetBrains you may have to disable the Vue language service, and choose the workspace version of TypeScript in the settings from the dropdown.
|
|
26
|
+
- In NVim with nvim-vtsls you should refer to [how to enable TypeScript plugins in vtsls](https://github.com/yioneko/vtsls?tab=readme-ov-file#typescript-plugin-not-activated)
|
|
27
27
|
|
|
28
|
-
And you're done! You'll now be able to use a set of
|
|
28
|
+
And you're done! You'll now be able to use a set of refactors and diagnostics that target Effect!
|
|
29
29
|
|
|
30
30
|
## Provided functionalities
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ And you're done! You'll now be able to use a set of refactor and diagnostics tha
|
|
|
33
33
|
|
|
34
34
|
- Show the extended type of the current Effect
|
|
35
35
|
- Hovering `yield\*` of `Effect.gen` will show the Effect type parameters
|
|
36
|
-
- Hovering a variable assignment of a type Layer, will show info on how each service got
|
|
36
|
+
- Hovering a variable assignment of a type Layer, will show info on how each service got involved
|
|
37
37
|
- Hovering a layer, will attempt to produce a graph
|
|
38
38
|
|
|
39
39
|
### Diagnostics
|
|
@@ -43,6 +43,7 @@ And you're done! You'll now be able to use a set of refactor and diagnostics tha
|
|
|
43
43
|
- Wrong usage of yield inside `Effect.gen`
|
|
44
44
|
- Multiple versions of Effect in your project
|
|
45
45
|
- Warn on leaking requirements in Effect services
|
|
46
|
+
- Warn on Scope as requirement of a Layer
|
|
46
47
|
- Unnecessary usages of `Effect.gen` or `pipe()`
|
|
47
48
|
- Warn when importing from a barrel file instead of from the module directly
|
|
48
49
|
|
|
@@ -85,7 +86,7 @@ Few options can be provided alongside the initialization of the Language Service
|
|
|
85
86
|
"quickinfo": true, // controls quickinfo over Effect (default: true)
|
|
86
87
|
"completions": true, // controls Effect completions (default: true)
|
|
87
88
|
"goto": true, // controls Effect goto references (default: true)
|
|
88
|
-
"allowedDuplicatedPackages": [], // list of package names that
|
|
89
|
+
"allowedDuplicatedPackages": [], // list of package names that have effect in peer dependencies and are allowed to be duplicated (default: [])
|
|
89
90
|
"barrelImportPackages": [], // package names that should be preferred as imported from the top level barrel file (default: [])
|
|
90
91
|
"namespaceImportPackages": [] // package names that should be preferred as imported with namespace imports e.g. ["effect", "@effect/*"] (default: [])
|
|
91
92
|
}
|
|
@@ -94,9 +95,9 @@ Few options can be provided alongside the initialization of the Language Service
|
|
|
94
95
|
}
|
|
95
96
|
```
|
|
96
97
|
|
|
97
|
-
## Why diagnostics
|
|
98
|
+
## Why do diagnostics not appear at compile time?
|
|
98
99
|
|
|
99
|
-
TypeScript
|
|
100
|
+
TypeScript LSPs are loaded only while editing your files. That means that if you run `tsc` in your project, the plugin won't be loaded and you'll miss out on the Effect diagnostics.
|
|
100
101
|
|
|
101
102
|
HOWEVER, if you use `ts-patch` you can enable the transform as well to get the diagnostics also at compile time.
|
|
102
103
|
Your `tsconfig.json` should look like this:
|
|
@@ -117,7 +118,7 @@ Your `tsconfig.json` should look like this:
|
|
|
117
118
|
To get diagnostics you need to install `ts-patch` which will make it possible to run `tspc`.
|
|
118
119
|
|
|
119
120
|
Running `tspc` in your project will now also run the plugin and give you the diagnostics at compile time.
|
|
120
|
-
Effect diagnostics will be shown only after standard TypeScript diagnostics
|
|
121
|
+
Effect diagnostics will be shown only after standard TypeScript diagnostics have been satisfied.
|
|
121
122
|
|
|
122
123
|
```ts
|
|
123
124
|
$ npx tspc
|
|
@@ -165,9 +166,9 @@ or you can set the severity for the entire project in the global plugin configur
|
|
|
165
166
|
|
|
166
167
|
The Svelte LSP does not properly compose with other LSPs when using SvelteKit. So the Effect LSP should be loaded as last entry to ensure proper composition.
|
|
167
168
|
|
|
168
|
-
If you did not
|
|
169
|
+
If you did not install the Svelte LSP into your local project but instead through the Svelte VSCode extension, we recommend instead to install it locally and add it as the first entry. That way it won't be applied by the VSCode extension.
|
|
169
170
|
|
|
170
|
-
Your tsconfig should look like this:
|
|
171
|
+
Your tsconfig.json should look like this:
|
|
171
172
|
|
|
172
173
|
```jsonc
|
|
173
174
|
{
|