@codingame/monaco-vscode-editor-api 22.1.9 → 23.0.0

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.
@@ -26,7 +26,7 @@ export interface IWebWorkerOptions {
26
26
  /**
27
27
  * An object that can be used by the web worker to make calls back to the main thread.
28
28
  */
29
- host?: unknown;
29
+ host?: Record<string, Function>;
30
30
  /**
31
31
  * Keep idle models.
32
32
  * Defaults to false, which means that idle models will stop syncing after a while.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-editor-api",
3
- "version": "22.1.9",
3
+ "version": "23.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - monaco-editor compatible api",
6
6
  "keywords": [],
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common": "22.1.9",
19
- "@codingame/monaco-vscode-api": "22.1.9"
18
+ "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common": "23.0.0",
19
+ "@codingame/monaco-vscode-api": "23.0.0"
20
20
  },
21
21
  "exports": {
22
22
  ".": "./esm/vs/editor/editor.api.js",
@@ -596,7 +596,7 @@ export class Position {
596
596
  /**
597
597
  * Test if `obj` is an `IPosition`.
598
598
  */
599
- static isIPosition(obj: any): obj is IPosition;
599
+ static isIPosition(obj: unknown): obj is IPosition;
600
600
  toJSON(): IPosition;
601
601
  }
602
602
  /**
@@ -758,7 +758,7 @@ export class Range {
758
758
  /**
759
759
  * Test if `obj` is an `IRange`.
760
760
  */
761
- static isIRange(obj: any): obj is IRange;
761
+ static isIRange(obj: unknown): obj is IRange;
762
762
  /**
763
763
  * Test if the two ranges are touching in any way.
764
764
  */
@@ -882,7 +882,7 @@ export class Selection extends Range {
882
882
  /**
883
883
  * Test if `obj` is an `ISelection`.
884
884
  */
885
- static isISelection(obj: any): obj is ISelection;
885
+ static isISelection(obj: unknown): obj is ISelection;
886
886
  /**
887
887
  * Create with a direction.
888
888
  */
@@ -1151,7 +1151,7 @@ export namespace editor {
1151
1151
  /**
1152
1152
  * An object that can be used by the web worker to make calls back to the main thread.
1153
1153
  */
1154
- host?: any;
1154
+ host?: Record<string, Function>;
1155
1155
  /**
1156
1156
  * Keep idle models.
1157
1157
  * Defaults to false, which means that idle models will stop syncing after a while.
@@ -1200,7 +1200,7 @@ export namespace editor {
1200
1200
  * Method that will be executed when the action is triggered.
1201
1201
  * @param editor The editor instance is passed in as a convenience
1202
1202
  */
1203
- run(editor: ICodeEditor, ...args: any[]): void | Promise<void>;
1203
+ run(editor: ICodeEditor, ...args: unknown[]): void | Promise<void>;
1204
1204
  }
1205
1205
  /**
1206
1206
  * Options which apply for all editors.
@@ -1366,7 +1366,7 @@ export namespace editor {
1366
1366
  }
1367
1367
  export type ContextKeyValue = null | undefined | boolean | number | string | Array<null | undefined | boolean | number | string> | Record<string, null | undefined | boolean | number | string>;
1368
1368
  export interface IEditorOverrideServices {
1369
- [index: string]: any;
1369
+ [index: string]: unknown;
1370
1370
  }
1371
1371
  export interface IMarker {
1372
1372
  owner: string;
@@ -2503,7 +2503,7 @@ export namespace editor {
2503
2503
  cursorState: ICursorState[];
2504
2504
  viewState: IViewState;
2505
2505
  contributionsState: {
2506
- [id: string]: any;
2506
+ [id: string]: unknown;
2507
2507
  };
2508
2508
  }
2509
2509
  /**
@@ -2714,7 +2714,7 @@ export namespace editor {
2714
2714
  * @param handlerId The id of the handler or the id of a contribution.
2715
2715
  * @param payload Extra data to be sent to the handler.
2716
2716
  */
2717
- trigger(source: string | null | undefined, handlerId: string, payload: any): void;
2717
+ trigger(source: string | null | undefined, handlerId: string, payload: unknown): void;
2718
2718
  /**
2719
2719
  * Gets the current model attached to this editor.
2720
2720
  */
@@ -2743,7 +2743,7 @@ export namespace editor {
2743
2743
  * An event emitted when decorations change in the editor,
2744
2744
  * but the change is not caused by us setting or clearing the collection.
2745
2745
  */
2746
- onDidChange: IEvent<IModelDecorationsChangedEvent>;
2746
+ readonly onDidChange: IEvent<IModelDecorationsChangedEvent>;
2747
2747
  /**
2748
2748
  * Get the decorations count.
2749
2749
  */
@@ -2784,11 +2784,11 @@ export namespace editor {
2784
2784
  /**
2785
2785
  * Store view state.
2786
2786
  */
2787
- saveViewState?(): any;
2787
+ saveViewState?(): unknown;
2788
2788
  /**
2789
2789
  * Restore view state.
2790
2790
  */
2791
- restoreViewState?(state: any): void;
2791
+ restoreViewState?(state: unknown): void;
2792
2792
  }
2793
2793
  /**
2794
2794
  * The type of the `IEditor`.
@@ -5154,7 +5154,7 @@ export namespace editor {
5154
5154
  renderWhitespace: IEditorOption<EditorOption.renderWhitespace, "all" | "none" | "boundary" | "selection" | "trailing">;
5155
5155
  revealHorizontalRightPadding: IEditorOption<EditorOption.revealHorizontalRightPadding, number>;
5156
5156
  roundedSelection: IEditorOption<EditorOption.roundedSelection, boolean>;
5157
- rulers: IEditorOption<EditorOption.rulers, {}>;
5157
+ rulers: IEditorOption<EditorOption.rulers, IRulerOption[]>;
5158
5158
  scrollbar: IEditorOption<EditorOption.scrollbar, InternalEditorScrollbarOptions>;
5159
5159
  scrollBeyondLastColumn: IEditorOption<EditorOption.scrollBeyondLastColumn, number>;
5160
5160
  scrollBeyondLastLine: IEditorOption<EditorOption.scrollBeyondLastLine, boolean>;
@@ -5183,12 +5183,12 @@ export namespace editor {
5183
5183
  tabCompletion: IEditorOption<EditorOption.tabCompletion, "on" | "off" | "onlySnippets">;
5184
5184
  tabIndex: IEditorOption<EditorOption.tabIndex, number>;
5185
5185
  trimWhitespaceOnDelete: IEditorOption<EditorOption.trimWhitespaceOnDelete, boolean>;
5186
- unicodeHighlight: IEditorOption<EditorOption.unicodeHighlighting, any>;
5186
+ unicodeHighlight: IEditorOption<EditorOption.unicodeHighlighting, Required<Readonly<IUnicodeHighlightOptions>>>;
5187
5187
  unusualLineTerminators: IEditorOption<EditorOption.unusualLineTerminators, "off" | "auto" | "prompt">;
5188
5188
  useShadowDOM: IEditorOption<EditorOption.useShadowDOM, boolean>;
5189
5189
  useTabStops: IEditorOption<EditorOption.useTabStops, boolean>;
5190
5190
  wordBreak: IEditorOption<EditorOption.wordBreak, "normal" | "keepAll">;
5191
- wordSegmenterLocales: IEditorOption<EditorOption.wordSegmenterLocales, {}>;
5191
+ wordSegmenterLocales: IEditorOption<EditorOption.wordSegmenterLocales, string[]>;
5192
5192
  wordSeparators: IEditorOption<EditorOption.wordSeparators, string>;
5193
5193
  wordWrap: IEditorOption<EditorOption.wordWrap, "wordWrapColumn" | "on" | "off" | "bounded">;
5194
5194
  wordWrapBreakAfterCharacters: IEditorOption<EditorOption.wordWrapBreakAfterCharacters, string>;
@@ -5469,7 +5469,7 @@ export namespace editor {
5469
5469
  /**
5470
5470
  * Event fired when the widget layout changes.
5471
5471
  */
5472
- onDidLayout?: IEvent<void>;
5472
+ readonly onDidLayout?: IEvent<void>;
5473
5473
  /**
5474
5474
  * Render this overlay widget in a location where it could overflow the editor's view dom node.
5475
5475
  */
@@ -6257,7 +6257,7 @@ export namespace editor {
6257
6257
  }
6258
6258
  export const EditorZoom: IEditorZoom;
6259
6259
  export interface IEditorZoom {
6260
- onDidChangeZoomLevel: IEvent<number>;
6260
+ readonly onDidChangeZoomLevel: IEvent<number>;
6261
6261
  getZoomLevel(): number;
6262
6262
  setZoomLevel(zoomLevel: number): void;
6263
6263
  }
@@ -7178,25 +7178,29 @@ export namespace languages {
7178
7178
  */
7179
7179
  readonly insertText: string | {
7180
7180
  snippet: string;
7181
- };
7181
+ } | undefined;
7182
7182
  /**
7183
- * A text that is used to decide if this inline completion should be shown.
7184
- * An inline completion is shown if the text to replace is a subword of the filter text.
7185
- */
7186
- readonly filterText?: string;
7183
+ * The range to replace.
7184
+ * Must begin and end on the same line.
7185
+ * Refers to the current document or `uri` if provided.
7186
+ */
7187
+ readonly range?: IRange;
7187
7188
  /**
7188
7189
  * An optional array of additional text edits that are applied when
7189
7190
  * selecting this completion. Edits must not overlap with the main edit
7190
7191
  * nor with themselves.
7192
+ * Refers to the current document or `uri` if provided.
7191
7193
  */
7192
7194
  readonly additionalTextEdits?: editor.ISingleEditOperation[];
7193
7195
  /**
7194
- * The range to replace.
7195
- * Must begin and end on the same line.
7196
+ * The file for which the edit applies to.
7197
+ */
7198
+ readonly uri?: UriComponents;
7199
+ /**
7200
+ * A command that is run upon acceptance of this item.
7196
7201
  */
7197
- readonly range?: IRange;
7198
7202
  readonly command?: Command;
7199
- readonly action?: Command;
7203
+ readonly gutterMenuLinkAction?: Command;
7200
7204
  /**
7201
7205
  * Is called the first time an inline completion is shown.
7202
7206
  * @deprecated. Use `onDidShow` of the provider instead.
@@ -7209,9 +7213,10 @@ export namespace languages {
7209
7213
  readonly completeBracketPairs?: boolean;
7210
7214
  readonly isInlineEdit?: boolean;
7211
7215
  readonly showInlineEditMenu?: boolean;
7216
+ /** Only show the inline suggestion when the cursor is in the showRange. */
7212
7217
  readonly showRange?: IRange;
7213
7218
  readonly warning?: InlineCompletionWarning;
7214
- readonly displayLocation?: InlineCompletionDisplayLocation;
7219
+ readonly hint?: InlineCompletionHint;
7215
7220
  /**
7216
7221
  * Used for telemetry.
7217
7222
  */
@@ -7221,18 +7226,17 @@ export namespace languages {
7221
7226
  message: IMarkdownString | string;
7222
7227
  icon?: IconPath;
7223
7228
  }
7224
- export enum InlineCompletionDisplayLocationKind {
7229
+ export enum InlineCompletionHintStyle {
7225
7230
  Code = 1,
7226
7231
  Label = 2
7227
7232
  }
7228
- export interface InlineCompletionDisplayLocation {
7233
+ export interface InlineCompletionHint {
7234
+ /** Refers to the current document. */
7229
7235
  range: IRange;
7230
- kind: InlineCompletionDisplayLocationKind;
7231
- label: string;
7236
+ style: InlineCompletionHintStyle;
7237
+ content: string;
7238
+ jumpToEdit: boolean;
7232
7239
  }
7233
- /**
7234
- * TODO: add `| Uri | { light: Uri; dark: Uri }`.
7235
- */
7236
7240
  export type IconPath = editor.ThemeIcon;
7237
7241
  export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
7238
7242
  readonly items: readonly TItem[];
@@ -7325,7 +7329,6 @@ export namespace languages {
7325
7329
  notShownReason: string | undefined;
7326
7330
  editorType: string;
7327
7331
  viewKind: string | undefined;
7328
- error: string | undefined;
7329
7332
  preceeded: boolean;
7330
7333
  languageId: string;
7331
7334
  requestReason: string;
@@ -7988,7 +7991,7 @@ export namespace languages {
7988
7991
  id: string;
7989
7992
  title: string;
7990
7993
  tooltip?: string;
7991
- arguments?: any[];
7994
+ arguments?: unknown[];
7992
7995
  }
7993
7996
  export interface CommentThreadRevealOptions {
7994
7997
  preserveFocus: boolean;
@@ -8070,12 +8073,13 @@ export namespace languages {
8070
8073
  readonly edits: SemanticTokensEdit[];
8071
8074
  }
8072
8075
  export interface DocumentSemanticTokensProvider {
8073
- onDidChange?: IEvent<void>;
8076
+ readonly onDidChange?: IEvent<void>;
8074
8077
  getLegend(): SemanticTokensLegend;
8075
8078
  provideDocumentSemanticTokens(model: editor.ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;
8076
8079
  releaseDocumentSemanticTokens(resultId: string | undefined): void;
8077
8080
  }
8078
8081
  export interface DocumentRangeSemanticTokensProvider {
8082
+ readonly onDidChange?: IEvent<void>;
8079
8083
  getLegend(): SemanticTokensLegend;
8080
8084
  provideDocumentRangeSemanticTokens(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
8081
8085
  }
@@ -4,6 +4,7 @@ import { createMonacoBaseAPI } from '@codingame/monaco-vscode-api/vscode/vs/edit
4
4
  import { createMonacoEditorAPI } from './standalone/browser/standaloneEditor.js';
5
5
  import { createMonacoLanguagesAPI } from './standalone/browser/standaloneLanguages.js';
6
6
  import { FormattingConflicts } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/format/browser/format';
7
+ import { getMonacoEnvironment } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/browser';
7
8
 
8
9
  EditorOptions.wrappingIndent.defaultValue = WrappingIndent.None;
9
10
  EditorOptions.glyphMargin.defaultValue = false;
@@ -27,9 +28,27 @@ const Uri = api.Uri;
27
28
  const Token = api.Token;
28
29
  const editor = api.editor;
29
30
  const languages = api.languages;
30
- const monacoEnvironment = globalThis.MonacoEnvironment;
31
- if (monacoEnvironment?.globalAPI || (typeof globalThis.define === 'function' && (globalThis.define).amd)) {
32
- globalThis.monaco = api;
31
+ const monacoEnvironment = getMonacoEnvironment();
32
+ const globalWithAMD = globalThis;
33
+ if (monacoEnvironment?.globalAPI || (typeof globalWithAMD.define === 'function' && globalWithAMD.define.amd)) {
34
+ globalWithAMD.monaco = api;
35
+ }
36
+ if (typeof globalWithAMD.require !== 'undefined' && typeof globalWithAMD.require.config === 'function') {
37
+ globalWithAMD.require.config({
38
+ ignoreDuplicateModules: [
39
+ 'vscode-languageserver-types',
40
+ 'vscode-languageserver-types/main',
41
+ 'vscode-languageserver-textdocument',
42
+ 'vscode-languageserver-textdocument/main',
43
+ 'vscode-nls',
44
+ 'vscode-nls/vscode-nls',
45
+ 'jsonc-parser',
46
+ 'jsonc-parser/main',
47
+ 'vscode-uri',
48
+ 'vscode-uri/index',
49
+ 'vs/basic-languages/typescript/typescript'
50
+ ]
51
+ });
33
52
  }
34
53
 
35
54
  export { CancellationTokenSource, Emitter, KeyCode, KeyMod, MarkerSeverity, MarkerTag, Position, Range, Selection, SelectionDirection, Token, Uri, editor, languages };
@@ -7,7 +7,7 @@ import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/
7
7
  import { ILanguageConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/languageConfigurationRegistry.service';
8
8
  import { ModesRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
9
9
  import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
10
- import { InlineCompletionDisplayLocationKind, InlineCompletionEndOfLifeReasonKind, HoverVerbosityAction, PartialAcceptTriggerKind, NewSymbolNameTriggerKind, NewSymbolNameTag, CodeActionTriggerType, InlineCompletionTriggerKind, InlayHintKind, SignatureHelpTriggerKind, CompletionTriggerKind, IndentAction, SymbolTag, SymbolKind, CompletionItemInsertTextRule, CompletionItemTag, CompletionItemKind, DocumentHighlightKind } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/standalone/standaloneEnums';
10
+ import { InlineCompletionHintStyle, InlineCompletionEndOfLifeReasonKind, HoverVerbosityAction, PartialAcceptTriggerKind, NewSymbolNameTriggerKind, NewSymbolNameTag, CodeActionTriggerType, InlineCompletionTriggerKind, InlayHintKind, SignatureHelpTriggerKind, CompletionTriggerKind, IndentAction, SymbolTag, SymbolKind, CompletionItemInsertTextRule, CompletionItemTag, CompletionItemKind, DocumentHighlightKind } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/standalone/standaloneEnums';
11
11
  import { StandaloneServices } from '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
12
12
  import { compile } from '../common/monarch/monarchCompile.js';
13
13
  import { MonarchTokenizer } from '../common/monarch/monarchLexer.js';
@@ -432,7 +432,7 @@ function createMonacoLanguagesAPI() {
432
432
  PartialAcceptTriggerKind: PartialAcceptTriggerKind,
433
433
  HoverVerbosityAction: HoverVerbosityAction,
434
434
  InlineCompletionEndOfLifeReasonKind: InlineCompletionEndOfLifeReasonKind,
435
- InlineCompletionDisplayLocationKind: InlineCompletionDisplayLocationKind,
435
+ InlineCompletionHintStyle: InlineCompletionHintStyle,
436
436
  FoldingRangeKind: FoldingRangeKind,
437
437
  SelectedSuggestionInfo: SelectedSuggestionInfo,
438
438
  EditDeltaInfo: EditDeltaInfo,
@@ -31,7 +31,7 @@ export interface IInternalWebWorkerOptions {
31
31
  /**
32
32
  * An object that can be used by the web worker to make calls back to the main thread.
33
33
  */
34
- host?: any;
34
+ host?: Record<string, Function>;
35
35
  /**
36
36
  * Keep idle models.
37
37
  * Defaults to false, which means that idle models will stop syncing after a while.