@effect/language-service 0.35.1 → 0.36.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 +42 -2
- package/cli.js +1501 -4371
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +5108 -0
- package/effect-lsp-patch-utils.js.map +1 -0
- package/index.js +387 -294
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +332 -263
- package/transform.js.map +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,13 @@ 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
|
+
- Not required, but to remember the user to do so, you can update your `.vscode/settings.json`
|
|
26
|
+
```jsonc
|
|
27
|
+
{
|
|
28
|
+
"typescript.tsdk": "./node_modules/typescript/lib",
|
|
29
|
+
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
30
|
+
}
|
|
31
|
+
```
|
|
25
32
|
- 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
33
|
- 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
34
|
- In Emacs, additional steps are required to enable LSPs, [step by step instructions can be found here](https://gosha.net/2025/effect-ls-emacs/)
|
|
@@ -121,7 +128,40 @@ The full list can be found in the [diagnostics](https://github.com/Effect-TS/lan
|
|
|
121
128
|
|
|
122
129
|
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.
|
|
123
130
|
|
|
124
|
-
|
|
131
|
+
We provide two approaches to solve this scenario.
|
|
132
|
+
|
|
133
|
+
### Option A - Effect LSP Cli Patch (experimental recommended)
|
|
134
|
+
|
|
135
|
+
This option works by modifing directly the source code of the tsc compiler and the typescript library in your project node_modules. This allows to get effect's diagnostics even when noEmit is enabled, for composite and incremental projects as well.
|
|
136
|
+
|
|
137
|
+
After having installed and configured the LSP for editor usage, you can run the following command inside the folder that contains your local project typescript installation:
|
|
138
|
+
|
|
139
|
+
`effect-language-service patch`
|
|
140
|
+
|
|
141
|
+
If everything goes smoothly, something along these lines should be printed out:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
/node_modules/typescript/lib/typescript.js patched successfully.
|
|
145
|
+
/node_modules/typescript/lib/_tsc.js patched successfully.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
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!
|
|
149
|
+
|
|
150
|
+
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.
|
|
151
|
+
|
|
152
|
+
To make the patch persistent across package installations and updates, we recommend adding the patch command to your package.json prepare scripts:
|
|
153
|
+
|
|
154
|
+
```jsonc
|
|
155
|
+
"scripts": {
|
|
156
|
+
"prepare": "effect-language-service patch"
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
so that across updates the patch will be re-applied again.
|
|
161
|
+
|
|
162
|
+
### Option B - Using ts-patch
|
|
163
|
+
|
|
164
|
+
if you use `ts-patch` you can enable the transform as well to get the diagnostics also at compile time.
|
|
125
165
|
Your `tsconfig.json` should look like this:
|
|
126
166
|
|
|
127
167
|
```jsonc
|
|
@@ -141,7 +181,7 @@ To get diagnostics you need to install `ts-patch` which will make it possible to
|
|
|
141
181
|
|
|
142
182
|
Running `tspc` in your project will now also run the plugin and give you the error diagnostics at compile time.
|
|
143
183
|
Effect error diagnostics will be shown only after standard TypeScript diagnostics have been satisfied.
|
|
144
|
-
Beware that setting noEmit will completely skip the effect diagnostics.
|
|
184
|
+
Beware that setting noEmit will completely skip the effect diagnostics, and projects using incremental builds may encounter some issues.
|
|
145
185
|
|
|
146
186
|
```ts
|
|
147
187
|
$ npx tspc
|