protected async Task HandleCompletionResolveRequest(
            CompletionItem completionItem,
            RequestContext<CompletionItem> requestContext)
        {
            if (completionItem.Kind == CompletionItemKind.Function)
            {
                RunspaceHandle runspaceHandle =
                    await editorSession.PowerShellContext.GetRunspaceHandle();

                // Get the documentation for the function
                CommandInfo commandInfo =
                    CommandHelpers.GetCommandInfo(
                        completionItem.Label,
                        runspaceHandle.Runspace);

                completionItem.Documentation =
                    CommandHelpers.GetCommandSynopsis(
                        commandInfo,
                        runspaceHandle.Runspace);

                runspaceHandle.Dispose();
            }

            // Send back the updated CompletionItem
            await requestContext.SendResult(completionItem);
        }
        protected async Task HandleCompletionRequest(
            TextDocumentPosition textDocumentPosition,
            RequestContext<CompletionItem[]> requestContext)
        {
            int cursorLine = textDocumentPosition.Position.Line + 1;
            int cursorColumn = textDocumentPosition.Position.Character + 1;

            ScriptFile scriptFile =
                editorSession.Workspace.GetFile(
                    textDocumentPosition.Uri);

            CompletionResults completionResults =
                await editorSession.LanguageService.GetCompletionsInFile(
                    scriptFile,
                    cursorLine,
                    cursorColumn);

            CompletionItem[] completionItems = null;

            if (completionResults != null)
            {
                // By default, insert the completion at the current location
                int startEditColumn = textDocumentPosition.Position.Character;
                int endEditColumn = textDocumentPosition.Position.Character;

                completionItems =
                    completionResults
                        .Completions
                        .Select(
                            c => CreateCompletionItem(
                                c,
                                completionResults.ReplacedRange))
                        .ToArray();
            }
            else
            {
                completionItems = new CompletionItem[0];
            }

            await requestContext.SendResult(completionItems);
        }