@codingame/monaco-languageclient-wrapper 5.0.0-update-monaco.1 → 5.0.0-update-monaco.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 (74) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +1 -25
  2. package/dist/index.d.ts +3 -161
  3. package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +1 -1
  4. package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +1 -1
  5. package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +1 -1
  6. package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +1 -1
  7. package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +1 -1
  8. package/dist/src/createLanguageClient.js +4 -5
  9. package/dist/src/customRequests.js +4 -5
  10. package/dist/src/extensions/cobol.js +2 -3
  11. package/dist/src/extensions/csharp.js +2 -3
  12. package/dist/src/extensions.js +2 -9
  13. package/dist/src/infrastructure.js +9 -5
  14. package/dist/src/languageClient.js +7 -8
  15. package/dist/src/languageClientOptions.js +2 -3
  16. package/package.json +4 -4
  17. package/stats.html +1 -1
  18. package/dist/_virtual/api2.js +0 -2
  19. package/dist/_virtual/connection2.js +0 -2
  20. package/dist/_virtual/is2.js +0 -2
  21. package/dist/_virtual/main2.js +0 -2
  22. package/dist/_virtual/main3.js +0 -4
  23. package/dist/_virtual/messages2.js +0 -2
  24. package/dist/_virtual/protocol.callHierarchy.js +0 -2
  25. package/dist/_virtual/protocol.colorProvider.js +0 -2
  26. package/dist/_virtual/protocol.configuration.js +0 -2
  27. package/dist/_virtual/protocol.declaration.js +0 -2
  28. package/dist/_virtual/protocol.diagnostic.js +0 -2
  29. package/dist/_virtual/protocol.fileOperations.js +0 -2
  30. package/dist/_virtual/protocol.foldingRange.js +0 -2
  31. package/dist/_virtual/protocol.implementation.js +0 -2
  32. package/dist/_virtual/protocol.inlayHint.js +0 -2
  33. package/dist/_virtual/protocol.inlineCompletion.js +0 -2
  34. package/dist/_virtual/protocol.inlineValue.js +0 -2
  35. package/dist/_virtual/protocol.js +0 -2
  36. package/dist/_virtual/protocol.linkedEditingRange.js +0 -2
  37. package/dist/_virtual/protocol.moniker.js +0 -2
  38. package/dist/_virtual/protocol.notebook.js +0 -2
  39. package/dist/_virtual/protocol.progress.js +0 -2
  40. package/dist/_virtual/protocol.selectionRange.js +0 -2
  41. package/dist/_virtual/protocol.semanticTokens.js +0 -2
  42. package/dist/_virtual/protocol.showDocument.js +0 -2
  43. package/dist/_virtual/protocol.typeDefinition.js +0 -2
  44. package/dist/_virtual/protocol.typeHierarchy.js +0 -2
  45. package/dist/_virtual/protocol.workspaceFolder.js +0 -2
  46. package/dist/node_modules/vscode-jsonrpc/browser.js +0 -4
  47. package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +0 -30
  48. package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +0 -44
  49. package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +0 -14
  50. package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +0 -43
  51. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +0 -25
  52. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +0 -19
  53. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +0 -13
  54. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +0 -13
  55. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +0 -46
  56. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +0 -48
  57. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +0 -19
  58. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +0 -13
  59. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +0 -25
  60. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +0 -13
  61. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +0 -19
  62. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +0 -566
  63. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +0 -13
  64. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +0 -27
  65. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +0 -190
  66. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +0 -30
  67. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +0 -13
  68. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +0 -43
  69. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +0 -13
  70. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +0 -13
  71. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +0 -25
  72. package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +0 -19
  73. package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +0 -40
  74. package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +0 -1608
@@ -2,28 +2,4 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof win
2
2
  function getDefaultExportFromCjs (x) {
3
3
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
4
4
  }
5
- function getAugmentedNamespace(n) {
6
- if (n.__esModule) return n;
7
- var f = n.default;
8
- if (typeof f == "function") {
9
- var a = function a () {
10
- if (this instanceof a) {
11
- return Reflect.construct(f, arguments, this.constructor);
12
- }
13
- return f.apply(this, arguments);
14
- };
15
- a.prototype = f.prototype;
16
- } else a = {};
17
- Object.defineProperty(a, '__esModule', {value: true});
18
- Object.keys(n).forEach(function (k) {
19
- var d = Object.getOwnPropertyDescriptor(n, k);
20
- Object.defineProperty(a, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () {
23
- return n[k];
24
- }
25
- });
26
- });
27
- return a;
28
- }
29
- export { commonjsGlobal, getAugmentedNamespace, getDefaultExportFromCjs };
5
+ export { commonjsGlobal, getDefaultExportFromCjs };
package/dist/index.d.ts CHANGED
@@ -3,167 +3,9 @@ export { MessageTransports } from 'vscode-languageclient';
3
3
  import * as vscode from 'vscode';
4
4
  export { WorkspaceFolder } from 'vscode';
5
5
  import * as monaco from 'monaco-editor';
6
+ import { Disposable, Emitter, Event, NotificationType, RequestType, CancellationToken, LSPAny } from 'vscode-languageserver-protocol';
6
7
  import { StaticFeature, DynamicFeature } from 'vscode-languageclient/lib/common/api';
7
8
 
8
- /**
9
- * The LSP any type.
10
- *
11
- * In the current implementation we map LSPAny to any. This is due to the fact
12
- * that the TypeScript compilers can't infer string access signatures for
13
- * interface correctly (it can though for types). See the following issue for
14
- * details: https://github.com/microsoft/TypeScript/issues/15300.
15
- *
16
- * When the issue is addressed LSPAny can be defined as follows:
17
- *
18
- * ```ts
19
- * export type LSPAny = LSPObject | LSPArray | string | integer | uinteger | decimal | boolean | null | undefined;
20
- * export type LSPObject = { [key: string]: LSPAny };
21
- * export type LSPArray = LSPAny[];
22
- * ```
23
- *
24
- * Please note that strictly speaking a property with the value `undefined`
25
- * can't be converted into JSON preserving the property name. However for
26
- * convenience it is allowed and assumed that all these properties are
27
- * optional as well.
28
- *
29
- * @since 3.17.0
30
- */
31
- type LSPAny = any;
32
-
33
- declare class ParameterStructures {
34
- private readonly kind;
35
- /**
36
- * The parameter structure is automatically inferred on the number of parameters
37
- * and the parameter type in case of a single param.
38
- */
39
- static readonly auto: ParameterStructures;
40
- /**
41
- * Forces `byPosition` parameter structure. This is useful if you have a single
42
- * parameter which has a literal type.
43
- */
44
- static readonly byPosition: ParameterStructures;
45
- /**
46
- * Forces `byName` parameter structure. This is only useful when having a single
47
- * parameter. The library will report errors if used with a different number of
48
- * parameters.
49
- */
50
- static readonly byName: ParameterStructures;
51
- private constructor();
52
- static is(value: any): value is ParameterStructures;
53
- toString(): string;
54
- }
55
- /**
56
- * An interface to type messages.
57
- */
58
- interface MessageSignature {
59
- readonly method: string;
60
- readonly numberOfParams: number;
61
- readonly parameterStructures: ParameterStructures;
62
- }
63
- /**
64
- * An abstract implementation of a MessageType.
65
- */
66
- declare abstract class AbstractMessageSignature implements MessageSignature {
67
- readonly method: string;
68
- readonly numberOfParams: number;
69
- constructor(method: string, numberOfParams: number);
70
- get parameterStructures(): ParameterStructures;
71
- }
72
- /**
73
- * End marker interface for request and notification types.
74
- */
75
- interface _EM {
76
- _$endMarker$_: number;
77
- }
78
- declare class RequestType<P, R, E> extends AbstractMessageSignature {
79
- private _parameterStructures;
80
- /**
81
- * Clients must not use this property. It is here to ensure correct typing.
82
- */
83
- readonly _: [P, R, E, _EM] | undefined;
84
- constructor(method: string, _parameterStructures?: ParameterStructures);
85
- get parameterStructures(): ParameterStructures;
86
- }
87
- declare class NotificationType<P> extends AbstractMessageSignature {
88
- private _parameterStructures;
89
- /**
90
- * Clients must not use this property. It is here to ensure correct typing.
91
- */
92
- readonly _: [P, _EM] | undefined;
93
- constructor(method: string, _parameterStructures?: ParameterStructures);
94
- get parameterStructures(): ParameterStructures;
95
- }
96
-
97
- interface Disposable {
98
- /**
99
- * Dispose this object.
100
- */
101
- dispose(): void;
102
- }
103
- declare namespace Disposable {
104
- function create(func: () => void): Disposable;
105
- }
106
-
107
- /**
108
- * Represents a typed event.
109
- */
110
- interface Event<T> {
111
- /**
112
- *
113
- * @param listener The listener function will be called when the event happens.
114
- * @param thisArgs The 'this' which will be used when calling the event listener.
115
- * @param disposables An array to which a {{IDisposable}} will be added.
116
- * @return
117
- */
118
- (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
119
- }
120
- declare namespace Event {
121
- const None: Event<any>;
122
- }
123
- interface EmitterOptions {
124
- onFirstListenerAdd?: Function;
125
- onLastListenerRemove?: Function;
126
- }
127
- declare class Emitter<T> {
128
- private _options?;
129
- private static _noop;
130
- private _event;
131
- private _callbacks;
132
- constructor(_options?: EmitterOptions | undefined);
133
- /**
134
- * For the public to allow to subscribe
135
- * to events from this Emitter
136
- */
137
- get event(): Event<T>;
138
- /**
139
- * To be kept private to fire an event to
140
- * subscribers
141
- */
142
- fire(event: T): any;
143
- dispose(): void;
144
- }
145
-
146
- /**
147
- * Defines a CancellationToken. This interface is not
148
- * intended to be implemented. A CancellationToken must
149
- * be created via a CancellationTokenSource.
150
- */
151
- interface CancellationToken {
152
- /**
153
- * Is `true` when the token has been cancelled, `false` otherwise.
154
- */
155
- readonly isCancellationRequested: boolean;
156
- /**
157
- * An {@link Event event} which fires upon cancellation.
158
- */
159
- readonly onCancellationRequested: Event<any>;
160
- }
161
- declare namespace CancellationToken {
162
- const None: CancellationToken;
163
- const Cancelled: CancellationToken;
164
- function is(value: any): value is CancellationToken;
165
- }
166
-
167
9
  type LanguageClientOptionsById<T extends string> = Record<T, LanguageClientOptions>;
168
10
  declare const staticOptions: LanguageClientOptionsById<"angular" | "bash" | "c" | "cpp" | "csharp" | "clojure" | "cobol" | "dart" | "go" | "groovy" | "java" | "javascript" | "kotlin" | "lua" | "mysql" | "sql" | "ocaml" | "objective-c" | "php-serenata" | "php" | "postgresql" | "python" | "r" | "react" | "ruby" | "rust" | "scala" | "swift" | "typescript" | "verilog" | "vue">;
169
11
  type StaticLanguageClientId = keyof typeof staticOptions;
@@ -296,7 +138,7 @@ interface Infrastructure {
296
138
  * @param id The language server id
297
139
  */
298
140
  openConnection(id: LanguageClientId): Promise<MessageTransports>;
299
- getInitializationOptions?(): LSPAny;
141
+ getInitializationOptions?(documentSelector?: vscode.DocumentSelector): LSPAny;
300
142
  }
301
143
  declare abstract class CodinGameInfrastructure implements Infrastructure {
302
144
  /**
@@ -336,7 +178,7 @@ declare abstract class CodinGameInfrastructure implements Infrastructure {
336
178
  */
337
179
  protected abstract getSecurityToken(): Promise<string>;
338
180
  openConnection(id: LanguageClientId): Promise<MessageTransports>;
339
- getInitializationOptions(): LSPAny;
181
+ getInitializationOptions(documentSelector?: vscode.DocumentSelector): LSPAny;
340
182
  }
341
183
 
342
184
  /**
@@ -1,5 +1,5 @@
1
1
  import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as main } from '../../../../_virtual/main2.js';
2
+ import { __exports as main } from '../../../../_virtual/main.js';
3
3
  import { __require as requireApi } from '../common/api.js';
4
4
  import { __exports as ril } from '../../../../_virtual/ril.js';
5
5
  import './ril.js';
@@ -1,4 +1,4 @@
1
- import { __exports as api } from '../../../../_virtual/api2.js';
1
+ import { __exports as api } from '../../../../_virtual/api.js';
2
2
  import { __require as requireMessages } from './messages.js';
3
3
  import { __require as requireLinkedMap } from './linkedMap.js';
4
4
  import { __require as requireDisposable } from './disposable.js';
@@ -1,4 +1,4 @@
1
- import { __exports as connection } from '../../../../_virtual/connection2.js';
1
+ import { __exports as connection } from '../../../../_virtual/connection.js';
2
2
  import { __require as requireRal } from './ral.js';
3
3
  import { __require as requireIs } from './is.js';
4
4
  import { __require as requireMessages } from './messages.js';
@@ -1,4 +1,4 @@
1
- import { __exports as is } from '../../../../_virtual/is2.js';
1
+ import { __exports as is } from '../../../../_virtual/is.js';
2
2
  var hasRequiredIs;
3
3
  function requireIs () {
4
4
  if (hasRequiredIs) return is;
@@ -1,4 +1,4 @@
1
- import { __exports as messages } from '../../../../_virtual/messages2.js';
1
+ import { __exports as messages } from '../../../../_virtual/messages.js';
2
2
  import { __require as requireIs } from './is.js';
3
3
  var hasRequiredMessages;
4
4
  function requireMessages () {
@@ -1,9 +1,8 @@
1
1
  import { objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import '../node_modules/vscode-jsonrpc/lib/browser/main.js';
3
3
  import { BaseLanguageClient } from 'vscode-languageclient';
4
- import '../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
5
- import { __exports as main } from '../_virtual/main2.js';
6
- import { __exports as main$1 } from '../_virtual/main.js';
4
+ import { InitializeRequest } from 'vscode-languageserver-protocol';
5
+ import { __exports as main } from '../_virtual/main.js';
7
6
  class MiddlewareMessageWriter {
8
7
  constructor(delegate, middleware) {
9
8
  this.delegate = delegate;
@@ -63,7 +62,7 @@ function hackTransports(transports) {
63
62
  return message;
64
63
  }),
65
64
  writer: new MiddlewareMessageWriter(transports.writer, message => {
66
- if (main.Message.isRequest(message) && message.method === main$1.InitializeRequest.type.method) {
65
+ if (main.Message.isRequest(message) && message.method === InitializeRequest.type.method) {
67
66
  var _params$rootPath, _params$rootUri$repla, _params$rootUri;
68
67
  const params = message.params;
69
68
  const fixedParams = _objectSpread2(_objectSpread2({}, params), {}, {
@@ -96,7 +95,7 @@ async function createLanguageClient(id, infrastructure, _ref, errorHandler, midd
96
95
  } = _ref;
97
96
  const allInitializationOptions = () => {
98
97
  var _infrastructure$getIn;
99
- const infrastructureInitOptions = (_infrastructure$getIn = infrastructure.getInitializationOptions) === null || _infrastructure$getIn === void 0 ? void 0 : _infrastructure$getIn.call(infrastructure);
98
+ const infrastructureInitOptions = (_infrastructure$getIn = infrastructure.getInitializationOptions) === null || _infrastructure$getIn === void 0 ? void 0 : _infrastructure$getIn.call(infrastructure, documentSelector);
100
99
  const languageInitOptions = typeof initializationOptions === 'function' ? initializationOptions() : initializationOptions;
101
100
  if (infrastructureInitOptions != null || languageInitOptions != null) {
102
101
  return _objectSpread2(_objectSpread2({}, infrastructureInitOptions !== null && infrastructureInitOptions !== void 0 ? infrastructureInitOptions : {}), languageInitOptions !== null && languageInitOptions !== void 0 ? languageInitOptions : {});
@@ -1,8 +1,7 @@
1
- import '../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
2
- import { __exports as main } from '../_virtual/main.js';
3
- const willShutdownNotificationType = new main.ProtocolNotificationType('willShutdown');
4
- const saveTextDocumentRequestType = new main.ProtocolRequestType('textDocument/save');
5
- const getTextDocumentRequestType = new main.ProtocolRequestType('textDocument/get');
1
+ import { ProtocolNotificationType, ProtocolRequestType } from 'vscode-languageserver-protocol';
2
+ const willShutdownNotificationType = new ProtocolNotificationType('willShutdown');
3
+ const saveTextDocumentRequestType = new ProtocolRequestType('textDocument/save');
4
+ const getTextDocumentRequestType = new ProtocolRequestType('textDocument/get');
6
5
  function updateFile(uri, text, languageClient) {
7
6
  return languageClient.sendRequest(saveTextDocumentRequestType, {
8
7
  textDocument: {
@@ -1,8 +1,7 @@
1
- import '../../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
1
+ import { ProtocolRequestType } from 'vscode-languageserver-protocol';
2
2
  import * as vscode from 'vscode';
3
3
  import { ExtensionFeature } from './tools.js';
4
- import { __exports as main } from '../../_virtual/main.js';
5
- const ResolveCobolSubroutineRequestType = new main.ProtocolRequestType('cobol/resolveSubroutine');
4
+ const ResolveCobolSubroutineRequestType = new ProtocolRequestType('cobol/resolveSubroutine');
6
5
  class CobolResolveSubroutineFeature extends ExtensionFeature {
7
6
  constructor(languageClient) {
8
7
  super();
@@ -1,8 +1,7 @@
1
1
  import { workspace } from 'vscode';
2
- import '../../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
2
+ import { ProtocolRequestType } from 'vscode-languageserver-protocol';
3
3
  import { ExtensionFeature } from './tools.js';
4
- import { __exports as main } from '../../_virtual/main.js';
5
- const OmnisharpMetadataRequestType = new main.ProtocolRequestType('o#/metadata');
4
+ const OmnisharpMetadataRequestType = new ProtocolRequestType('o#/metadata');
6
5
  class CsharpExtensionFeature extends ExtensionFeature {
7
6
  constructor(languageClient) {
8
7
  super();
@@ -1,10 +1,9 @@
1
1
  import { defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { registerFileSystemOverlay, FileSystemProviderCapabilities, FileSystemProviderError, FileSystemProviderErrorCode, FileType } from '@codingame/monaco-vscode-files-service-override';
3
- import '../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
3
+ import { DidSaveTextDocumentNotification } from 'vscode-languageserver-protocol';
4
4
  import * as vscode from 'vscode';
5
5
  import { DisposableStore } from 'vscode/monaco';
6
6
  import { willShutdownNotificationType } from './customRequests.js';
7
- import { __exports as main } from '../_virtual/main.js';
8
7
  class InitializeTextDocumentFeature {
9
8
  constructor(languageClient, infrastructure) {
10
9
  this.languageClient = languageClient;
@@ -24,7 +23,7 @@ class InitializeTextDocumentFeature {
24
23
  if (documentSelector != null && vscode.languages.match(documentSelector, textDocument) > 0 && textDocument.uri.scheme === 'file') {
25
24
  var _infrastructure$saveF;
26
25
  await ((_infrastructure$saveF = infrastructure.saveFileContent) === null || _infrastructure$saveF === void 0 ? void 0 : _infrastructure$saveF.call(infrastructure, textDocument.uri, textDocument.getText(), languageClient));
27
- await languageClient.sendNotification(main.DidSaveTextDocumentNotification.type, {
26
+ await languageClient.sendNotification(DidSaveTextDocumentNotification.type, {
28
27
  textDocument: {
29
28
  uri: textDocument.uri.toString()
30
29
  },
@@ -81,9 +80,6 @@ class InfrastructureTextFileSystemProvider {
81
80
  return await this.cachedContent.get(resource.toString());
82
81
  }
83
82
  async readFile(resource) {
84
- if (!resource.toString().startsWith(this.infrastructure.rootUri)) {
85
- throw FileSystemProviderError.create('file not found', FileSystemProviderErrorCode.FileNotFound);
86
- }
87
83
  const content = await this.getFileContent(resource);
88
84
  return encoder.encode(content);
89
85
  }
@@ -96,9 +92,6 @@ class InfrastructureTextFileSystemProvider {
96
92
  };
97
93
  }
98
94
  async stat(resource) {
99
- if (!resource.toString().startsWith(this.infrastructure.rootUri)) {
100
- throw FileSystemProviderError.create('file not found', FileSystemProviderErrorCode.FileNotFound);
101
- }
102
95
  try {
103
96
  const content = await this.getFileContent(resource);
104
97
  if (content != null) {
@@ -1,6 +1,7 @@
1
1
  import { defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { toSocket, WebSocketMessageWriter, WebSocketMessageReader } from 'vscode-ws-jsonrpc';
3
- import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
3
+ import * as monaco from 'monaco-editor';
4
+ import * as vscode from 'vscode';
4
5
  import { updateFile, getFile } from './customRequests.js';
5
6
  class CloseOnDisposeWebSocketMessageReader extends WebSocketMessageReader {
6
7
  dispose() {
@@ -51,7 +52,6 @@ class CodinGameInfrastructure {
51
52
  try {
52
53
  return (await getFile(resource.toString(true), languageClient)).text;
53
54
  } catch (error) {
54
- console.error('File not found', resource.toString());
55
55
  return undefined;
56
56
  }
57
57
  }
@@ -70,9 +70,13 @@ class CodinGameInfrastructure {
70
70
  throw new Error('Unable to connect to server');
71
71
  }
72
72
  }
73
- getInitializationOptions() {
74
- const files = monaco.editor.getModels().filter(model => model.uri.scheme === 'file').reduce((map, model) => {
75
- map[model.uri.toString(true)] = model.getValue();
73
+ getInitializationOptions(documentSelector) {
74
+ let documents = vscode.workspace.textDocuments.filter(doc => doc.uri.scheme === 'file');
75
+ if (documentSelector != null) {
76
+ documents = documents.filter(doc => vscode.languages.match(documentSelector, doc));
77
+ }
78
+ const files = documents.reduce((map, doc) => {
79
+ map[doc.uri.toString(true)] = doc.getText();
76
80
  return map;
77
81
  }, {});
78
82
  return {
@@ -1,7 +1,7 @@
1
1
  import { defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { State, CloseAction, ErrorAction } from 'vscode-languageclient';
3
3
  import delay from '../node_modules/delay/index.js';
4
- import '../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
4
+ import { Emitter, LogMessageNotification } from 'vscode-languageserver-protocol';
5
5
  import * as vscode from 'vscode';
6
6
  import { errorHandler } from 'vscode/monaco';
7
7
  import once from '../node_modules/once/once.js';
@@ -12,7 +12,6 @@ import createLanguageClient from './createLanguageClient.js';
12
12
  import { WillDisposeFeature, FileSystemFeature, InitializeTextDocumentFeature } from './extensions.js';
13
13
  import { loadExtensionConfigurations } from './extensionConfiguration.js';
14
14
  import { getLanguageClientOptions } from './languageClientOptions.js';
15
- import { __exports as main } from '../_virtual/main.js';
16
15
  const RETRY_CONNECTION_DELAY = 3000;
17
16
  class LanguageClientManager {
18
17
  constructor(id, clientOptions, infrastructure, managerOptions) {
@@ -22,10 +21,10 @@ class LanguageClientManager {
22
21
  this.managerOptions = managerOptions;
23
22
  _defineProperty(this, "languageClient", void 0);
24
23
  _defineProperty(this, "disposed", false);
25
- _defineProperty(this, "onDidChangeStatusEmitter", new main.Emitter());
26
- _defineProperty(this, "onErrorEmitter", new main.Emitter());
27
- _defineProperty(this, "onDidCloseEmitter", new main.Emitter());
28
- _defineProperty(this, "onWillShutdownEmitter", new main.Emitter());
24
+ _defineProperty(this, "onDidChangeStatusEmitter", new Emitter());
25
+ _defineProperty(this, "onErrorEmitter", new Emitter());
26
+ _defineProperty(this, "onDidCloseEmitter", new Emitter());
27
+ _defineProperty(this, "onWillShutdownEmitter", new Emitter());
29
28
  _defineProperty(this, "currentStatus", 'connecting');
30
29
  _defineProperty(this, "useMutualizedProxy", void 0);
31
30
  _defineProperty(this, "startPromise", void 0);
@@ -137,7 +136,7 @@ class LanguageClientManager {
137
136
  async _start() {
138
137
  var _this$clientOptions$m;
139
138
  await this.prepare();
140
- const onServerResponse = new main.Emitter();
139
+ const onServerResponse = new Emitter();
141
140
  const languageClient = await createLanguageClient(this.id, this.infrastructure, this.clientOptions, {
142
141
  error: this.handleError,
143
142
  closed: this.handleClose
@@ -227,7 +226,7 @@ class LanguageClientManager {
227
226
  } = this.clientOptions;
228
227
  if (readinessMessageMatcher != null && !this.useMutualizedProxy) {
229
228
  readyPromise = new Promise(resolve => {
230
- disposableCollection.push(languageClient.onNotification(main.LogMessageNotification.type, logMessage => {
229
+ disposableCollection.push(languageClient.onNotification(LogMessageNotification.type, logMessage => {
231
230
  if (readinessMessageMatcher.exec(logMessage.message) != null) {
232
231
  resolve();
233
232
  }
@@ -1,10 +1,9 @@
1
- import '../node_modules/vscode-languageserver-protocol/lib/browser/main.js';
1
+ import { Disposable } from 'vscode-languageserver-protocol';
2
2
  import staticOptions from './staticOptions.js';
3
- import { __exports as main } from '../_virtual/main.js';
4
3
  const dynamicOptions = {};
5
4
  function registerLanguageClient(id, options) {
6
5
  dynamicOptions[id] = options;
7
- return main.Disposable.create(() => {
6
+ return Disposable.create(() => {
8
7
  if (dynamicOptions[id] === options) {
9
8
  delete dynamicOptions[id];
10
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-languageclient-wrapper",
3
- "version": "5.0.0-update-monaco.1",
3
+ "version": "5.0.0-update-monaco.3",
4
4
  "private": false,
5
5
  "description": "Enhanced Monaco editor with TextMate grammars and more",
6
6
  "scripts": {
@@ -28,7 +28,8 @@
28
28
  "vscode": "npm:@codingame/monaco-vscode-api@~2.0.0",
29
29
  "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~2.0.0",
30
30
  "vscode-languageclient": "~9.0.1",
31
- "vscode-ws-jsonrpc": "^3.1.0"
31
+ "vscode-ws-jsonrpc": "^3.1.0",
32
+ "vscode-languageserver-protocol": "^3.17.5"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@babel/core": "7.23.9",
@@ -81,8 +82,7 @@
81
82
  "rollup-plugin-visualizer": "5.12.0",
82
83
  "tslib": "^2.6.2",
83
84
  "typescript": "5.3.3",
84
- "vscode-languageserver": "~9.0.1",
85
- "vscode-languageserver-protocol": "^3.17.5"
85
+ "vscode-languageserver": "~9.0.1"
86
86
  },
87
87
  "resolutions": {
88
88
  "eslint": "8.56.0"