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

Commit 7911fca

Browse files
committed
refactor: remove unneeded decorations and windows impl
1 parent 5f01dbf commit 7911fca

14 files changed

+7
-419
lines changed

src/client/controller.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { Extension } from './extension'
1717
import { ExecuteCommandFeature } from './features/command'
1818
import { ConfigurationChangeNotificationFeature, ConfigurationUpdateFeature } from './features/configuration'
1919
import { ContributionFeature } from './features/contribution'
20-
import { TextDocumentDecorationFeature } from './features/decoration'
2120
import {
2221
TextDocumentDefinitionFeature,
2322
TextDocumentImplementationFeature,
@@ -233,7 +232,6 @@ export class Controller<X extends Extension, C extends ConfigurationCascade> imp
233232
client.registerFeature(
234233
new TextDocumentTypeDefinitionFeature(client, this.registries.textDocumentTypeDefinition)
235234
)
236-
client.registerFeature(new TextDocumentDecorationFeature(client, this.registries.textDocumentDecoration))
237235
client.registerFeature(
238236
new WindowShowMessageFeature(
239237
client,

src/client/features/decoration.test.ts

-40
This file was deleted.

src/client/features/decoration.ts

-63
This file was deleted.

src/client/providers/decoration.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as assert from 'assert'
22
import { of } from 'rxjs'
33
import { TestScheduler } from 'rxjs/testing'
44
import { TextDocumentIdentifier } from '../../client/types/textDocument'
5-
import { TextDocumentDecoration } from '../../protocol'
5+
import { TextDocumentDecoration } from '../../protocol/plainTypes'
66
import { getDecorations, ProvideTextDocumentDecorationSignature } from './decoration'
77
import { FIXTURE as COMMON_FIXTURE } from './registry.test'
88

src/client/providers/decoration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { combineLatest, Observable } from 'rxjs'
22
import { map, switchMap } from 'rxjs/operators'
33
import { TextDocumentIdentifier } from '../../client/types/textDocument'
4-
import { TextDocumentDecoration } from '../../protocol/decoration'
4+
import { TextDocumentDecoration } from '../../protocol/plainTypes'
55
import { FeatureProviderRegistry } from './registry'
66
import { flattenAndCompact } from './util'
77

src/extension/extensionHost.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('createExtensionHost', () => {
1818
clientConnection.listen()
1919

2020
const initParams: InitializeParams = {
21-
capabilities: { decoration: true, experimental: { a: 1 } },
21+
capabilities: { experimental: { a: 1 } },
2222
configurationCascade: { merged: {} },
2323
}
2424
const initResult: InitializeResult = {}

src/extension/old/api.ts

+1-69
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Subscription } from 'rxjs'
2-
import * as sourcegraph from 'sourcegraph'
3-
import { TextDocumentIdentifier } from '../../client/types/textDocument'
4-
import { InitializeParams, Settings, TextDocumentDecoration } from '../../protocol'
2+
import { InitializeParams, Settings } from '../../protocol'
53
import { Connection } from '../../protocol/jsonrpc2/connection'
64

75
/**
@@ -20,17 +18,6 @@ export interface SourcegraphExtensionAPI<C = Settings> {
2018
*/
2119
configuration: Configuration<C>
2220

23-
/**
24-
* The application windows on the client.
25-
*/
26-
windows: Windows
27-
28-
/**
29-
* The active window, or `null` if there is no active window. The active window is the window that was
30-
* focused most recently.
31-
*/
32-
activeWindow: Window | null
33-
3421
/**
3522
* Command registration and execution.
3623
*/
@@ -129,61 +116,6 @@ export interface Configuration<C> extends Observable<C> {
129116
// - describe how configuration defaults are supported
130117
}
131118

132-
/**
133-
* The application windows on the client.
134-
*/
135-
export interface Windows extends Observable<Window[]> {
136-
/**
137-
* Display a prompt and request text input from the user.
138-
*
139-
* @todo TODO: always shows on the active window if any; should pass window as a param?
140-
*
141-
* @param message The message to show.
142-
* @param defaultValue The default value for the user input, or undefined for no default.
143-
* @returns The user's input, or null if the user (or the client) canceled the input request.
144-
*/
145-
showInputBox(message: string, defaultValue?: string): Promise<string | null>
146-
147-
/**
148-
* Sets the decorations for the given document. All previous decorations for the document are cleared.
149-
*
150-
* @param resource The document to decorate.
151-
* @param decorations The decorations to apply to the document.
152-
*/
153-
setDecorations(resource: TextDocumentIdentifier, decorations: TextDocumentDecoration[]): void
154-
}
155-
156-
/**
157-
* The application window where the client is running.
158-
*/
159-
export interface Window {
160-
/**
161-
* Whether this window is the active window in the application. At most 1 window can be active.
162-
*/
163-
readonly isActive: boolean
164-
165-
/**
166-
* The active user interface component (such as a text editor) in this window, or null if there is no active
167-
* component.
168-
*/
169-
readonly activeComponent: Component | null
170-
}
171-
172-
/**
173-
* A user interface component in an application window (such as a text editor).
174-
*/
175-
export interface Component {
176-
/**
177-
* Whether this component is the active component in the application. At most 1 component can be active.
178-
*/
179-
readonly isActive: boolean
180-
181-
/**
182-
* The URI of the resource (such as a file) that this component is displaying, or null if there is none.
183-
*/
184-
resource: sourcegraph.URI | null
185-
}
186-
187119
/**
188120
* Command registration and execution.
189121
*/

src/extension/old/extensionHost.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('activateExtension (old)', () => {
1717
clientConnection.listen()
1818

1919
const initParams: InitializeParams = {
20-
capabilities: { decoration: true },
20+
capabilities: {},
2121
configurationCascade: { merged: {} },
2222
}
2323
const initResult: InitializeResult = {}

src/extension/old/extensionHost.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ import {
1010
} from '../../protocol'
1111
import { Connection, createConnection, Logger, MessageTransports } from '../../protocol/jsonrpc2/connection'
1212
import { createWebWorkerMessageTransports } from '../../protocol/jsonrpc2/transports/webWorker'
13-
import { Commands, Configuration, Observable, SourcegraphExtensionAPI, Window, Windows } from './api'
13+
import { Commands, Configuration, Observable, SourcegraphExtensionAPI } from './api'
1414
import { createExtCommands } from './features/commands'
1515
import { createExtConfiguration } from './features/configuration'
16-
import { ExtWindows } from './features/windows'
1716

1817
class ExtensionHandle<C> implements SourcegraphExtensionAPI<C> {
1918
public readonly configuration: Configuration<C> & Observable<C>
20-
public get windows(): Windows & Observable<Window[]> {
21-
return this._windows
22-
}
2319
public readonly commands: Commands
2420

25-
private _windows: ExtWindows
2621
private subscription = new Subscription()
2722

2823
constructor(public readonly rawConnection: Connection, public readonly initializeParams: InitializeParams) {
@@ -32,14 +27,9 @@ class ExtensionHandle<C> implements SourcegraphExtensionAPI<C> {
3227
this.rawConnection,
3328
initializeParams.configurationCascade as ConfigurationCascade<C>
3429
)
35-
this._windows = new ExtWindows(this.rawConnection)
3630
this.commands = createExtCommands(this.rawConnection)
3731
}
3832

39-
public get activeWindow(): Window | null {
40-
return this._windows.activeWindow
41-
}
42-
4333
public close(): void {
4434
this.subscription.unsubscribe()
4535
}

src/extension/old/features/windows.test.ts

-81
This file was deleted.

0 commit comments

Comments
 (0)