-
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
Use file service in preference provider initialization #9362
Use file service in preference provider initialization #9362
Conversation
I have a version of this patch that includes the lazy initialization envisioned in #7426, which I can bring here if desired, or it can be separate work. |
@kittaakos, @tsmaeder, y'all have thought a bit about this. What do you think of this approach? |
packages/preferences/src/browser/abstract-resource-preference-provider.ts
Outdated
Show resolved
Hide resolved
packages/preferences/src/browser/abstract-resource-preference-provider.ts
Outdated
Show resolved
Hide resolved
packages/preferences/src/browser/abstract-resource-preference-provider.ts
Show resolved
Hide resolved
@colin-grant-work I think it would work for the @PostConstruct case I've outlined in the issue. The important thing is to read values before we resolve the |
1d55eb0
to
e1c47e0
Compare
@tsmaeder, are you OK with this even without changing the event emission behavior? I agree in principle that no events should be emitted until after the first read, but that would be a significant change in the behavior of the service, so I'd rather not make the change here; if there's interest in #9367, we can push ahead with a reorganization that makes sure that all framework code is aligned with the new behavior, at least. |
@tsmaeder, any thoughts? |
e1c47e0
to
c6f1e78
Compare
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.
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.
My only minor comments are the naming present in the spec file to align with the majority of the rest of the framework.
packages/preferences/src/browser/abstract-resource-preference-provider.spec.ts
Outdated
Show resolved
Hide resolved
packages/preferences/src/browser/abstract-resource-preference-provider.spec.ts
Outdated
Show resolved
Hide resolved
packages/preferences/src/browser/abstract-resource-preference-provider.spec.ts
Outdated
Show resolved
Hide resolved
c6f1e78
to
c5834ea
Compare
Good point. Done. 👍 |
Signed-off-by: Colin Grant <colin.grant@ericsson.com>
c5834ea
to
0a528c2
Compare
What it does
Fixes #8993 (partially) by ensuring that file-reading preference providers read the contents of their assigned files before declaring themselves ready. Ready state propagates through the scope providers to the
PreferenceService
, so that when thePreferenceService.ready
promise resolves, all of its delegated providers will have read the contents of the files assigned to them. This still means that a.get
call in a@postConstruct
method that does not wait for.ready
promise can get bad data, but the.ready
is now reliable.This PR doesn't go as far as the functionality suggested in #7426 because it still leaves the monaco text model creation logic in the
@postConstruct
method, but it moves closer.How to test
ready
resolves, the expected preference values are available.package.json
that differs from the default. E.g."editor.fontSize" : 24
, and make sure there is no conflicting specification in workspace or folder scopes of the workspace you intend to open.@postConstruct
method that injects thePreferenceService
(e.g.packages/editor/src/browser/editor-navigation-contribution.ts
), add the following lines to the.init()
method:VALUE IMMEDIATELY
log will probably have the default (14
, in this case); the other two should both show the configured value (20
, e.g.)Review checklist
Reminder for reviewers
Signed-off-by: Colin Grant colin.grant@ericsson.com