Skip to content
This repository was archived by the owner on Nov 6, 2018. It is now read-only.

Commit e56d327

Browse files
committed
refactor: remove old configuration
1 parent a2456ca commit e56d327

15 files changed

+5
-549
lines changed

src/client/client.integration.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ describe('Client', () => {
3232
try {
3333
assert.deepStrictEqual(params, {
3434
capabilities: { experimental: 'test' },
35-
configurationCascade: { merged: {} },
3635
trace: Trace.Off,
3736
} as InitializeParams)
3837
resolve()

src/client/client.ts

-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ export class Client implements Unsubscribable {
178178
capabilities: {
179179
experimental: this.options.experimentalClientCapabilities,
180180
},
181-
configurationCascade: { merged: {} },
182181
trace: this._trace || Trace.Off,
183182
}
184183

src/client/controller.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import {
1111
import { Trace } from '../protocol/jsonrpc2/trace'
1212
import { isEqual } from '../util'
1313
import { Client, ClientOptions } from './client'
14-
import { applyContextUpdate, EMPTY_CONTEXT } from './context/context'
14+
import { EMPTY_CONTEXT } from './context/context'
1515
import { createObservableEnvironment, EMPTY_ENVIRONMENT, Environment, ObservableEnvironment } from './environment'
1616
import { Extension } from './extension'
1717
import { ExecuteCommandFeature } from './features/command'
18-
import { ConfigurationChangeNotificationFeature, ConfigurationUpdateFeature } from './features/configuration'
1918
import { ContributionFeature } from './features/contribution'
2019
import {
2120
TextDocumentDefinitionFeature,
@@ -212,16 +211,6 @@ export class Controller<X extends Extension, C extends ConfigurationCascade> imp
212211
}
213212

214213
private registerClientFeatures(client: Client, configuration: Observable<C>): void {
215-
client.registerFeature(new ConfigurationChangeNotificationFeature<C>(client, configuration))
216-
client.registerFeature(
217-
new ConfigurationUpdateFeature(
218-
client,
219-
(params: ConfigurationUpdateParams) =>
220-
new Promise<void>(resolve =>
221-
this._configurationUpdates.next({ ...params, extension: client.id, resolve })
222-
)
223-
)
224-
)
225214
client.registerFeature(new ContributionFeature(this.registries.contribution))
226215
client.registerFeature(new ExecuteCommandFeature(client, this.registries.commands))
227216
client.registerFeature(new TextDocumentDefinitionFeature(client, this.registries.textDocumentDefinition))

src/client/features/configuration.test.ts

-55
This file was deleted.

src/client/features/configuration.ts

-94
This file was deleted.

src/extension/extensionHost.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ describe('createExtensionHost', () => {
1919

2020
const initParams: InitializeParams = {
2121
capabilities: { experimental: { a: 1 } },
22-
configurationCascade: { merged: {} },
2322
}
2423
const initResult: InitializeResult = {}
2524

src/extension/old/api.ts

+2-59
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import { Subscription } from 'rxjs'
2-
import { InitializeParams, Settings } from '../../protocol'
2+
import { InitializeParams } from '../../protocol'
33
import { Connection } from '../../protocol/jsonrpc2/connection'
44

55
/**
66
* The Sourcegraph extension API, which extensions use to interact with the client.
77
*
88
* @template C the extension's settings
99
*/
10-
export interface SourcegraphExtensionAPI<C = Settings> {
10+
export interface SourcegraphExtensionAPI<C = any> {
1111
/**
1212
* The params passed by the client in the `initialize` request.
1313
*/
1414
initializeParams: InitializeParams
1515

16-
/**
17-
* The configuration settings from the client.
18-
*/
19-
configuration: Configuration<C>
20-
2116
/**
2217
* Command registration and execution.
2318
*/
@@ -64,58 +59,6 @@ export interface Observable<T> {
6459
[Symbol.observable]?(): any
6560
}
6661

67-
/**
68-
* Configuration settings for a specific resource (such as a file, directory, or repository) or subject (such as a
69-
* user or organization, depending on the client).
70-
*
71-
* It may be merged from the following sources of settings, in order:
72-
*
73-
* - Default settings
74-
* - Global settings
75-
* - Organization settings (for all organizations the user is a member of)
76-
* - User settings
77-
* - Client settings
78-
* - Repository settings
79-
* - Directory settings
80-
*
81-
* @template C configuration type
82-
*/
83-
export interface Configuration<C> extends Observable<C> {
84-
/**
85-
* Returns a value from the configuration.
86-
*
87-
* @template K Valid keys on the configuration object.
88-
* @param key The name of the configuration property to get.
89-
* @return The configuration value, or undefined.
90-
*/
91-
get<K extends keyof C>(key: K): C[K] | undefined
92-
93-
/**
94-
* Observes changes to the configuration values for the given keys.
95-
*
96-
* @template K Valid keys on the configuration object.
97-
* @param keys The names of the configuration properties to observe.
98-
* @return An observable that emits when any of the keys' values change (using deep comparison).
99-
*/
100-
watch<K extends keyof C>(...keys: K[]): Observable<Pick<C, K>>
101-
102-
/**
103-
* Updates the configuration value for the given key. The updated configuration value is sent to the client for
104-
* persistence.
105-
*
106-
* @template K Valid keys on the configuration object.
107-
* @param key The name of the configuration property to update.
108-
* @param value The new value, or undefined to remove it.
109-
* @return A promise that resolves when the client acknowledges the update.
110-
*/
111-
update<K extends keyof C>(key: K, value: C[K] | undefined): Promise<void>
112-
113-
// TODO: Future plans:
114-
//
115-
// - add a way to read configuration from a specific scope (aka subject, but "scope" is probably a better word)
116-
// - describe how configuration defaults are supported
117-
}
118-
11962
/**
12063
* Command registration and execution.
12164
*/

src/extension/old/extensionHost.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ describe('activateExtension (old)', () => {
1818

1919
const initParams: InitializeParams = {
2020
capabilities: {},
21-
configurationCascade: { merged: {} },
2221
}
2322
const initResult: InitializeResult = {}
2423

src/extension/old/extensionHost.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Subscription } from 'rxjs'
22
import {
3-
ConfigurationCascade,
43
InitializedNotification,
54
InitializeParams,
65
InitializeRequest,
@@ -10,23 +9,17 @@ import {
109
} from '../../protocol'
1110
import { Connection, createConnection, Logger, MessageTransports } from '../../protocol/jsonrpc2/connection'
1211
import { createWebWorkerMessageTransports } from '../../protocol/jsonrpc2/transports/webWorker'
13-
import { Commands, Configuration, Observable, SourcegraphExtensionAPI } from './api'
12+
import { Commands, SourcegraphExtensionAPI } from './api'
1413
import { createExtCommands } from './features/commands'
15-
import { createExtConfiguration } from './features/configuration'
1614

1715
class ExtensionHandle<C> implements SourcegraphExtensionAPI<C> {
18-
public readonly configuration: Configuration<C> & Observable<C>
1916
public readonly commands: Commands
2017

2118
private subscription = new Subscription()
2219

2320
constructor(public readonly rawConnection: Connection, public readonly initializeParams: InitializeParams) {
2421
this.subscription.add(this.rawConnection)
2522

26-
this.configuration = createExtConfiguration<C>(
27-
this.rawConnection,
28-
initializeParams.configurationCascade as ConfigurationCascade<C>
29-
)
3023
this.commands = createExtCommands(this.rawConnection)
3124
}
3225

0 commit comments

Comments
 (0)