Skip to content

Use chokidar file system watch #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/application/Watcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict'

import { FSWatcher, watch } from 'fs'
import Event from '../models/Event'
import EventHandler from '../handlers/EventHandler'
import Logger from '../UI/Logger'
Expand All @@ -16,7 +15,7 @@ const TIME_TO_WAIT_FOR_ALL_CHANGES = 1000
* this class handles changes in the curretnt Workspace-folder
*/
export default class Watcher {
private static fsWatcher: FSWatcher
private static fsWatcher: any
private static lastChange: Map<Event, number>
private static changedFiles: Map<Event, Set<string>>
private static excludePaths: string[]
Expand All @@ -26,7 +25,8 @@ export default class Watcher {
* starts listening in the current Workspace-folder
*/
static async start(): Promise<void> {
Watcher.fsWatcher = watch(getWorkspacePath(), { recursive: true }, (_event: string, filename: any) => {
const chokidar = require('chokidar');
Watcher.fsWatcher = chokidar.watch(getWorkspacePath(), (_event: string, filename: any) => {
Watcher.handleFileChange(filename)
})

Expand Down