-
Notifications
You must be signed in to change notification settings - Fork 420
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
Fix folder deletion with VSCode #1821
Fix folder deletion with VSCode #1821
Conversation
Ready for review @filipw @JoeRobich @david-driscoll |
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.
LGTM
@@ -18,6 +20,16 @@ public void Notify(string filePath, FileChangeType changeType = FileChangeType.U | |||
{ | |||
lock (_gate) | |||
{ | |||
if(changeType == FileChangeType.DirectoryDelete) | |||
{ | |||
foreach(var matchingCallback in _callbacksMap.AsEnumerable().Where(x => x.Key.StartsWith(filePath + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))) |
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.
isn't this going to end up calling OnDocumentRemoved twice on a file? once from here as a file and then again through the directory?
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.
True, i will remove that part as it's unnecessary.
Original idea were to hide directory removal specifics from subscribers of file watcher, however since it uses other than full paths (extensions etc) too it were not possible and this was left behind from that version.
Removed at e90ea72
…thub.com/savpek/omnisharp-roslyn into feature/attempt-to-fix-folder-deletion-1
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.
very good change - thanks
VSCode has issue (however by design at current version) where removed folders doesn't send any notifications of removed files because file watcher has some kind of performance optimizations to ignore them.
However watching folders removal is possible. This PR adds support for omnishar-roslyn side so clients can notify removed directory instead of single files if needed -> which can be impelemented properly with current VSCode file watcher.
This fixes one of most common issue that requires omnisharp restart on any directory rename/move/... operation.
Vscode side implementation: dotnet/vscode-csharp#3829