Skip to content

Commit

Permalink
refactor: simplify file watcher globPattern
Browse files Browse the repository at this point in the history
close #2051
  • Loading branch information
johnsoncodehk committed Nov 28, 2022
1 parent debb64f commit 2694088
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/language-server/src/server.ts
Expand Up @@ -94,15 +94,18 @@ export function createCommonLanguageServer(
connection.client.register(vscode.DidChangeWatchedFilesNotification.type, {
watchers: [
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ({ globPattern: `**/*.${ext.extension}` }))).flat(),
{ globPattern: '**/*.js' },
{ globPattern: '**/*.cjs' },
{ globPattern: '**/*.mjs' },
{ globPattern: '**/*.ts' },
{ globPattern: '**/*.cts' },
{ globPattern: '**/*.mts' },
{ globPattern: '**/*.jsx' },
{ globPattern: '**/*.tsx' },
{ globPattern: '**/*.json' },
{ globPattern: `**/*.{${[
'js',
'cjs',
'mjs',
'ts',
'cts',
'mts',
'jsx',
'tsx',
'json',
...plugins.map(plugin => plugin.extraFileExtensions.map(ext => ext.extension)).flat(),
].join(',')}}` },
]
});
}
Expand Down

0 comments on commit 2694088

Please sign in to comment.