GetCompletions() public static méthode

public static GetCompletions ( string input ) : uREPL.CompletionInfo[]
input string
Résultat uREPL.CompletionInfo[]
Exemple #1
0
 public void Start(string code)
 {
     Stop();
     hasCompletionFinished_ = false;
     thread_ = new Thread(() => {
         var completions     = CompletionPluginManager.GetCompletions(code);
         result_.completions = completions;
         result_.partialCode = completions[0].prefix ?? "";
     });
     thread_.Start();
 }
Exemple #2
0
        public async void Start(string code)
        {
            Stop();

            cancellationTokenSource_ = new CancellationTokenSource();
            var token = cancellationTokenSource_.Token;

            var task = Task.Run(() => {
                var completions = CompletionPluginManager.GetCompletions(code);

                token.ThrowIfCancellationRequested();

                var result         = new Result();
                result.completions = completions;
                result.partialCode =
                    (completions.Length == 0) ? "" :
                    (completions[0].prefix ?? "");
                return(result);
            }, token);

            try
            {
                var result = await task;
                onCompletionFinished.Invoke(result);
            }
            catch (OperationCanceledException)
            {
                // ...
            }
            finally
            {
                if (cancellationTokenSource_ != null)
                {
                    cancellationTokenSource_.Dispose();
                    cancellationTokenSource_ = null;
                }
            }
        }