How to use the monaco-editor/esm/vs/base/common/async.createCancelablePromise function in monaco-editor

To help you get started, we’ve selected a few monaco-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / x-pack / plugins / code / public / monaco / hover / content_hover_widget.ts View on Github external
private highlightOccurrences(range: EditorRange) {
    const pos = new monaco.Position(range.startLineNumber, range.startColumn);
    return createCancelablePromise((token: any) =>
      getOccurrencesAtPosition(this.editor.getModel(), pos, token).then(
        (data: languages.DocumentHighlight[]) => {
          if (data) {
            if (this.isVisible) {
              const decorations = data.map(h => ({
                range: h.range,
                options: ContentHoverWidget.DECORATION_OPTIONS,
              }));

              this.highlightDecorations = this.editor.deltaDecorations(
                this.highlightDecorations,
                decorations
              );
            }
          } else {
            this.highlightDecorations = this.editor.deltaDecorations(this.highlightDecorations, [
github elastic / kibana / x-pack / legacy / plugins / code / public / monaco / hover / content_hover_widget.tsx View on Github external
private highlightOccurrences(range: EditorRange) {
    const pos = new monaco.Position(range.startLineNumber, range.startColumn);
    return createCancelablePromise((token: any) =>
      getOccurrencesAtPosition(this.editor.getModel(), pos, token).then(
        (data: languages.DocumentHighlight[]) => {
          if (data) {
            if (this.isVisible) {
              const decorations = data.map(h => ({
                range: h.range,
                options: ContentHoverWidget.DECORATION_OPTIONS,
              }));

              this.highlightDecorations = this.editor.deltaDecorations(
                this.highlightDecorations,
                decorations
              );
            }
          } else {
            this.highlightDecorations = this.editor.deltaDecorations(this.highlightDecorations, [