-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve ability of downstream apps to control file watching #9163
Conversation
aa702f1
to
c75740f
Compare
c75740f
to
0b5e9a8
Compare
@marechal-p thanks for the review. NsfwFileSystemWatcherServerOptions is definitely a better place than NsfwOptions. The only problem with it is that we are mixing options that are only used single threaded mode together with an option that only applies when using sub-processes, but that's better than mixing with NSFW options. I've made the change. |
@westbury CI is failing: https://github.com/eclipse-theia/theia/pull/9163/checks?check_run_id=2077838349#step:7:242 Sounds like it would be easier to dedicate a binding specifically for this |
0b5e9a8
to
b29bfaa
Compare
@marechal-p yes, I tested my last change only in our application. If I had tested it also in the Electron example then I would have seen the problem. I could have fixed the build break simply by moving the binding of NsfwFileSystemWatcherServerOptions to before the |
The change looks good to me, I just have one last comment:
Sorry for bothering you again, but I thought about this and my conclusion is that we should avoid conditional bindings. The code before always bound a given symbol, the branching is only meant to target a different implementation. With your change, some symbols may or may not be bound. We can always do: if (isBound(identifier)) {
rebind(identifier)...
} But I think those symbols should always be bound ( WDYT? |
b29bfaa
to
4f5f145
Compare
@marechal-p don't worry about bothering me again, we need to get this right as it will be api. I see your point about having some things left unbound depending on the args. We do have different stuff bound depending on, for example, 'backend' vs 'backendElectron' but perhaps that is different. Putting all the options together in one interface with them all optional seemed a little messy. I therefore put them in a discriminating union. I think that more precisely defines the options. Let me know what you think. |
1471a0e
to
113bc84
Compare
It is different in the way that if someone makes a
So now to rebind it, one has to to a dynamic value to test rebind(FileWatcherProcessOptions).toDynamicValue(ctx => {
const options = ctx.container.get(FileWatcherProcessOptions)
if (options.processType === 'multi') {
return { ... }
} else {
return { ... }
}
}); My idea was to always bind both option objects, but conditionally use one or the other. I've pushed a commit on top of your branch with a way I feel would work better? Feel free to either squash it or remove it. |
ea30fb7
to
070c546
Compare
@marechal-p sorry, I totally misunderstood your comment. So basically what we now have is, ignore my last change (back to b29bfaa) and
I have re-tested this for both single and multi-threaded. I cannot squash the commits because I can't sign your changes. They need to be merged as two separate commits. I have, however, taken the liberty of changing the message in your commit. |
Regarding 3) I don't understand either. The parameter was already there, I just slightly rewrote its definition... We can forget about this as I don't know what to make of it :)
Do they? You should be able to squash/fixup your commit using git rebase? Bash: git rebase -i HEAD~2 Rebase todo-list: pick <your commit>
fixup <my commit> Once this is done if you are happy with the changes then I am happy too; I'll approve. edit: If you worry about IP you could add the following line in your commit after squash:
|
Signed-off-by: Nigel Westbury <nigelipse@miegel.org> Co-authored-by: Paul Maréchal <paul.marechal@ericsson.com>
070c546
to
e28183a
Compare
@marechal-p I didn't think I was allowed to squash your commit because of #4279 (comment) . However Thanks for all your time helping with this. |
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 thanks!
What it does
This PR is a small refactoring that makes it easier for extenders to re-implement a file watching strategy.
As an example of a use-case, we have some very large libraries, pulled into sub-folders in projects as symbolic links. We do not want to listen to the library contents but we do want to know if a symbolic link has been changed to reference a different version of the library. We had code to optimize this, and we want to upgrade to include the file watching changes here: #8546
This involves the following changes:
createWatcher
.entryPoint
.FileSystemWatcherService
(when not using a subprocess) into two, first bind the options, then bind the class itself.It is not impossible for us to make our extensions without these changes. However it does make it easier and it avoids us
needing to duplicate chunks of code.
How to test
The code should work exactly the same as before, so test that file watchers still work correctly.
Review checklist
Reminder for reviewers