@codingame/monaco-vscode-api 1.69.17 → 1.69.19

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.
@@ -496,7 +496,7 @@ interface IUserFriendlyCommand {
496
496
  }
497
497
  declare function setKeybindings(grammars: ContributedKeyBinding | ContributedKeyBinding[], extension?: IExtensionDescription): void;
498
498
  declare function setCommands(keybindings: IUserFriendlyCommand | IUserFriendlyCommand[], extension?: IExtensionDescription): void;
499
- declare function updateUserKeybindings(keybindingsJson: string): void;
499
+ declare function updateUserKeybindings(keybindingsJson: string): Promise<void>;
500
500
  declare function getServiceOverride(): IEditorOverrideServices;
501
501
 
502
502
  export { ContributedKeyBinding, IUserFriendlyKeybinding, getServiceOverride as default, setCommands, setKeybindings, updateUserKeybindings };
@@ -4477,9 +4477,9 @@ function setCommands(keybindings, extension = Services.get().extension ?? DEFAUL
4477
4477
  collector: new ExtensionMessageCollector(consoleExtensionMessageHandler, extension, keybindingsExtensionPoint.name)
4478
4478
  }]);
4479
4479
  }
4480
- function updateUserKeybindings(keybindingsJson) {
4480
+ async function updateUserKeybindings(keybindingsJson) {
4481
4481
  const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
4482
- void StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
4482
+ await StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
4483
4483
  }
4484
4484
  function getServiceOverride() {
4485
4485
  return {
package/dist/snippets.js CHANGED
@@ -38,7 +38,17 @@ function setSnippetSuggestSupport (support) {
38
38
  if (monacoSuggest.setSnippetSuggestSupport != null) {
39
39
  monacoSuggest.setSnippetSuggestSupport(support);
40
40
  } else {
41
- console.error('setSnippetSuggestSupport does not exist in monaco-editor');
41
+ console.error(
42
+ `setSnippetSuggestSupport does not exist in monaco-editor.
43
+ It's treeshaked out of monaco editor and needs to be reintroduced.
44
+ If you're using webpack, you can add a loader that will polyfill it:
45
+ \`\`\`
46
+ {
47
+ test: /node_modules\\/monaco-editor\\//,
48
+ loader: 'vscode/webpack-loader'
49
+ }
50
+ \`\`\`
51
+ `);
42
52
  }
43
53
  }
44
54
  class SnippetBodyInsights {
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.raw = void 0;
4
+ const monacoPolyfillLoader = function (source) {
5
+ if (this.resourcePath.endsWith('monaco-editor/esm/vs/editor/contrib/suggest/browser/suggest.js')) {
6
+ return `${source.toString()}
7
+ export function setSnippetSuggestSupport(support) {
8
+ const old = _snippetSuggestSupport;
9
+ _snippetSuggestSupport = support;
10
+ return old;
11
+ }
12
+ `;
13
+ }
14
+ return source;
15
+ };
16
+ exports.default = monacoPolyfillLoader;
17
+ exports.raw = true; // for TTFs, see https://stackoverflow.com/questions/48824081/webpack-image-loader-encoding-breaks
@@ -0,0 +1,4 @@
1
+ import type { RawLoaderDefinitionFunction } from 'webpack';
2
+ declare const monacoPolyfillLoader: RawLoaderDefinitionFunction;
3
+ export default monacoPolyfillLoader;
4
+ export declare const raw = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.69.17",
3
+ "version": "1.69.19",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],
@@ -75,6 +75,10 @@
75
75
  "./monaco": {
76
76
  "types": "./dist/monaco.d.ts",
77
77
  "default": "./dist/monaco.js"
78
+ },
79
+ "./webpack-loader": {
80
+ "types": "./dist/webpack-loader.d.ts",
81
+ "default": "./dist/webpack-loader.cjs"
78
82
  }
79
83
  },
80
84
  "typesVersions": {
@@ -120,6 +124,9 @@
120
124
  ],
121
125
  "monaco": [
122
126
  "./dist/monaco.d.ts"
127
+ ],
128
+ "webpack-loader": [
129
+ "./dist/webpack-loader.d.ts"
123
130
  ]
124
131
  }
125
132
  },
@@ -128,8 +135,9 @@
128
135
  "README.md"
129
136
  ],
130
137
  "scripts": {
131
- "build": "rm -rf dist/ && npm run lint && npm run compile && npm run generate-types",
138
+ "build": "rm -rf dist/ && npm run lint && npm run compile && npm run generate-types && npm run compile-webpack-loader",
132
139
  "compile": "rollup --config rollup/rollup.config.ts --configPlugin 'typescript={tsconfig: `tsconfig.rollup.json`}' --vscode-version ${npm_package_config_vscode_version}",
140
+ "compile-webpack-loader": "tsc --target es2020 -lib es2020 --module commonjs --skipLibCheck --moduleResolution node --declaration --outDir dist src/webpack-loader.ts && mv dist/webpack-loader.js dist/webpack-loader.cjs",
133
141
  "preprepare": "./scripts/install-vscode",
134
142
  "lint": "eslint --ext ts src",
135
143
  "generate-types": "tsc --project tsconfig.types.json && rollup --config rollup/rollup.types.config.ts --configPlugin 'typescript={tsconfig: `tsconfig.rollup.json`}' && rm -rf ./dist/types",
@@ -172,6 +180,7 @@
172
180
  "semver": "^7.3.8",
173
181
  "ts-node": "^10.9.1",
174
182
  "typescript": "^4.9.5",
183
+ "webpack": "^5.75.0",
175
184
  "zx": "^7.1.1"
176
185
  },
177
186
  "dependencies": {},