Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Sep 23, 2024
1 parent a497995 commit 610982d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/svelte-check/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,19 @@ class DiagnosticsWatcher {
filePathsToIgnore: string[],
ignoreInitialAdd: boolean
) {
const ifMatching = (path: string, f: Function) => {
if (/\.(svelte|d\.ts|ts|js|jsx|tsx|mjs|cjs|mts|cts)$/.test(path)) {
f();
}
};
watch(workspaceUri.fsPath, {
ignored: ['node_modules', 'vite.config.{js,ts}.timestamp-*']
ignored: [
'node_modules',
'vite.config.{js,ts}.timestamp-*',
(path) => !/\.(svelte|d\.ts|ts|js|jsx|tsx|mjs|cjs|mts|cts)$/.test(path)
]
.concat(filePathsToIgnore)
.map((ignore) => path.join(workspaceUri.fsPath, ignore)),
ignoreInitial: ignoreInitialAdd
})
.on('add', (path) => ifMatching(path, () => this.updateDocument(path, true)))
.on('unlink', (path) => ifMatching(path, () => this.removeDocument(path)))
.on('change', (path) => ifMatching(path, () => this.updateDocument(path, false)));
.on('add', (path) => this.updateDocument(path, true))
.on('unlink', (path) => this.removeDocument(path))
.on('change', (path) => this.updateDocument(path, false));

if (ignoreInitialAdd) {
this.scheduleDiagnostics();
Expand Down

0 comments on commit 610982d

Please sign in to comment.