@codingame/monaco-vscode-api 1.67.1 → 1.67.2

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/api.amd.js CHANGED
@@ -4771,16 +4771,8 @@ define(['exports', 'monaco-editor/esm/vs/base/common/errors.js', 'monaco-editor/
4771
4771
  workspaceFile: undefined,
4772
4772
  createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents) {
4773
4773
  const services$1 = services.Services.get();
4774
- if (typeof globPattern !== 'string') {
4775
- throw new Error('unsupported');
4776
- }
4777
4774
  if (services$1.workspace?.createFileSystemWatcher != null) {
4778
- const watcher = services$1.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
4779
- return Object.assign(watcher, {
4780
- ignoreCreateEvents: ignoreCreateEvents ?? false,
4781
- ignoreChangeEvents: ignoreChangeEvents ?? false,
4782
- ignoreDeleteEvents: ignoreDeleteEvents ?? false
4783
- });
4775
+ return services$1.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
4784
4776
  }
4785
4777
  return {
4786
4778
  ignoreCreateEvents: ignoreCreateEvents ?? false,
@@ -4798,38 +4790,26 @@ define(['exports', 'monaco-editor/esm/vs/base/common/errors.js', 'monaco-editor/
4798
4790
  await standaloneServices_js.StandaloneServices.get(bulkEditService_js.IBulkEditService).apply(resourceEdits);
4799
4791
  return true;
4800
4792
  },
4801
- getConfiguration(section, resource) {
4793
+ get getConfiguration() {
4802
4794
  const { workspace } = services.Services.get();
4803
- const configuration = (workspace?.configurations != null)
4804
- ? workspace.configurations.getConfiguration(section, (resource != null) ? resource.toString() : undefined)
4805
- : undefined;
4806
- const result = {
4795
+ return workspace?.getConfiguration ?? (() => ({
4807
4796
  get: (section, defaultValue) => {
4808
- return (configuration != null) ? configuration.get(section, defaultValue) : defaultValue;
4797
+ return defaultValue;
4809
4798
  },
4810
- has: (section) => {
4811
- return (configuration != null) ? configuration.has(section) : false;
4799
+ has: () => {
4800
+ return false;
4812
4801
  },
4813
4802
  inspect: unsupported$1,
4814
4803
  update: unsupported$1
4815
- };
4816
- return Object.assign(result, {
4817
- toJSON: () => (configuration != null) ? configuration.toJSON() : undefined
4818
- });
4804
+ }));
4819
4805
  },
4820
4806
  get onDidChangeConfiguration() {
4821
4807
  const services$1 = services.Services.get();
4822
- if (services$1.workspace?.configurations != null) {
4823
- return services$1.workspace.configurations.onDidChangeConfiguration;
4824
- }
4825
- return event_js.Event.None;
4808
+ return services$1.workspace?.onDidChangeConfiguration ?? event_js.Event.None;
4826
4809
  },
4827
4810
  get rootPath() {
4828
4811
  const services$1 = services.Services.get();
4829
- const rootUri = services$1.workspace?.rootUri;
4830
- if (rootUri != null) {
4831
- return uri_js.URI.parse(rootUri).path;
4832
- }
4812
+ return services$1.workspace?.rootPath;
4833
4813
  },
4834
4814
  get workspaceFolders() {
4835
4815
  const services$1 = services.Services.get();
@@ -4839,17 +4819,22 @@ define(['exports', 'monaco-editor/esm/vs/base/common/errors.js', 'monaco-editor/
4839
4819
  if ('workspaceFolders' in services$1.workspace) {
4840
4820
  return services$1.workspace.workspaceFolders;
4841
4821
  }
4842
- const rootUri = services$1.workspace.rootUri;
4843
- if (rootUri == null) {
4822
+ const rootPath = services$1.workspace.rootPath;
4823
+ if (rootPath == null) {
4844
4824
  return undefined;
4845
4825
  }
4846
- const uri = uri_js.URI.parse(rootUri);
4826
+ const uri = uri_js.URI.file(rootPath);
4847
4827
  return [{
4848
4828
  uri,
4849
4829
  index: 0,
4850
4830
  name: uri.toString()
4851
4831
  }];
4852
4832
  },
4833
+ getWorkspaceFolder(uri) {
4834
+ return this.workspaceFolders?.find(folder => {
4835
+ return uri.path.startsWith(folder.uri.path);
4836
+ });
4837
+ },
4853
4838
  get onDidChangeWorkspaceFolders() {
4854
4839
  const services$1 = services.Services.get();
4855
4840
  return services$1.workspace?.onDidChangeWorkspaceFolders ?? event_js.Event.None;
@@ -4895,7 +4880,6 @@ define(['exports', 'monaco-editor/esm/vs/base/common/errors.js', 'monaco-editor/
4895
4880
  get onDidGrantWorkspaceTrust() {
4896
4881
  return event_js.Event.None;
4897
4882
  },
4898
- getWorkspaceFolder: unsupported$1,
4899
4883
  asRelativePath: unsupported$1,
4900
4884
  updateWorkspaceFolders: unsupported$1,
4901
4885
  findFiles: unsupported$1,
package/dist/api.cjs CHANGED
@@ -4814,16 +4814,8 @@ const workspace$2 = {
4814
4814
  workspaceFile: undefined,
4815
4815
  createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents) {
4816
4816
  const services$1 = services.Services.get();
4817
- if (typeof globPattern !== 'string') {
4818
- throw new Error('unsupported');
4819
- }
4820
4817
  if (services$1.workspace?.createFileSystemWatcher != null) {
4821
- const watcher = services$1.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
4822
- return Object.assign(watcher, {
4823
- ignoreCreateEvents: ignoreCreateEvents ?? false,
4824
- ignoreChangeEvents: ignoreChangeEvents ?? false,
4825
- ignoreDeleteEvents: ignoreDeleteEvents ?? false
4826
- });
4818
+ return services$1.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
4827
4819
  }
4828
4820
  return {
4829
4821
  ignoreCreateEvents: ignoreCreateEvents ?? false,
@@ -4841,38 +4833,26 @@ const workspace$2 = {
4841
4833
  await standaloneServices_js.StandaloneServices.get(bulkEditService_js.IBulkEditService).apply(resourceEdits);
4842
4834
  return true;
4843
4835
  },
4844
- getConfiguration(section, resource) {
4836
+ get getConfiguration() {
4845
4837
  const { workspace } = services.Services.get();
4846
- const configuration = (workspace?.configurations != null)
4847
- ? workspace.configurations.getConfiguration(section, (resource != null) ? resource.toString() : undefined)
4848
- : undefined;
4849
- const result = {
4838
+ return workspace?.getConfiguration ?? (() => ({
4850
4839
  get: (section, defaultValue) => {
4851
- return (configuration != null) ? configuration.get(section, defaultValue) : defaultValue;
4840
+ return defaultValue;
4852
4841
  },
4853
- has: (section) => {
4854
- return (configuration != null) ? configuration.has(section) : false;
4842
+ has: () => {
4843
+ return false;
4855
4844
  },
4856
4845
  inspect: unsupported$1,
4857
4846
  update: unsupported$1
4858
- };
4859
- return Object.assign(result, {
4860
- toJSON: () => (configuration != null) ? configuration.toJSON() : undefined
4861
- });
4847
+ }));
4862
4848
  },
4863
4849
  get onDidChangeConfiguration() {
4864
4850
  const services$1 = services.Services.get();
4865
- if (services$1.workspace?.configurations != null) {
4866
- return services$1.workspace.configurations.onDidChangeConfiguration;
4867
- }
4868
- return event_js.Event.None;
4851
+ return services$1.workspace?.onDidChangeConfiguration ?? event_js.Event.None;
4869
4852
  },
4870
4853
  get rootPath() {
4871
4854
  const services$1 = services.Services.get();
4872
- const rootUri = services$1.workspace?.rootUri;
4873
- if (rootUri != null) {
4874
- return uri_js.URI.parse(rootUri).path;
4875
- }
4855
+ return services$1.workspace?.rootPath;
4876
4856
  },
4877
4857
  get workspaceFolders() {
4878
4858
  const services$1 = services.Services.get();
@@ -4882,17 +4862,22 @@ const workspace$2 = {
4882
4862
  if ('workspaceFolders' in services$1.workspace) {
4883
4863
  return services$1.workspace.workspaceFolders;
4884
4864
  }
4885
- const rootUri = services$1.workspace.rootUri;
4886
- if (rootUri == null) {
4865
+ const rootPath = services$1.workspace.rootPath;
4866
+ if (rootPath == null) {
4887
4867
  return undefined;
4888
4868
  }
4889
- const uri = uri_js.URI.parse(rootUri);
4869
+ const uri = uri_js.URI.file(rootPath);
4890
4870
  return [{
4891
4871
  uri,
4892
4872
  index: 0,
4893
4873
  name: uri.toString()
4894
4874
  }];
4895
4875
  },
4876
+ getWorkspaceFolder(uri) {
4877
+ return this.workspaceFolders?.find(folder => {
4878
+ return uri.path.startsWith(folder.uri.path);
4879
+ });
4880
+ },
4896
4881
  get onDidChangeWorkspaceFolders() {
4897
4882
  const services$1 = services.Services.get();
4898
4883
  return services$1.workspace?.onDidChangeWorkspaceFolders ?? event_js.Event.None;
@@ -4938,7 +4923,6 @@ const workspace$2 = {
4938
4923
  get onDidGrantWorkspaceTrust() {
4939
4924
  return event_js.Event.None;
4940
4925
  },
4941
- getWorkspaceFolder: unsupported$1,
4942
4926
  asRelativePath: unsupported$1,
4943
4927
  updateWorkspaceFolders: unsupported$1,
4944
4928
  findFiles: unsupported$1,
package/dist/api.js CHANGED
@@ -4787,16 +4787,8 @@ const workspace$2 = {
4787
4787
  workspaceFile: undefined,
4788
4788
  createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents) {
4789
4789
  const services = Services.get();
4790
- if (typeof globPattern !== 'string') {
4791
- throw new Error('unsupported');
4792
- }
4793
4790
  if (services.workspace?.createFileSystemWatcher != null) {
4794
- const watcher = services.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
4795
- return Object.assign(watcher, {
4796
- ignoreCreateEvents: ignoreCreateEvents ?? false,
4797
- ignoreChangeEvents: ignoreChangeEvents ?? false,
4798
- ignoreDeleteEvents: ignoreDeleteEvents ?? false
4799
- });
4791
+ return services.workspace.createFileSystemWatcher(globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
4800
4792
  }
4801
4793
  return {
4802
4794
  ignoreCreateEvents: ignoreCreateEvents ?? false,
@@ -4814,38 +4806,26 @@ const workspace$2 = {
4814
4806
  await StandaloneServices.get(IBulkEditService).apply(resourceEdits);
4815
4807
  return true;
4816
4808
  },
4817
- getConfiguration(section, resource) {
4809
+ get getConfiguration() {
4818
4810
  const { workspace } = Services.get();
4819
- const configuration = (workspace?.configurations != null)
4820
- ? workspace.configurations.getConfiguration(section, (resource != null) ? resource.toString() : undefined)
4821
- : undefined;
4822
- const result = {
4811
+ return workspace?.getConfiguration ?? (() => ({
4823
4812
  get: (section, defaultValue) => {
4824
- return (configuration != null) ? configuration.get(section, defaultValue) : defaultValue;
4813
+ return defaultValue;
4825
4814
  },
4826
- has: (section) => {
4827
- return (configuration != null) ? configuration.has(section) : false;
4815
+ has: () => {
4816
+ return false;
4828
4817
  },
4829
4818
  inspect: unsupported$1,
4830
4819
  update: unsupported$1
4831
- };
4832
- return Object.assign(result, {
4833
- toJSON: () => (configuration != null) ? configuration.toJSON() : undefined
4834
- });
4820
+ }));
4835
4821
  },
4836
4822
  get onDidChangeConfiguration() {
4837
4823
  const services = Services.get();
4838
- if (services.workspace?.configurations != null) {
4839
- return services.workspace.configurations.onDidChangeConfiguration;
4840
- }
4841
- return Event.None;
4824
+ return services.workspace?.onDidChangeConfiguration ?? Event.None;
4842
4825
  },
4843
4826
  get rootPath() {
4844
4827
  const services = Services.get();
4845
- const rootUri = services.workspace?.rootUri;
4846
- if (rootUri != null) {
4847
- return URI.parse(rootUri).path;
4848
- }
4828
+ return services.workspace?.rootPath;
4849
4829
  },
4850
4830
  get workspaceFolders() {
4851
4831
  const services = Services.get();
@@ -4855,17 +4835,22 @@ const workspace$2 = {
4855
4835
  if ('workspaceFolders' in services.workspace) {
4856
4836
  return services.workspace.workspaceFolders;
4857
4837
  }
4858
- const rootUri = services.workspace.rootUri;
4859
- if (rootUri == null) {
4838
+ const rootPath = services.workspace.rootPath;
4839
+ if (rootPath == null) {
4860
4840
  return undefined;
4861
4841
  }
4862
- const uri = URI.parse(rootUri);
4842
+ const uri = URI.file(rootPath);
4863
4843
  return [{
4864
4844
  uri,
4865
4845
  index: 0,
4866
4846
  name: uri.toString()
4867
4847
  }];
4868
4848
  },
4849
+ getWorkspaceFolder(uri) {
4850
+ return this.workspaceFolders?.find(folder => {
4851
+ return uri.path.startsWith(folder.uri.path);
4852
+ });
4853
+ },
4869
4854
  get onDidChangeWorkspaceFolders() {
4870
4855
  const services = Services.get();
4871
4856
  return services.workspace?.onDidChangeWorkspaceFolders ?? Event.None;
@@ -4911,7 +4896,6 @@ const workspace$2 = {
4911
4896
  get onDidGrantWorkspaceTrust() {
4912
4897
  return Event.None;
4913
4898
  },
4914
- getWorkspaceFolder: unsupported$1,
4915
4899
  asRelativePath: unsupported$1,
4916
4900
  updateWorkspaceFolders: unsupported$1,
4917
4901
  findFiles: unsupported$1,
@@ -3202,19 +3202,15 @@ interface Window {
3202
3202
  withProgress?: typeof vscode.window.withProgress;
3203
3203
  showTextDocument?(document: vscode.Uri, options?: vscode.TextDocumentShowOptions): PromiseLike<void>;
3204
3204
  }
3205
- interface Configurations {
3206
- getConfiguration(section?: string, resource?: string): vscode.WorkspaceConfiguration;
3207
- readonly onDidChangeConfiguration: vscode.Event<vscode.ConfigurationChangeEvent>;
3208
- }
3209
3205
  interface Workspace {
3210
- readonly rootPath?: string | null;
3211
- readonly rootUri: string | null;
3212
- readonly workspaceFolders?: typeof vscode.workspace.workspaceFolders;
3213
- readonly onDidChangeWorkspaceFolders?: typeof vscode.workspace.onDidChangeWorkspaceFolders;
3214
- readonly configurations?: Configurations;
3215
- readonly onWillSaveTextDocument?: vscode.Event<vscode.TextDocumentWillSaveEvent>;
3216
- readonly onDidSaveTextDocument?: vscode.Event<vscode.TextDocument>;
3217
- createFileSystemWatcher?(globPattern: string, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): vscode.FileSystemWatcher;
3206
+ rootPath?: string;
3207
+ workspaceFolders?: typeof vscode.workspace.workspaceFolders;
3208
+ onDidChangeWorkspaceFolders?: typeof vscode.workspace.onDidChangeWorkspaceFolders;
3209
+ getConfiguration: typeof vscode.workspace.getConfiguration;
3210
+ onDidChangeConfiguration: vscode.Event<vscode.ConfigurationChangeEvent>;
3211
+ onWillSaveTextDocument?: vscode.Event<vscode.TextDocumentWillSaveEvent>;
3212
+ onDidSaveTextDocument?: vscode.Event<vscode.TextDocument>;
3213
+ createFileSystemWatcher?: typeof vscode.workspace.createFileSystemWatcher;
3218
3214
  }
3219
3215
  interface Env {
3220
3216
  openExternal?(document: vscode.Uri): PromiseLike<boolean>;
@@ -3231,4 +3227,4 @@ declare namespace Services {
3231
3227
  function install(_services: Services): vscode.Disposable;
3232
3228
  }
3233
3229
 
3234
- export { CallHierarchyProvider, Configurations, Env, EvaluatableExpressionProvider, IWorkspaceSymbolProvider, Languages, Services, Severity, TypeHierarchyProvider, Window, Workspace };
3230
+ export { CallHierarchyProvider, Env, EvaluatableExpressionProvider, IWorkspaceSymbolProvider, Languages, Services, Severity, TypeHierarchyProvider, Window, Workspace };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.67.1",
3
+ "version": "1.67.2",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],