private static RoslynCompletionSuggestion GetFirstSuggestion(IntellisenseWindow window) { var items = window.CompletionList.ListBox.Items; Assert.NotEmpty(items); var first = items[0] as RoslynCompletionSuggestion; return(first); }
private void PressKey(IntellisenseWindow window, Key key) { var keyDown = keyboard.CreateKeyEventArgs(key, Keyboard.KeyDownEvent); window.RaiseEvent(keyDown); var keyUp = keyboard.CreateKeyEventArgs(key, Keyboard.KeyUpEvent); window.RaiseEvent(keyUp); }
public async Task IntellisenseWindow_AlreadyTypedOnlyCompletion_DoesNotShowWindow() { IntellisenseWindow window = await CompleteText("Console.WriteLine"); bool closed = false; window.Closed += (_, __) => closed = true; PressKey(window, Key.E); Assert.True(closed); }
public async Task IntellisenseWindow_ProvidedCompletions_ShowsCompletions() { IntellisenseWindow window = await CompleteText("Console."); PressKey(window, Key.OemPeriod); var first = GetFirstSuggestion(window); Assert.NotNull(first); Assert.Equal("BackgroundColor", first.Text); Assert.Contains("Gets or sets the background color", first.Description.ToString()); }
private async Task <IntellisenseWindow> CompleteText(string text) { var editor = new TextEditor { Document = new TextDocument() }; editor.Document.Text = text; var completions = await this.replServices.CompleteCodeAsync(Guid.NewGuid(), editor.Document.Text, editor.Document.Text.Length); var window = new IntellisenseWindow(editor.TextArea, completions, () => { }); return(window); }