-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Error revealing files in the explorer #71588
Comments
(Experimental duplicate detection) |
Ok, here's an initial repro with publicly available bits, but you'll need a Dart SDK. I'll see if I can make a standalone repro.
|
Struggling to get an isolated repro... This is essentially what I'm doing (and something very similar to this in the real extension triggers it). The only difference I can think of is that there's a lot more sync fs work before this code runs in the real extension (since we scan PATH looking for SDKs, etc.). export function activate(context: ExtensionContext) {
if (!workspace.workspaceFolders || !workspace.workspaceFolders.length) {
window.showWarningMessage("Open a folder");
}
// some other sync fs work here in real extension
const wf = workspace.workspaceFolders![0];
const dartTriggerFile = path.join(wf.uri.fsPath, "trigger.txt");
if (fs.existsSync(dartTriggerFile)) {
fs.unlinkSync(dartTriggerFile);
createDartProject(wf.uri.fsPath);
}
}
async function createDartProject(projectPath: string): Promise<boolean> {
// const code = await vs.commands.executeCommand("_dart.create", projectPath, templateName) as number;
// return code === 0;
mkDirRecursive(path.join(projectPath, "lib/src/todo_list"));
mkDirRecursive(path.join(projectPath, "test"));
mkDirRecursive(path.join(projectPath, "web"));
fs.writeFileSync(path.join(projectPath, ".gitignore"), "test");
fs.writeFileSync(path.join(projectPath, "CHANGELOG.md"), "test");
fs.writeFileSync(path.join(projectPath, "README.md"), "test");
fs.writeFileSync(path.join(projectPath, "analysis_options.yaml"), "test");
fs.writeFileSync(path.join(projectPath, "lib/app_component.css"), "test");
fs.writeFileSync(path.join(projectPath, "lib/app_component.dart"), "test");
fs.writeFileSync(path.join(projectPath, "lib/app_component.html"), "test");
fs.writeFileSync(path.join(projectPath, "lib/src/todo_list/todo_list_component.css"), "test");
fs.writeFileSync(path.join(projectPath, "lib/src/todo_list/todo_list_component.dart"), "test");
fs.writeFileSync(path.join(projectPath, "lib/src/todo_list/todo_list_component.html"), "test");
fs.writeFileSync(path.join(projectPath, "lib/src/todo_list/todo_list_service.dart"), "test");
fs.writeFileSync(path.join(projectPath, "pubspec.yaml"), "test");
fs.writeFileSync(path.join(projectPath, "test/app_test.dart"), "test");
fs.writeFileSync(path.join(projectPath, "web/favicon.png"), "test");
fs.writeFileSync(path.join(projectPath, "web/index.html"), "test");
fs.writeFileSync(path.join(projectPath, "web/main.dart"), "test");
fs.writeFileSync(path.join(projectPath, "web/styles.css"), "test");
return true;
}
export function mkDirRecursive(folder: string) {
const parent = path.dirname(folder);
if (!fs.existsSync(parent)) {
mkDirRecursive(parent);
}
if (!fs.existsSync(folder)) {
fs.mkdirSync(folder);
}
} |
Aha, the issue is when I try to immediately open one of the created files (which presumably has not yet been refreshed into the explorer):
Just wrapping up a complete repro... |
Here's a complete repro: https://github.com/DanTup/vscode-repro-err-data-tree-node-not-found (extension.ts). Run the extension, then in the dev host, open the "folder_to_open" subfolder. It'll cause code to run that creates a file inside a subfolder and immediately tries to open it. The explorer won't refresh and the error will appear in the console. In a quick test, it only seemed to occur when the created file was in a subfolder. |
@DanTup I can not access this repository https://github.com/DanTup/vscode-repro-err-data-tree-node-not-found |
@isidorn Oops sorry, didn't realise GH Desktop had pushed as private by default. Should be public now :) |
@DanTup now I can access the repo thanks! |
@isidorn There was a sample folder (which just includes a trigger.txt) in the repo: https://github.com/DanTup/vscode-repro-err-data-tree-node-not-found/tree/master/folder_to_open
That's the expected behaviour, however the explorer tree doesn't update to show those changes, and there is the error in the console (in my testing, at least). That said - I've just updated to the latest Insiders and it did not happen... Let me do a little more testing and post back! |
No, I am not :( I'm using:
I'm on macOS Mojave. I'm running in the dev host (opening the repo, pressing F5, then doing what you see here in the dev host). I'm not sure why we're seeing different behaviours :/ (sorry for the slow animation.. the mov2gif service I used slowed it down!) |
I even tried it with Open Editors hidden, as you seem to have - but still repros 🤔 |
I presume the issue is related to it trying to highlight the current file in the Explorer tree, but it's running before the tree is updated from the files being created. Have you disabled tracking of the current file? I notice that when styles.css opens, it doesn't track it in the explorer for you? |
@DanTup great guess! I forgot I have autoReveal: false. When I enable that I can reproduce this. Great steps, thanks a lot! Investigating... |
@isidorn Thanks! Original error is gone, though I do see this error now - not sure if it's related: LMK if I should open a new issue. |
That does not seem to be related. feel free to open a new issue. Adding verified label per your comment. |
Done (#71935)! Thanks! |
Using Insiders 0ac1114 2019-04-01T15:39:08.133Z.
I had VS Code open and ran a command that created some files (see output pane), but they never appeared in the explorer. I opened dev tools and had this:
So far I can only reproduce by running some code I can't share (though it does seem reliable), but it essentially there's a single
.dart
file in the folder that's opened in VS Code, and the extension (during activation) detects that file, runs an external command that writes a bunch of files to this folder, then deletes the original file (it's creating a project from a template).I'll see if I can make something hard-coded that triggers the same issue. If there's anything you want me to try, or if there's a way I can log the file system events or something that might shed light, let me know.
@isidorn
The text was updated successfully, but these errors were encountered: