@effect/language-service 0.8.1 → 0.9.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/LICENSE +21 -0
- package/README.md +69 -0
- package/index.js +953 -709
- package/index.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Effectful Technologies Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# language-service
|
|
2
|
+
|
|
3
|
+
This package implements a TypeScript language service plugin that allows additional refactors and diagnostics with your VSCode editor (or any editor that supports TypeScript's LSP).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1) `npm install @effect/language-service --save-dev` in your project
|
|
8
|
+
2) inside your tsconfig.json, you should add the plugin configuration as follows:
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"compilerOptions": {
|
|
13
|
+
"plugins": [
|
|
14
|
+
{
|
|
15
|
+
"name": "@effect/language-service"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
3) Ensure that you set your editor to use your workspace TypeScript version.
|
|
22
|
+
|
|
23
|
+
- In VSCode you can do this by pressing "F1" and typing "TypeScript: Select TypeScript version". Then select "Use workspace version".
|
|
24
|
+
- In JetBrains you may have to disable the Vue language service, and chose the workspace version of TypeScript in the settings from the dropdown.
|
|
25
|
+
|
|
26
|
+
And you're done! You'll now be able to use a set of refactor and diagnostics that targets Effect!
|
|
27
|
+
|
|
28
|
+
## Options
|
|
29
|
+
|
|
30
|
+
Few options can be provided alongside the initialization of the Language Service Plugin.
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"compilerOptions": {
|
|
35
|
+
"plugins": [
|
|
36
|
+
{
|
|
37
|
+
"name": "@effect/language-service",
|
|
38
|
+
"diagnostics": true, // controls Effect diagnostics (on by default)
|
|
39
|
+
"quickinfo": true // controls quickinfo over Effect (on by default)
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Provided functionalities
|
|
47
|
+
|
|
48
|
+
### Quickinfo
|
|
49
|
+
- Show the extended type of the current Effect
|
|
50
|
+
|
|
51
|
+
### Diagnostics
|
|
52
|
+
|
|
53
|
+
- Better error readability when you're missing errors or service types in your Effect definitions
|
|
54
|
+
- Detect floating Effects that are not yielded or run
|
|
55
|
+
- Detect wrong usage of yield inside Effect.gen
|
|
56
|
+
- Detect unnecessary usages of Effect.gen
|
|
57
|
+
|
|
58
|
+
### Completions
|
|
59
|
+
- Autocomplete 'Self' in Effect.Service, Context.Tag, Schema.TaggedClass, Schema.TaggedRequest and family
|
|
60
|
+
|
|
61
|
+
### Refactors
|
|
62
|
+
|
|
63
|
+
- Transform an async function definition, into an Effect by using Effect.gen.
|
|
64
|
+
- Transform an async function definition, into an Effect by using Effect.gen, and generating a tagged error for each promise call.
|
|
65
|
+
- Transform a function returning an Effect.gen into a Effect.fn
|
|
66
|
+
- Function calls to pipe: Transform a set of function calls to a pipe() call.
|
|
67
|
+
- Pipe to datafirst: Transform a pipe() call into a series of datafirst function calls (where available).
|
|
68
|
+
- Toggle return type signature: With a single refactor, adds or removes type annotations from the definition.
|
|
69
|
+
- Remove unnecessary `Effect.gen` definitions that contains a single `yield` statement.
|