posit-dev / publisher

MIT License
3 stars 0 forks source link

File watcher issue on Linux (from Connect team demo) #1216

Open mmarchetti opened 3 months ago

mmarchetti commented 3 months ago

On Linux, file watchers were not working and the user had to click the Refresh button to get the info to update.

mmarchetti commented 3 months ago

We may need to circle back with Brian to see if he can repro, and give us more information from logs or about whether normal VSCode file watching behaviors are working.

kgartland-rstudio commented 3 months ago

I was just able to reproduce this now. It works on Ubuntu arm64 but I can reproduce on Ubuntu amd64.

I found this in my sharedProcess.log:

2024-03-27 14:41:18.410 [error] [uncaught exception in sharedProcess]: Event not found: onDidChange: CodeExpectedError: Event not found: onDidChange
    at Object.listen (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:45:4960)
    at E.t (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:44:251)
    at E.q (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:43:4371)
    at y.value (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:43:3602)
    at d.y (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:38:1902)
    at d.z (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:38:1972)
    at d.fire (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:38:2188)
    at MessagePortMain.fe (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:36:30382)
    at MessagePortMain.emit (node:events:514:28)
    at Object.emit (node:electron/js2c/utility_init:2:2285)
2024-03-27 14:41:18.856 [error] [uncaught exception in sharedProcess]: Event not found: onDidChange: CodeExpectedError: Event not found: onDidChange
    at Object.listen (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:45:4960)
    at E.t (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:44:251)
    at E.q (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:43:4371)
    at y.value (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:43:3602)
    at d.y (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:38:1902)
    at d.z (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:38:1972)
    at d.fire (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:38:2188)
    at MessagePortMain.fe (/usr/share/code/resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:36:30382)
    at MessagePortMain.emit (node:events:514:28)
    at Object.emit (node:electron/js2c/utility_init:2:2285)

^^ turns out that's unrelated. That error does not occur when this issue happens.

It seems to occur ONLY when you open a project that doesn't have the .posit directory available when you launch VSCode. If the .posit directory exists and you open the project in VSCode, the watch works properly.

Could the watcher only be able to "watch" the folders that already exist at launch time?

mmarchetti commented 3 months ago

Thanks for recreating!

There is also https://github.com/microsoft/vscode/issues/186540, not sure if it's related.

mmarchetti commented 3 months ago

It seems to occur ONLY when you open a project that doesn't have the .posit directory available when you launch VSCode

Maybe we should defer creation of the file watchers. Currently, they run as part of register, which runs as soon as the extension loads. We could defer them until the view is shown, which won't happen until the project is initialized. Maybe the first call to getChildren?