@codingame/monaco-vscode-api 1.79.7-next.0 → 1.79.7-next.1

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.
package/dist/event.d.ts CHANGED
@@ -583,4 +583,4 @@ interface IWaitUntil {
583
583
  waitUntil(thenable: Promise<unknown>): void;
584
584
  }
585
585
 
586
- export { CancellationToken as C, Disposable as D, Event as E, IReference as I, IDisposable as a, DisposableStore as b, Emitter as c, IWaitUntil as d };
586
+ export { CancellationToken as C, Disposable as D, Event as E, IReference as I, IDisposable as a, Emitter as b, DisposableStore as c, IWaitUntil as d };
@@ -1,5 +1,5 @@
1
1
  import { S as ServiceIdentifier, a as ServicesAccessor, I as IInstantiationService } from './instantiation.js';
2
- import { E as Event, a as IDisposable, C as CancellationToken, c as Emitter, d as IWaitUntil, D as Disposable } from './event.js';
2
+ import { E as Event, a as IDisposable, C as CancellationToken, b as Emitter, d as IWaitUntil, D as Disposable } from './event.js';
3
3
  import { I as IJSONSchema } from './jsonSchema.js';
4
4
  import { c as ITextModel, P as Position, R as Range, S as Selection, h as IRange, E as EndOfLineSequence, g as IPosition, i as IMarkdownString, j as ISingleEditOperation, k as EditorAutoIndentStrategy, I as IEditorOptions, l as IEditorModel, m as IDimension, n as ITextEditorModel, o as ITextSnapshot, p as ITextBufferFactory, q as IDiffEditor, r as IBaseTextResourceEditorInput, s as IBaseUntypedEditorInput, t as IResourceEditorInput, u as ITextResourceEditorInput } from './editorBrowser.js';
5
5
  import { S as Severity$1 } from './severity.js';
package/dist/monaco.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as monaco from 'monaco-editor';
2
2
  import { I as IEditorOverrideServices } from './standaloneServices.js';
3
3
  import { E as Event, D as Disposable, a as IDisposable, I as IReference } from './event.js';
4
- export { b as DisposableStore } from './event.js';
4
+ export { c as DisposableStore } from './event.js';
5
5
  import { c as ITextModel, d as IModelDecorationOptions, e as IModelDecorationsChangeAccessor, f as IEditorContribution, b as ICodeEditor, g as IPosition } from './editorBrowser.js';
6
6
  import { L as LanguageFeatureRegistry, I as ILanguageFeaturesService, F as FoldingRangeProvider, a as ILanguageConfigurationService, b as INotificationService, c as ITextFileEditorModel } from './languageFeatures.js';
7
7
  export { C as CommandsRegistry, r as registerColor } from './languageFeatures.js';
@@ -1,5 +1,5 @@
1
1
  import { U as URI } from '../uri.js';
2
- import { D as Disposable, E as Event, a as IDisposable, C as CancellationToken } from '../event.js';
2
+ import { D as Disposable, E as Event, a as IDisposable, C as CancellationToken, b as Emitter } from '../event.js';
3
3
  import { I as IEditorOverrideServices } from '../standaloneServices.js';
4
4
  import { I as IFileSystemProviderWithFileReadWriteCapability, F as FileSystemProviderCapabilities, a as IStat, b as FileType, c as IFileWriteOptions, d as IFileOverwriteOptions, e as IFileDeleteOptions, f as IFileChange, g as IWatchOptions, h as IFileSystemProviderWithFileReadStreamCapability, i as IFileReadStreamOptions, R as ReadableStreamEvents } from '../files.js';
5
5
  export { l as FileChangeType, m as FilePermission, j as FileSystemProviderError, k as FileSystemProviderErrorCode } from '../files.js';
@@ -103,16 +103,17 @@ declare class HTMLFileSystemProvider implements IFileSystemProviderWithFileReadW
103
103
 
104
104
  declare class StaticFileSystemProvider extends Disposable implements IFileSystemProviderWithFileReadWriteCapability {
105
105
  private files;
106
- constructor();
107
106
  capabilities: number;
107
+ constructor(readonly: boolean);
108
108
  onDidChangeCapabilities: Event<any>;
109
- onDidChangeFile: Event<any>;
110
- registerFile(resource: URI, getContent: () => Promise<string | Uint8Array>): IDisposable;
109
+ _onDidChangeFile: Emitter<readonly IFileChange[]>;
110
+ onDidChangeFile: Event<readonly IFileChange[]>;
111
+ registerFile(resource: URI, getContent: () => Promise<string | Uint8Array>, setContent?: (content: string) => Promise<void>): IDisposable;
111
112
  stat(resource: URI): Promise<IStat>;
112
113
  readdir(resource: URI): Promise<[string, FileType][]>;
113
114
  readFile(resource: URI): Promise<Uint8Array>;
114
115
  watch(): IDisposable;
115
- writeFile(): Promise<never>;
116
+ writeFile(resource: URI, content: Uint8Array): Promise<void>;
116
117
  mkdir(): Promise<never>;
117
118
  delete(): Promise<never>;
118
119
  rename(): Promise<never>;
@@ -17,8 +17,9 @@ export { HTMLFileSystemProvider } from 'monaco-editor/esm/vs/platform/files/brow
17
17
  import * as path from 'monaco-editor/esm/vs/base/common/path.js';
18
18
  import '../vscode/vs/workbench/contrib/files/browser/files.contribution.js';
19
19
  class StaticFile {
20
- constructor(getContent) {
20
+ constructor(getContent, setContent) {
21
21
  this.getContent = getContent;
22
+ this.setContent = setContent;
22
23
  this.ctime = Date.now();
23
24
  this.mtime = Date.now();
24
25
  this.size = 0;
@@ -26,36 +27,51 @@ class StaticFile {
26
27
  }
27
28
  }
28
29
  const encoder = new TextEncoder();
30
+ const decoder = new TextDecoder();
29
31
  class StaticFileSystemProvider extends Disposable {
30
- constructor() {
32
+ constructor(readonly) {
31
33
  super();
32
- this.capabilities = 2 | 1024 | 2048 ;
34
+ this.readonly = readonly;
33
35
  this.onDidChangeCapabilities = Event.None;
34
- this.onDidChangeFile = Event.None;
36
+ this._onDidChangeFile = new Emitter();
37
+ this.onDidChangeFile = this._onDidChangeFile.event;
35
38
  this.files = new Map();
39
+ this.capabilities = 2 | 1024 ;
40
+ if (readonly) {
41
+ this.capabilities |= 2048 ;
42
+ }
36
43
  }
37
- registerFile(resource, getContent) {
38
- this.files.set(( resource.toString()), new StaticFile(getContent));
44
+ registerFile(resource, getContent, setContent) {
45
+ this.files.set(( resource.toString()), new StaticFile(getContent, setContent));
46
+ this._onDidChangeFile.fire([{
47
+ resource,
48
+ type: 1
49
+ }]);
39
50
  return {
40
51
  dispose: () => {
41
52
  this.files.delete(( resource.toString()));
53
+ this._onDidChangeFile.fire([{
54
+ resource,
55
+ type: 2
56
+ }]);
42
57
  }
43
58
  };
44
59
  }
45
60
  async stat(resource) {
46
61
  const resourceUri = ( resource.toString(true));
62
+ const file = this.files.get(resourceUri);
63
+ if (file != null) {
64
+ return {
65
+ ctime: Date.now(),
66
+ mtime: Date.now(),
67
+ size: 0,
68
+ type: FileType.File,
69
+ permissions: file.setContent == null || this.readonly ? FilePermission.Readonly : undefined
70
+ };
71
+ }
47
72
  const handledUris = Array.from(( this.files.keys()));
48
73
  for (const handledUri of handledUris) {
49
- if (handledUri === resourceUri) {
50
- return {
51
- ctime: Date.now(),
52
- mtime: Date.now(),
53
- size: 0,
54
- type: FileType.File,
55
- permissions: FilePermission.Readonly
56
- };
57
- }
58
- else if (handledUri.startsWith(resourceUri + '/')) {
74
+ if (handledUri.startsWith(resourceUri + '/')) {
59
75
  return {
60
76
  ctime: Date.now(),
61
77
  mtime: Date.now(),
@@ -99,7 +115,16 @@ class StaticFileSystemProvider extends Disposable {
99
115
  watch() {
100
116
  return Disposable.None;
101
117
  }
102
- async writeFile() {
118
+ async writeFile(resource, content) {
119
+ const file = this.files.get(( resource.toString()));
120
+ if (file?.setContent != null) {
121
+ await file.setContent(decoder.decode(content));
122
+ this._onDidChangeFile.fire([{
123
+ resource,
124
+ type: 0
125
+ }]);
126
+ return;
127
+ }
103
128
  throw createFileSystemProviderError('Not allowed', FileSystemProviderErrorCode.NoPermissions);
104
129
  }
105
130
  async mkdir() {
@@ -165,9 +190,30 @@ class OverlayFileSystemProvider {
165
190
  }
166
191
  throw firstError;
167
192
  }
168
- async writeToDelegates(caller) {
169
- const firstWritableProvider = this.delegates.find(provider => ((provider.capabilities & 2048) ) === 0);
170
- return caller(firstWritableProvider);
193
+ async writeToDelegates(resource, caller) {
194
+ for (const provider of this.delegates) {
195
+ if (((provider.capabilities & 2048) ) > 0) {
196
+ continue;
197
+ }
198
+ try {
199
+ const stats = await provider.stat(resource);
200
+ if (((stats.permissions ?? 0) & FilePermission.Readonly) > 0) {
201
+ continue;
202
+ }
203
+ }
204
+ catch (err) {
205
+ }
206
+ try {
207
+ return await caller(provider);
208
+ }
209
+ catch (err) {
210
+ if (err instanceof FileSystemProviderError && err.code === FileSystemProviderErrorCode.NoPermissions) {
211
+ continue;
212
+ }
213
+ throw err;
214
+ }
215
+ }
216
+ throw createFileSystemProviderError('File not writable', FileSystemProviderErrorCode.NoPermissions);
171
217
  }
172
218
  async stat(resource) {
173
219
  return this.readFromDelegates(delegate => delegate.stat(resource));
@@ -190,16 +236,16 @@ class OverlayFileSystemProvider {
190
236
  return store;
191
237
  }
192
238
  async writeFile(resource, content, opts) {
193
- await this.writeToDelegates(delegate => delegate.writeFile(resource, content, opts));
239
+ await this.writeToDelegates(resource, delegate => delegate.writeFile(resource, content, opts));
194
240
  }
195
241
  async mkdir(resource) {
196
- await this.writeToDelegates(delegate => delegate.mkdir(resource));
242
+ await this.writeToDelegates(resource, delegate => delegate.mkdir(resource));
197
243
  }
198
244
  async delete(resource, opts) {
199
- await this.writeToDelegates(delegate => delegate.delete(resource, opts));
245
+ await this.writeToDelegates(resource, delegate => delegate.delete(resource, opts));
200
246
  }
201
247
  async rename(from, to, opts) {
202
- await this.writeToDelegates(delegate => delegate.rename(from, to, opts));
248
+ await this.writeToDelegates(from, delegate => delegate.rename(from, to, opts));
203
249
  }
204
250
  }
205
251
  class MkdirpOnWriteInMemoryFileSystemProvider extends InMemoryFileSystemProvider {
@@ -209,7 +255,7 @@ class MkdirpOnWriteInMemoryFileSystemProvider extends InMemoryFileSystemProvider
209
255
  }
210
256
  }
211
257
  const fileSystemProvider = new OverlayFileSystemProvider(new MkdirpOnWriteInMemoryFileSystemProvider());
212
- const extensionFileSystemProvider = new StaticFileSystemProvider();
258
+ const extensionFileSystemProvider = new StaticFileSystemProvider(true);
213
259
  let MemoryFileService = class MemoryFileService extends FileService {
214
260
  constructor(logService) {
215
261
  super(logService);
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./debugProtocol.d.ts" />
2
2
 
3
- import { E as Event$1, a as IDisposable, C as CancellationToken, D as Disposable, c as Emitter } from './event.js';
3
+ import { E as Event$1, a as IDisposable, C as CancellationToken, D as Disposable, b as Emitter } from './event.js';
4
4
  import { i as IMarkdownString, l as IEditorModel, p as ITextBufferFactory, c as ITextModel, v as ITextModelCreationOptions, w as IEditor, q as IDiffEditor, t as IResourceEditorInput, u as ITextResourceEditorInput, I as IEditorOptions, x as IResourceEditorInputIdentifier, h as IRange, g as IPosition, P as Position$1, y as IDocumentDiffProviderOptions, z as IDocumentDiff, A as IChange, b as ICodeEditor, B as IBoundarySashes, O as Orientation, C as IDiffEditor$1, D as IDecorationRenderOptions, d as IModelDecorationOptions } from './editorBrowser.js';
5
5
  export { F as ITextModelContentProvider, G as ITextModelService, M as MarkdownStringTrustedOptions } from './editorBrowser.js';
6
6
  import { S as ServiceIdentifier, c as IConstructorSignature, I as IInstantiationService, B as BrandedService, a as ServicesAccessor } from './instantiation.js';
@@ -4,7 +4,7 @@ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
4
4
  import { registerFileSystemOverlay, StaticFileSystemProvider } from './service-override/files.js';
5
5
  class TypescriptWorkerFileSystemProvider extends StaticFileSystemProvider {
6
6
  constructor() {
7
- super();
7
+ super(true);
8
8
  this.updateLibs = () => {
9
9
  this.libDisposable?.dispose();
10
10
  const disposable = new DisposableStore();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.79.7-next.0",
3
+ "version": "1.79.7-next.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],