コード例 #1
0
        private async Task CompleteCode(TextEditor lineEditor)
        {
            var line        = lineEditor.ViewModel();
            var completions = await services.CompleteCodeAsync(line.Id, line.Document.Text);

            if (completions.Any())
            {
                completionWindow = new IntellisenseWindow(lineEditor.TextArea, completions);
            }
        }
コード例 #2
0
        /// <summary>
        /// Roslyn can be a little bit slow to warm up, which can cause lag when the
        /// user first starts typing / evaluating code. Do the warm up in a background
        /// thread beforehand to improve the user experience.
        /// </summary>
        private Task BackgroundInitializationAsync()
        {
            const string initializationCode = @"using System; Console.WriteLine(""Hello""); ""World""";

            return(Task.WhenAll(
                       replServices.HighlightAsync(Guid.Empty, initializationCode),
                       replServices.CompleteCodeAsync(Guid.Empty, initializationCode, initializationCode.Length),
                       replServices.AppendEvaluationAsync(Guid.Empty, initializationCode, new NullLogger())
                       ));
        }