refactor suggest land to read clipboard async and only when needed, https://github.com/microsoft/vscode/issues/98497

This commit is contained in:
Johannes Rieken
2020-06-08 14:21:12 +02:00
parent b49d4cf5e6
commit 72d14ad2fb
14 changed files with 105 additions and 74 deletions

View File

@@ -19,6 +19,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
import { equals } from 'vs/base/common/arrays';
import { CodeEditorStateFlag, EditorState } from 'vs/editor/browser/core/editorState';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { SnippetParser } from 'vs/editor/contrib/snippet/snippetParser';
export interface IFocusTracker {
onGainedFocus(): void;
@@ -467,7 +468,7 @@ export class MainThreadTextEditor {
// check if clipboard is required and only iff read it (async)
let clipboardText: string | undefined;
const needsTemplate = SnippetController2.guessNeedsClipboard(template);
const needsTemplate = SnippetParser.guessNeedsClipboard(template);
if (needsTemplate) {
const state = new EditorState(this._codeEditor, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position);
clipboardText = await this._clipboardService.readText();