Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Add Preference API #30

Merged
merged 4 commits into from
Jun 18, 2018
Merged

Add Preference API #30

merged 4 commits into from
Jun 18, 2018

Conversation

akurinnoy
Copy link

resolves eclipse-che/che#9597

Signed-off-by: Oleksii Kurinnyi okurinny@redhat.com

@benoitf
Copy link

benoitf commented Jun 12, 2018

is packages/core/src/browser/preferences/preference-service.ts changes has been sumitted upstream ?


export interface HostedPluginManagerExt {
$initialize(contextPath: string, pluginMedata: PluginMetadata): void;
$initialize(contextPath: string, pluginMetadata: PluginMetadata): void;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK it was me that added it with a wrong name :o

* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/

export function deepClone<T>(obj: T): T {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -66,6 +66,9 @@ export class PreferenceFrontendContribution implements CommandContribution, Menu

protected async openWorkspacePreferences(): Promise<void> {
const wsUri = await this.workspacePreferenceProvider.getUri();
if (!wsUri) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported upstream ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already merged
eclipse-theia#2083

@@ -41,7 +48,7 @@ export abstract class AbstractResourcePreferenceProvider extends PreferenceProvi
}
}

abstract getUri(): MaybePromise<URI>;
abstract getUri(): MaybePromise<URI | undefined>;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported upstream ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already merged

const root = await this.workspaceService.root;
if (root) {
const rootUri = new URI(root.uri);
return rootUri.resolve('.theia').resolve('settings.json');
}
return new Promise<URI>(() => { });
return undefined;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported upstream ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already merged

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so do you need to rebase current master branch with upstream master branch ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice, but later
because I have to open another one PR for #30 (comment)

@akurinnoy
Copy link
Author

is packages/core/src/browser/preferences/preference-service.ts changes has been sumitted upstream ?

for the time being, no
I'll open a PR

@benoitf
Copy link

benoitf commented Jun 13, 2018

FYI I rebased this branch to the "rebased master branch"

clonedTarget = clonedTarget ? cloneTarget : lookUp(clonedConfig, accessor);
};
return isObject(target)
? new Proxy(target, {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to use ternary operator here, its hard to read

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll refactor this piece of code

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
@akurinnoy
Copy link
Author

CQ for lodash.cloneDeep
https://dev.eclipse.org/ipzilla/show_bug.cgi?id=16738

"@theia/monaco": "^0.3.11",
"@theia/plugin": "^0.3.11",
"@theia/workspace": "^0.3.11",
"@types/lodash.clonedeep": "^4.5.3",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should @types be moved to dev dependency ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I'll fix it

export class PreferenceRegistryMainImpl implements PreferenceRegistryMain {
private proxy: PreferenceRegistryExt;
private preferenceService: PreferenceService;
private preferenceServiceImpl: PreferenceServiceImpl;
Copy link

@AndrienkoAleksandr AndrienkoAleksandr Jun 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable uses only inside constructor. So maybe Should this constant has locale scope?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense, I'll fix it.

To change preference:
```javascript
preferences.update('tabSize', 2);
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you apply doc for plugin writers how to use: onDidChangeConfiguration ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add an example how to use it.

},
onDidChangeConfiguration(listener, thisArgs?, disposables?): theia.Disposable {
return preferenceRegistryExt.onDidChangeConfiguration(listener, thisArgs, disposables);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is update method?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getConfiguration returns an object with WorkspaceConfiguration interface. There is method update implemented.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@mmorhun mmorhun merged commit c44227e into master Jun 18, 2018
@mmorhun mmorhun deleted the CHE-9597 branch June 18, 2018 09:27
benoitf pushed a commit that referenced this pull request Jun 18, 2018
* implement Preference API

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
benoitf pushed a commit that referenced this pull request Jun 18, 2018
* implement Preference API

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
benoitf pushed a commit that referenced this pull request Jun 19, 2018
* implement Preference API

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
benoitf pushed a commit that referenced this pull request Jun 19, 2018
* implement Preference API

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce the Preferences API
6 participants