| 20 | } |
| 21 | |
| 22 | export const ConfigurationFeature: Feature<_RemoteWorkspace, Configuration> = (Base) => { |
| 23 | return class extends Base { |
| 24 | |
| 25 | getConfiguration(arg?: string | ConfigurationItem | ConfigurationItem[]): Thenable<any> { |
| 26 | if (!arg) { |
| 27 | return this._getConfiguration({}); |
| 28 | } else if (Is.string(arg)) { |
| 29 | return this._getConfiguration({ section: arg }) |
| 30 | } else { |
| 31 | return this._getConfiguration(arg); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | private _getConfiguration(arg: ConfigurationItem | ConfigurationItem[]): Thenable<any> { |
| 36 | let params: ConfigurationParams = { |
| 37 | items: Array.isArray(arg) ? arg : [arg] |
| 38 | }; |
| 39 | return this.connection.sendRequest(ConfigurationRequest.type, params).then((result) => { |
| 40 | return Array.isArray(arg) ? result : result[0]; |
| 41 | }); |
| 42 | } |
| 43 | } |
| 44 | } |