-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Avoid using chokidar (Fix #762) #763
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
npm install | ||
vsce package | ||
code --install-extension code-settings-sync-2.9.0.vsix | ||
code --install-extension code-settings-sync-3.2.4.vsix |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
"use strict"; | ||
import * as chokidar from "chokidar"; | ||
import * as fs from "fs-extra"; | ||
import * as vscode from "vscode"; | ||
import { Environment } from "./environmentPath"; | ||
|
@@ -97,14 +96,12 @@ export default class Commons { | |
} | ||
|
||
let uploadStopped: boolean = true; | ||
Commons.extensionWatcher = chokidar.watch(this.en.ExtensionFolder, { | ||
depth: 0, | ||
ignoreInitial: true | ||
}); | ||
Commons.configWatcher = chokidar.watch(this.en.PATH + "/User/", { | ||
depth: 2, | ||
ignoreInitial: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be great if you can write details how are you handling these situations on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The watcher doesn't watch the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, I checked this behavior. Add the following code for check, and Commons.configWatcher.onDidCreate(async (uri: vscode.Uri) => {
const path: string = uri.path;
console.log("Added: " + path);
}); I also checked the case of |
||
}); | ||
Commons.extensionWatcher = vscode.workspace.createFileSystemWatcher( | ||
this.en.ExtensionFolder + "*" | ||
); | ||
Commons.configWatcher = vscode.workspace.createFileSystemWatcher( | ||
this.en.PATH + "/User/" + "{*,*/*,*/*/*}" // depth: 2 | ||
); | ||
|
||
// TODO : Uncomment the following lines when code allows feature to update Issue in github code repo - #14444 | ||
|
||
|
@@ -137,7 +134,9 @@ export default class Commons { | |
// } | ||
// }); | ||
|
||
Commons.configWatcher.on("change", async (path: string) => { | ||
Commons.configWatcher.onDidChange(async (uri: vscode.Uri) => { | ||
const path: string = uri.path; | ||
|
||
// check sync is locking | ||
if (await lockfile.Check(this.en.FILE_SYNC_LOCK)) { | ||
uploadStopped = false; | ||
|
@@ -234,10 +233,10 @@ export default class Commons { | |
|
||
public CloseWatch(): void { | ||
if (Commons.configWatcher != null) { | ||
Commons.configWatcher.close(); | ||
Commons.configWatcher.dispose(); | ||
} | ||
if (Commons.extensionWatcher != null) { | ||
Commons.extensionWatcher.close(); | ||
Commons.extensionWatcher.dispose(); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are you handling the
depth
as 2 in File System WatcherThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the watcher should not watch under directories in
workspaceStorage
.OK, I'll try handling it! Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shanalikhan
Fixed by 758baf7
But it's not beautiful way... umm...