Skip to content
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

Project Organizer: Monitor project directory for changes automatically. #332

Open
codebrainz opened this issue Jan 14, 2016 · 4 comments
Open

Comments

@codebrainz
Copy link
Member

@techee would you be opposed to this if I were to make a pull request? I remember you said before you never implemented it because you wanted to keep the plugin simple [citation needed], but if I were able to make a simple enough patch that used GFileMonitor to watch the top directory, and trigger the same code path as the Reload button follows now, when a change is detected, would be OK with it?

Edit: I'm not sure if GFileMonitor supports recursive directory monitoring, so it may not even be possible to do what I was hoping simply enough, but I'd still be interested to know if a PR would be accepted if a "simple enough" solution could be implemented.

@techee
Copy link
Member

techee commented Jan 14, 2016

@codebrainz If it's configurable (can be disabled) I'm fine with it. But it will also require that the tree state in the sidebar is remembered (what is expanded, scrolled position) and at least for the Symbol view which does something similar this leads to a quite complex code. Having the tree collapsed/scrolled every time something new appears might be really annoying.

@techee
Copy link
Member

techee commented Jan 14, 2016

If you want to add this feature it would be best to insert/delete the individual files to/from the tree individually instead of making a full reload - this way the tree view will stay at its current position.

@techee techee removed their assignment Jul 10, 2016
@techee
Copy link
Member

techee commented Jul 10, 2016

I probably won't implement it myself so removing the assignment. If anyone wants to implement it (in a reasonably compact and efficient way), I'll definitely review the patch.

@lpaulsen93
Copy link
Contributor

I'm not sure if GFileMonitor supports recursive directory monitoring, so it may not even be possible to do what I was hoping simply enough,...

I implemented an automatic live update in the workbench plugin in PR #695. I can say that it requires a bit effort because recursive directory monitoring is not possible. That means you have to generate a file monitor for each directory and each sub-directory contained in it.

Also a manual re-scan is required sometimes. Let's assume the following situation of existing files and directories:

  • dir1
    • file1.1
    • file1.2
  • dir2
    • file2.1
    • file2.2

Now someone copies in a new directory with 2 files in it, so the filesystem would look like this:

  • dir1
    • file1.1
    • file1.2
  • dir2
    • file2.1
    • file2.2
  • dir3
    • file3.1
    • file3.2

The file monitoring will only notify you about the new filepath for dir3. But you need to re-scan the directory on that event to also recognizes the files contained in it (and of course create a new file monitor for it to be notified of future changes in dir3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants