Skip to content

Commit 9dd59e0

Browse files
authored
(fix) move fs watcher config to language-server (#2009)
#2008 #1613
1 parent 6b130f6 commit 9dd59e0

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

packages/language-server/src/server.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
CallHierarchyOutgoingCallsRequest,
2222
InlayHintRequest,
2323
SemanticTokensRefreshRequest,
24-
InlayHintRefreshRequest
24+
InlayHintRefreshRequest,
25+
DidChangeWatchedFilesNotification
2526
} from 'vscode-languageserver';
2627
import { IPCMessageReader, IPCMessageWriter, createConnection } from 'vscode-languageserver/node';
2728
import { DiagnosticsManager } from './lib/DiagnosticsManager';
@@ -296,6 +297,22 @@ export function startServer(options?: LSOptions) {
296297
};
297298
});
298299

300+
connection.onInitialized(() => {
301+
if (
302+
!watcher &&
303+
configManager.getClientCapabilities()?.workspace?.didChangeWatchedFiles
304+
?.dynamicRegistration
305+
) {
306+
connection?.client.register(DidChangeWatchedFilesNotification.type, {
307+
watchers: [
308+
{
309+
globPattern: '**/*.{ts,js,mts,mjs,cjs,cts,json}'
310+
}
311+
]
312+
});
313+
}
314+
});
315+
299316
function notifyTsServiceExceedSizeLimit() {
300317
connection?.sendNotification(ShowMessageNotification.type, {
301318
message:

packages/svelte-vscode/src/extension.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ export function activateSvelteLanguageServer(context: ExtensionContext) {
151151
'less',
152152
'scss',
153153
'html'
154-
],
155-
fileEvents: workspace.createFileSystemWatcher('{**/*.js,**/*.ts}', false, false, false)
154+
]
156155
},
157156
initializationOptions: {
158157
configuration: {

0 commit comments

Comments
 (0)