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

Commit b335a0f

Browse files
authored
feat: save initialize params (#28)
This will be useful for accessing experimental client capabilities on the server.
1 parent ad4a995 commit b335a0f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/extension/api.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Subscription } from 'rxjs'
22
import { Context } from '../environment/context/context'
33
import { MessageConnection } from '../jsonrpc2/connection'
4-
import { Settings } from '../protocol'
4+
import { InitializeParams, Settings } from '../protocol'
55
import { URI } from '../types/textDocument'
66

77
/**
@@ -10,6 +10,11 @@ import { URI } from '../types/textDocument'
1010
* @template C the extension's settings
1111
*/
1212
export interface CXP<C = Settings> {
13+
/**
14+
* The params passed by the client in the `initialize` request.
15+
*/
16+
initializeParams: InitializeParams
17+
1318
/**
1419
* The root URI of the workspace in which this extension is running.
1520
*

src/extension/extension.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ describe('activateExtension', () => {
2424
}
2525

2626
const [, result] = await Promise.all([
27-
activateExtension<{}>(serverTransports, () => void 0),
27+
activateExtension<{}>(serverTransports, cxp => {
28+
assert.deepStrictEqual(cxp.initializeParams, initParams)
29+
}),
2830
clientConnection.sendRequest(InitializeRequest.type, initParams).then(result => {
2931
clientConnection.sendNotification(InitializedNotification.type, initParams)
3032
return result

0 commit comments

Comments
 (0)