1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
diff --git a/src/lib/registerConfigErrorHandler.ts b/src/lib/registerConfigErrorHandler.ts
index 819458efb3a9286fbf011b6f03c77558b6058428..80ee6a594334c986741ba68b4bf2e96ac70008fb 100644
--- a/src/lib/registerConfigErrorHandler.ts
+++ b/src/lib/registerConfigErrorHandler.ts
@@ -1,23 +1,20 @@
-import { LanguageClient } from 'vscode-languageclient'
import { window, Uri, Range, Position } from 'vscode'
+import { NotificationEmitter } from './emitter'
-export function registerConfigErrorHandler(client: LanguageClient) {
- client.onNotification(
- 'tailwindcss/configError',
- async ({ message, file, line }) => {
- const actions: string[] = file ? ['View'] : []
- const action = await window.showErrorMessage(
- `Tailwind CSS: ${message}`,
- ...actions
- )
- if (action === 'View') {
- window.showTextDocument(Uri.file(file), {
- selection: new Range(
- new Position(line - 1, 0),
- new Position(line - 1, 0)
- ),
- })
- }
+export function registerConfigErrorHandler(emitter: NotificationEmitter) {
+ emitter.on('configError', async ({ message, file, line }) => {
+ const actions: string[] = file ? ['View'] : []
+ const action = await window.showErrorMessage(
+ `Tailwind CSS: ${message}`,
+ ...actions
+ )
+ if (action === 'View') {
+ window.showTextDocument(Uri.file(file), {
+ selection: new Range(
+ new Position(line - 1, 0),
+ new Position(line - 1, 0)
+ ),
+ })
}
- )
+ })
}
|