@jupyterlab/lsp 4.1.0-alpha.1 → 4.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/adapters/adapter.d.ts +20 -3
  2. package/lib/adapters/adapter.js +55 -2
  3. package/lib/adapters/adapter.js.map +1 -1
  4. package/lib/adapters/editorAdapter.d.ts +74 -0
  5. package/lib/adapters/editorAdapter.js +53 -0
  6. package/lib/adapters/editorAdapter.js.map +1 -0
  7. package/lib/adapters/index.d.ts +3 -0
  8. package/lib/adapters/index.js +6 -0
  9. package/lib/adapters/index.js.map +1 -0
  10. package/lib/adapters/tracker.d.ts +106 -0
  11. package/lib/adapters/tracker.js +175 -0
  12. package/lib/adapters/tracker.js.map +1 -0
  13. package/lib/connection_manager.d.ts +11 -5
  14. package/lib/connection_manager.js +10 -0
  15. package/lib/connection_manager.js.map +1 -1
  16. package/lib/feature.d.ts +7 -2
  17. package/lib/feature.js +17 -4
  18. package/lib/feature.js.map +1 -1
  19. package/lib/index.d.ts +1 -1
  20. package/lib/index.js +1 -1
  21. package/lib/index.js.map +1 -1
  22. package/lib/lsp.d.ts +1 -0
  23. package/lib/lsp.js.map +1 -1
  24. package/lib/tokens.d.ts +132 -10
  25. package/lib/tokens.js +17 -0
  26. package/lib/tokens.js.map +1 -1
  27. package/lib/virtual/document.d.ts +7 -3
  28. package/lib/virtual/document.js +51 -13
  29. package/lib/virtual/document.js.map +1 -1
  30. package/package.json +12 -10
  31. package/src/adapters/adapter.ts +87 -6
  32. package/src/adapters/editorAdapter.ts +131 -0
  33. package/src/adapters/index.ts +6 -0
  34. package/src/adapters/tracker.ts +222 -0
  35. package/src/connection_manager.ts +23 -7
  36. package/src/feature.ts +20 -5
  37. package/src/index.ts +1 -1
  38. package/src/lsp.ts +2 -0
  39. package/src/tokens.ts +155 -13
  40. package/src/virtual/document.ts +62 -16
  41. package/style/index.css +2 -0
  42. package/style/index.js +2 -0
@@ -0,0 +1,222 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+
4
+ import { DocumentWidget } from '@jupyterlab/docregistry';
5
+
6
+ import { ISignal, Signal } from '@lumino/signaling';
7
+
8
+ import { WidgetLSPAdapter } from './adapter';
9
+ import { IShell, IWidgetLSPAdapterTracker } from '../tokens';
10
+
11
+ /**
12
+ * A class that keeps track of widget adapter instances.
13
+ *
14
+ * @typeparam T - The type of widget being tracked. Defaults to `WidgetLSPAdapter`.
15
+ */
16
+ export class WidgetLSPAdapterTracker<
17
+ T extends WidgetLSPAdapter = WidgetLSPAdapter
18
+ > implements IWidgetLSPAdapterTracker<T>
19
+ {
20
+ /**
21
+ * Create a new widget tracker.
22
+ *
23
+ * @param options - The instantiation options for a widget tracker.
24
+ */
25
+ constructor(options: WidgetLSPAdapterTracker.IOptions) {
26
+ const shell = (this._shell = options.shell);
27
+
28
+ shell.currentChanged.connect((_, args) => {
29
+ let newValue = args.newValue;
30
+
31
+ if (!newValue || !(newValue instanceof DocumentWidget)) {
32
+ console.log('No current widget');
33
+ return;
34
+ }
35
+
36
+ const adapter = this.find(value => value.widget === newValue);
37
+
38
+ if (!adapter) {
39
+ return;
40
+ }
41
+
42
+ this._current = adapter;
43
+ this._currentChanged.emit(adapter);
44
+ });
45
+ }
46
+
47
+ /**
48
+ * A signal emitted when the current adapter changes.
49
+ */
50
+ get currentChanged(): ISignal<this, T | null> {
51
+ return this._currentChanged;
52
+ }
53
+
54
+ /**
55
+ * The current adapter is the most recently focused or added adapter.
56
+ *
57
+ * #### Notes
58
+ * It is the most recently focused adapter, or the most recently added
59
+ * adapter if no adapter has taken focus.
60
+ */
61
+ get currentAdapter(): T | null {
62
+ return this._current;
63
+ }
64
+
65
+ /**
66
+ * The number of adapter held by the tracker.
67
+ */
68
+ get size(): number {
69
+ return this._adapters.size;
70
+ }
71
+
72
+ /**
73
+ * A signal emitted when an adapter is added.
74
+ */
75
+ get adapterAdded(): ISignal<this, T> {
76
+ return this._adapterAdded;
77
+ }
78
+
79
+ /**
80
+ * A signal emitted when an adapter is updated.
81
+ */
82
+ get adapterUpdated(): ISignal<this, T> {
83
+ return this._adapterUpdated;
84
+ }
85
+
86
+ /**
87
+ * Add a new adapter to the tracker.
88
+ *
89
+ * @param adapter - The adapter being added.
90
+ *
91
+ * #### Notes.
92
+ * The newly added adapter becomes the current adapter unless the shell
93
+ * already had a DocumentWidget as the activeWidget.
94
+ */
95
+ add(adapter: T): void {
96
+ if (adapter.isDisposed) {
97
+ const warning = 'A disposed object cannot be added.';
98
+ console.warn(warning, adapter);
99
+ throw new Error(warning);
100
+ }
101
+
102
+ if (this._adapters.has(adapter)) {
103
+ const warning = 'This object already exists in the pool.';
104
+ console.warn(warning, adapter);
105
+ throw new Error(warning);
106
+ }
107
+
108
+ this._adapters.add(adapter);
109
+ this._adapterAdded.emit(adapter);
110
+
111
+ adapter.disposed.connect(() => {
112
+ this._adapters.delete(adapter);
113
+
114
+ if (adapter === this._current) {
115
+ this._current = null;
116
+ this._currentChanged.emit(this._current);
117
+ }
118
+ }, this);
119
+
120
+ // Only update the current adapter, when there is no shell.activeWidget
121
+ // or the active widget is not a DocumentWidget
122
+ // We will be able to use other panels while keeping the current adapter.
123
+ const active = this._shell.activeWidget;
124
+ if (!active || !(active instanceof DocumentWidget)) {
125
+ this._current = adapter;
126
+ this._currentChanged.emit(adapter);
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Test whether the tracker is disposed.
132
+ */
133
+ get isDisposed(): boolean {
134
+ return this._isDisposed;
135
+ }
136
+
137
+ /**
138
+ * Dispose of the resources held by the tracker.
139
+ */
140
+ dispose(): void {
141
+ if (this.isDisposed) {
142
+ return;
143
+ }
144
+ this._isDisposed = true;
145
+ this._adapters.clear();
146
+ Signal.clearData(this);
147
+ }
148
+
149
+ /**
150
+ * Find the first adapter in the tracker that satisfies a filter function.
151
+ *
152
+ * @param - fn The filter function to call on each adapter.
153
+ *
154
+ * #### Notes
155
+ * If no adapter is found, the value returned is `undefined`.
156
+ */
157
+ find(fn: (adapter: T) => boolean): T | undefined {
158
+ const values = this._adapters.values();
159
+ for (const value of values) {
160
+ if (fn(value)) {
161
+ return value;
162
+ }
163
+ }
164
+ return undefined;
165
+ }
166
+
167
+ /**
168
+ * Iterate through each adapter in the tracker.
169
+ *
170
+ * @param fn - The function to call on each adapter.
171
+ */
172
+ forEach(fn: (adapter: T) => void): void {
173
+ this._adapters.forEach(fn);
174
+ }
175
+
176
+ /**
177
+ * Filter the adapter in the tracker based on a predicate.
178
+ *
179
+ * @param fn - The function by which to filter.
180
+ */
181
+ filter(fn: (adapter: T) => boolean): T[] {
182
+ const filtered: T[] = [];
183
+ this.forEach(value => {
184
+ if (fn(value)) {
185
+ filtered.push(value);
186
+ }
187
+ });
188
+ return filtered;
189
+ }
190
+
191
+ /**
192
+ * Check if this tracker has the specified adapter.
193
+ *
194
+ * @param adapter - The adapter whose existence is being checked.
195
+ */
196
+ has(adapter: T): boolean {
197
+ return this._adapters.has(adapter);
198
+ }
199
+
200
+ private _isDisposed = false;
201
+ private _shell: IShell;
202
+ private _current: T | null = null;
203
+ private _adapters = new Set<T>();
204
+ private _adapterAdded = new Signal<this, T>(this);
205
+ private _adapterUpdated = new Signal<this, T>(this);
206
+ private _currentChanged = new Signal<this, T | null>(this);
207
+ }
208
+
209
+ /**
210
+ * A namespace for `WidgetLSPAdapterTracker` statics.
211
+ */
212
+ export namespace WidgetLSPAdapterTracker {
213
+ /**
214
+ * The instantiation options for the WidgetLSPAdapterTracker.
215
+ */
216
+ export interface IOptions {
217
+ /**
218
+ * The JupyterLab shell for tracking all widgets.
219
+ */
220
+ shell: IShell;
221
+ }
222
+ }
@@ -2,10 +2,9 @@
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
4
  import { PageConfig, URLExt } from '@jupyterlab/coreutils';
5
- import { IDocumentWidget } from '@jupyterlab/docregistry';
6
5
  import { ISignal, Signal } from '@lumino/signaling';
7
6
 
8
- import { WidgetLSPAdapter } from './adapters/adapter';
7
+ import { WidgetLSPAdapter } from './adapters';
9
8
  import { LSPConnection } from './connection';
10
9
  import { ClientCapabilities } from './lsp';
11
10
  import { AskServersToSendTraceNotifications } from './plugin';
@@ -16,6 +15,7 @@ import {
16
15
  ILSPConnection,
17
16
  ILSPDocumentConnectionManager,
18
17
  ISocketConnectionOptions,
18
+ IWidgetLSPAdapterTracker,
19
19
  TLanguageServerConfigurations,
20
20
  TLanguageServerId,
21
21
  TServerKeys
@@ -40,6 +40,11 @@ export class DocumentConnectionManager
40
40
  this._ignoredLanguages = new Set();
41
41
  this.languageServerManager = options.languageServerManager;
42
42
  Private.setLanguageServerManager(options.languageServerManager);
43
+
44
+ options.adapterTracker.adapterAdded.connect((_, adapter) => {
45
+ const path = adapter.widget.context.path;
46
+ this.registerAdapter(path, adapter);
47
+ });
43
48
  }
44
49
 
45
50
  /**
@@ -49,9 +54,10 @@ export class DocumentConnectionManager
49
54
  readonly connections: Map<VirtualDocument.uri, LSPConnection>;
50
55
 
51
56
  /**
57
+ * @deprecated
52
58
  * Map between the path of the document and its adapter
53
59
  */
54
- readonly adapters: Map<string, WidgetLSPAdapter<IDocumentWidget>>;
60
+ readonly adapters: Map<string, WidgetLSPAdapter>;
55
61
 
56
62
  /**
57
63
  * Map between the URI of the virtual document and the document itself.
@@ -199,16 +205,21 @@ export class DocumentConnectionManager
199
205
  }
200
206
 
201
207
  /**
208
+ * @deprecated
209
+ *
202
210
  * Register a widget adapter with this manager
203
211
  *
204
212
  * @param path - path to the inner document of the adapter
205
213
  * @param adapter - the adapter to be registered
206
214
  */
207
- registerAdapter(
208
- path: string,
209
- adapter: WidgetLSPAdapter<IDocumentWidget>
210
- ): void {
215
+ registerAdapter(path: string, adapter: WidgetLSPAdapter): void {
211
216
  this.adapters.set(path, adapter);
217
+
218
+ adapter.widget.context.pathChanged.connect((context, newPath) => {
219
+ this.adapters.delete(path);
220
+ this.adapters.set(newPath, adapter);
221
+ });
222
+
212
223
  adapter.disposed.connect(() => {
213
224
  if (adapter.virtualDocument) {
214
225
  this.documents.delete(adapter.virtualDocument.uri);
@@ -535,6 +546,11 @@ export namespace DocumentConnectionManager {
535
546
  * The language server manager instance.
536
547
  */
537
548
  languageServerManager: ILanguageServerManager;
549
+
550
+ /**
551
+ * The WidgetLSPAdapter's tracker.
552
+ */
553
+ adapterTracker: IWidgetLSPAdapterTracker;
538
554
  }
539
555
 
540
556
  /**
package/src/feature.ts CHANGED
@@ -6,13 +6,14 @@ import mergeWith from 'lodash.mergewith';
6
6
 
7
7
  import { ClientCapabilities } from './lsp';
8
8
  import { IFeature, ILSPFeatureManager } from './tokens';
9
+ import { EditorAdapter } from './adapters/editorAdapter';
9
10
 
10
11
  /**
11
12
  * Class to manager the registered features of the language servers.
12
13
  */
13
14
  export class FeatureManager implements ILSPFeatureManager {
14
15
  constructor() {
15
- this._featuresRegistered = new Signal(this);
16
+ this._featureRegistered = new Signal(this);
16
17
  }
17
18
  /**
18
19
  * List of registered features
@@ -22,8 +23,8 @@ export class FeatureManager implements ILSPFeatureManager {
22
23
  /**
23
24
  * Signal emitted when a new feature is registered.
24
25
  */
25
- get featuresRegistered(): ISignal<ILSPFeatureManager, IFeature> {
26
- return this._featuresRegistered;
26
+ get featureRegistered(): ISignal<ILSPFeatureManager, IFeature> {
27
+ return this._featureRegistered;
27
28
  }
28
29
 
29
30
  /**
@@ -36,7 +37,7 @@ export class FeatureManager implements ILSPFeatureManager {
36
37
  );
37
38
  } else {
38
39
  this.features.push(feature);
39
- this._featuresRegistered.emit(feature);
40
+ this._featureRegistered.emit(feature);
40
41
  }
41
42
  }
42
43
 
@@ -54,5 +55,19 @@ export class FeatureManager implements ILSPFeatureManager {
54
55
  return capabilities;
55
56
  }
56
57
 
57
- private _featuresRegistered: Signal<ILSPFeatureManager, IFeature>;
58
+ /**
59
+ * Get the extension factories of all clients.
60
+ */
61
+ extensionFactories(): EditorAdapter.ILSPEditorExtensionFactory[] {
62
+ const factories: EditorAdapter.ILSPEditorExtensionFactory[] = [];
63
+ for (const feature of this.features) {
64
+ if (!feature.extensionFactory) {
65
+ continue;
66
+ }
67
+ factories.push(feature.extensionFactory);
68
+ }
69
+ return factories;
70
+ }
71
+
72
+ private _featureRegistered: Signal<ILSPFeatureManager, IFeature>;
58
73
  }
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * @module lsp
6
6
  */
7
7
 
8
- export * from './adapters/adapter';
8
+ export * from './adapters';
9
9
  export * from './connection_manager';
10
10
  export * from './extractors';
11
11
  export * from './feature';
package/src/lsp.ts CHANGED
@@ -5,6 +5,8 @@ import type * as lsp from 'vscode-languageserver-protocol';
5
5
 
6
6
  export type ClientCapabilities = lsp.ClientCapabilities;
7
7
 
8
+ export type ServerCapabilities = lsp.ServerCapabilities;
9
+
8
10
  export enum DiagnosticSeverity {
9
11
  Error = 1,
10
12
  Warning = 2,
package/src/tokens.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { IDocumentWidget } from '@jupyterlab/docregistry';
5
4
  import { ServerConnection } from '@jupyterlab/services';
5
+ import { CodeEditor } from '@jupyterlab/codeeditor';
6
+
7
+ import { FocusTracker, Widget } from '@lumino/widgets';
6
8
  import { Token } from '@lumino/coreutils';
7
9
  import { IDisposable, IObservableDisposable } from '@lumino/disposable';
8
10
  import { ISignal, Signal } from '@lumino/signaling';
9
11
 
10
- import { WidgetLSPAdapter } from './adapters/adapter';
12
+ import { EditorAdapter, WidgetLSPAdapter } from './adapters';
11
13
  import { IForeignCodeExtractor } from './extractors/types';
12
14
  import {
13
15
  AnyCompletion,
@@ -26,7 +28,7 @@ import {
26
28
 
27
29
  import type * as rpc from 'vscode-jsonrpc';
28
30
  import type * as lsp from 'vscode-languageserver-protocol';
29
- import { CodeEditor } from '@jupyterlab/codeeditor';
31
+
30
32
  export { IDocumentInfo };
31
33
 
32
34
  /**
@@ -367,9 +369,10 @@ export interface ILSPDocumentConnectionManager {
367
369
  documents: Map<VirtualDocument.uri, VirtualDocument>;
368
370
 
369
371
  /**
372
+ * @deprecated
370
373
  * The mapping of document uri to the widget adapter.
371
374
  */
372
- adapters: Map<string, WidgetLSPAdapter<IDocumentWidget>>;
375
+ adapters: Map<string, WidgetLSPAdapter>;
373
376
 
374
377
  /**
375
378
  * Signal emitted when a connection is connected.
@@ -472,15 +475,14 @@ export interface ILSPDocumentConnectionManager {
472
475
  unregisterDocument(uri: string): void;
473
476
 
474
477
  /**
478
+ * @deprecated
479
+ *
475
480
  * Register a widget adapter.
476
481
  *
477
482
  * @param path - path to current document widget of input adapter
478
483
  * @param adapter - the adapter need to be registered
479
484
  */
480
- registerAdapter(
481
- path: string,
482
- adapter: WidgetLSPAdapter<IDocumentWidget>
483
- ): void;
485
+ registerAdapter(path: string, adapter: WidgetLSPAdapter): void;
484
486
  }
485
487
 
486
488
  /**
@@ -498,6 +500,11 @@ export interface IFeature {
498
500
  * LSP capabilities implemented by the feature.
499
501
  */
500
502
  capabilities?: ClientCapabilities;
503
+
504
+ /**
505
+ * Editor extension factory linked to the LSP feature.
506
+ */
507
+ extensionFactory?: EditorAdapter.ILSPEditorExtensionFactory;
501
508
  }
502
509
 
503
510
  /**
@@ -511,6 +518,11 @@ export interface ILSPFeatureManager {
511
518
  */
512
519
  readonly features: IFeature[];
513
520
 
521
+ /**
522
+ * Signal emitted when a feature is registered
523
+ */
524
+ featureRegistered: ISignal<ILSPFeatureManager, IFeature>;
525
+
514
526
  /**
515
527
  * Register the new feature (frontend capability)
516
528
  * for one or more code editor implementations.
@@ -518,14 +530,14 @@ export interface ILSPFeatureManager {
518
530
  register(feature: IFeature): void;
519
531
 
520
532
  /**
521
- * Signal emitted when a feature is registered
533
+ * Get capabilities of all registered features
522
534
  */
523
- featuresRegistered: ISignal<ILSPFeatureManager, IFeature>;
535
+ clientCapabilities(): ClientCapabilities;
524
536
 
525
537
  /**
526
- * Get capabilities of all registered features
538
+ * Get the extension factories of all clients.
527
539
  */
528
- clientCapabilities(): ClientCapabilities;
540
+ extensionFactories(): EditorAdapter.ILSPEditorExtensionFactory[];
529
541
  }
530
542
 
531
543
  /**
@@ -551,6 +563,96 @@ export interface ILSPCodeExtractorsManager {
551
563
  ): void;
552
564
  }
553
565
 
566
+ /**
567
+ * An interface with the necessary properties from `JupyterFrontEnd.IShell`
568
+ * for the `WidgetLSPAdapterTracker`. Used to track the active DocumentWidget.
569
+ *
570
+ * For more info see https://github.com/jupyterlab/jupyterlab/pull/14920#discussion_r1316507818
571
+ * and https://github.com/jupyterlab/jupyterlab/pull/14920#discussion_r1305019718 .
572
+ */
573
+ export interface IShell {
574
+ /**
575
+ * The active widget in the shell's main area.
576
+ */
577
+ readonly activeWidget: Widget | null;
578
+ /**
579
+ * A signal emitted when main area's current focus changes.
580
+ */
581
+ readonly currentChanged: ISignal<this, FocusTracker.IChangedArgs<Widget>>;
582
+ }
583
+
584
+ /**
585
+ * A tracker that tracks WidgetLSPAdapters.
586
+ *
587
+ * @typeparam T - The type of widget being tracked. Defaults to `WidgetLSPAdapter`.
588
+ */
589
+ export interface IWidgetLSPAdapterTracker<
590
+ T extends WidgetLSPAdapter = WidgetLSPAdapter
591
+ > extends IDisposable {
592
+ /**
593
+ * A signal emitted when an adapter is added.
594
+ */
595
+ readonly adapterAdded: ISignal<this, T>;
596
+
597
+ /**
598
+ * The current adapter is the most recently focused or added adapter.
599
+ *
600
+ * #### Notes
601
+ * It is the most recently focused adapter, or the most recently added
602
+ * adapter if no adapter has taken focus.
603
+ */
604
+ readonly currentAdapter: T | null;
605
+
606
+ /**
607
+ * A signal emitted when the current instance changes.
608
+ *
609
+ * #### Notes
610
+ * If the last instance being tracked is disposed, `null` will be emitted.
611
+ */
612
+ readonly currentChanged: ISignal<this, T | null>;
613
+
614
+ /**
615
+ * The number of instances held by the tracker.
616
+ */
617
+ readonly size: number;
618
+
619
+ /**
620
+ * A signal emitted when a adapter is updated.
621
+ */
622
+ readonly adapterUpdated: ISignal<this, T>;
623
+
624
+ /**
625
+ * Find the first instance in the tracker that satisfies a filter function.
626
+ *
627
+ * @param - fn The filter function to call on each instance.
628
+ *
629
+ * #### Notes
630
+ * If nothing is found, the value returned is `undefined`.
631
+ */
632
+ find(fn: (obj: T) => boolean): T | undefined;
633
+
634
+ /**
635
+ * Iterate through each instance in the tracker.
636
+ *
637
+ * @param fn - The function to call on each instance.
638
+ */
639
+ forEach(fn: (obj: T) => void): void;
640
+
641
+ /**
642
+ * Filter the instances in the tracker based on a predicate.
643
+ *
644
+ * @param fn - The function by which to filter.
645
+ */
646
+ filter(fn: (obj: T) => boolean): T[];
647
+
648
+ /**
649
+ * Check if this tracker has the specified instance.
650
+ *
651
+ * @param obj - The object whose existence is being checked.
652
+ */
653
+ has(obj: T): boolean;
654
+ }
655
+
554
656
  /**
555
657
  * @alpha
556
658
  *
@@ -590,6 +692,18 @@ export const ILSPCodeExtractorsManager = new Token<ILSPCodeExtractorsManager>(
590
692
  'Provides the code extractor manager. This token is required in your extension to register code extractor allowing the creation of multiple virtual document from an opened document.'
591
693
  );
592
694
 
695
+ /**
696
+ * @alpha
697
+ *
698
+ * The WidgetLSPAdapter tracker. Require this token in your extension to
699
+ * track WidgetLSPAdapters.
700
+ *
701
+ */
702
+ export const IWidgetLSPAdapterTracker = new Token<IWidgetLSPAdapterTracker>(
703
+ '@jupyterlab/lsp:IWidgetLSPAdapterTracker',
704
+ 'Provides the WidgetLSPAdapter tracker. This token is required in your extension to track WidgetLSPAdapters.'
705
+ );
706
+
593
707
  /**
594
708
  * Argument for creating a connection to the LSP proxy server.
595
709
  */
@@ -638,9 +752,11 @@ export namespace Method {
638
752
 
639
753
  /** Client requests */
640
754
  export enum ClientRequest {
755
+ CODE_ACTION = 'textDocument/codeAction',
641
756
  COMPLETION = 'textDocument/completion',
642
757
  COMPLETION_ITEM_RESOLVE = 'completionItem/resolve',
643
758
  DEFINITION = 'textDocument/definition',
759
+ DOCUMENT_COLOR = 'textDocument/documentColor',
644
760
  DOCUMENT_HIGHLIGHT = 'textDocument/documentHighlight',
645
761
  DOCUMENT_SYMBOL = 'textDocument/documentSymbol',
646
762
  HOVER = 'textDocument/hover',
@@ -649,7 +765,14 @@ export namespace Method {
649
765
  REFERENCES = 'textDocument/references',
650
766
  RENAME = 'textDocument/rename',
651
767
  SIGNATURE_HELP = 'textDocument/signatureHelp',
652
- TYPE_DEFINITION = 'textDocument/typeDefinition'
768
+ TYPE_DEFINITION = 'textDocument/typeDefinition',
769
+ LINKED_EDITING_RANGE = 'textDocument/linkedEditingRange',
770
+ INLINE_VALUE = 'textDocument/inlineValue',
771
+ INLAY_HINT = 'textDocument/inlayHint',
772
+ WORKSPACE_SYMBOL = 'workspace/symbol',
773
+ WORKSPACE_SYMBOL_RESOLVE = 'workspaceSymbol/resolve',
774
+ FORMATTING = 'textDocument/formatting',
775
+ RANGE_FORMATTING = 'textDocument/rangeFormatting'
653
776
  }
654
777
  }
655
778
 
@@ -700,9 +823,11 @@ export interface IServerResult {
700
823
  * Interface describing the request sent to the client.
701
824
  */
702
825
  export interface IClientRequestParams {
826
+ [Method.ClientRequest.CODE_ACTION]: lsp.CodeActionParams;
703
827
  [Method.ClientRequest.COMPLETION_ITEM_RESOLVE]: lsp.CompletionItem;
704
828
  [Method.ClientRequest.COMPLETION]: lsp.CompletionParams;
705
829
  [Method.ClientRequest.DEFINITION]: lsp.TextDocumentPositionParams;
830
+ [Method.ClientRequest.DOCUMENT_COLOR]: lsp.DocumentColorParams;
706
831
  [Method.ClientRequest.DOCUMENT_HIGHLIGHT]: lsp.TextDocumentPositionParams;
707
832
  [Method.ClientRequest.DOCUMENT_SYMBOL]: lsp.DocumentSymbolParams;
708
833
  [Method.ClientRequest.HOVER]: lsp.TextDocumentPositionParams;
@@ -712,15 +837,23 @@ export interface IClientRequestParams {
712
837
  [Method.ClientRequest.RENAME]: lsp.RenameParams;
713
838
  [Method.ClientRequest.SIGNATURE_HELP]: lsp.TextDocumentPositionParams;
714
839
  [Method.ClientRequest.TYPE_DEFINITION]: lsp.TextDocumentPositionParams;
840
+ [Method.ClientRequest.INLINE_VALUE]: lsp.InlineValueParams;
841
+ [Method.ClientRequest.INLAY_HINT]: lsp.InlayHintParams;
842
+ [Method.ClientRequest.WORKSPACE_SYMBOL]: lsp.WorkspaceSymbolParams;
843
+ [Method.ClientRequest.WORKSPACE_SYMBOL_RESOLVE]: lsp.WorkspaceSymbol;
844
+ [Method.ClientRequest.FORMATTING]: lsp.DocumentFormattingParams;
845
+ [Method.ClientRequest.RANGE_FORMATTING]: lsp.DocumentRangeFormattingParams;
715
846
  }
716
847
 
717
848
  /**
718
849
  * Interface describing the responses received from the client.
719
850
  */
720
851
  export interface IClientResult {
852
+ [Method.ClientRequest.CODE_ACTION]: (lsp.Command | lsp.CodeAction)[] | null;
721
853
  [Method.ClientRequest.COMPLETION_ITEM_RESOLVE]: lsp.CompletionItem;
722
854
  [Method.ClientRequest.COMPLETION]: AnyCompletion;
723
855
  [Method.ClientRequest.DEFINITION]: AnyLocation;
856
+ [Method.ClientRequest.DOCUMENT_COLOR]: lsp.ColorInformation[];
724
857
  [Method.ClientRequest.DOCUMENT_HIGHLIGHT]: lsp.DocumentHighlight[];
725
858
  [Method.ClientRequest.DOCUMENT_SYMBOL]: lsp.DocumentSymbol[];
726
859
  [Method.ClientRequest.HOVER]: lsp.Hover | null;
@@ -730,6 +863,15 @@ export interface IClientResult {
730
863
  [Method.ClientRequest.RENAME]: lsp.WorkspaceEdit;
731
864
  [Method.ClientRequest.SIGNATURE_HELP]: lsp.SignatureHelp;
732
865
  [Method.ClientRequest.TYPE_DEFINITION]: AnyLocation;
866
+ [Method.ClientRequest.INLINE_VALUE]: lsp.InlineValue[] | null;
867
+ [Method.ClientRequest.INLAY_HINT]: lsp.InlayHint[] | null;
868
+ [Method.ClientRequest.WORKSPACE_SYMBOL]:
869
+ | lsp.SymbolInformation[]
870
+ | lsp.WorkspaceSymbol[]
871
+ | null;
872
+ [Method.ClientRequest.WORKSPACE_SYMBOL_RESOLVE]: lsp.WorkspaceSymbol[];
873
+ [Method.ClientRequest.FORMATTING]: lsp.TextEdit[] | null;
874
+ [Method.ClientRequest.RANGE_FORMATTING]: lsp.TextEdit[] | null;
733
875
  }
734
876
 
735
877
  /**