public override int OnCommit(string textSoFar, int index, int selected, ushort commitChar, out string completeWord)
        {
            try
            {
                var decls = (NemerleDeclarations)Declarations;

                if (decls.Result.ImportCompletion)
                {
                    var env  = decls.Result.CompletionResult.Env;
                    var elem = decls.Result.CompletionResult.CompletionList[index];

                    var usingInfo = NemerleCompletionResult.CalcUsingDeclarationInfo(env, elem.Overloads[0]);

                    if (!usingInfo.NeedUsing && !usingInfo.Hiden && string.IsNullOrEmpty(usingInfo.Alias))
                    {
                        return(base.OnCommit(textSoFar, index, selected, commitChar, out completeWord));
                    }

                    if (!string.IsNullOrEmpty(usingInfo.Alias))
                    {
                        var result = base.OnCommit(textSoFar, index, selected, commitChar, out completeWord);
                        completeWord = usingInfo.Alias + "." + completeWord;
                        return(result);
                    }

                    if (usingInfo.Hiden)
                    {
                        var result = base.OnCommit(textSoFar, index, selected, commitChar, out completeWord);
                        completeWord = usingInfo.Namespase + "." + completeWord;
                        return(result);
                    }

                    if (usingInfo.NeedUsing)
                    {
                        var result = base.OnCommit(textSoFar, index, selected, commitChar, out completeWord);

                        if (result == VSConstants.S_OK)
                        {
                            var cu = Source.CompileUnit;

                            var line = cu != null
                ? NemerleCompletionResult.CalcUsingDeclarationInsertionLine(usingInfo.Namespase, cu) - 1
                : 0;

                            //if (Source.CompletedFirstParse && cu == null)
                            Source.SetText(line, 0, line, 0, "using " + usingInfo.Namespase + ";" + Environment.NewLine);
                        }

                        return(result);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(base.OnCommit(textSoFar, index, selected, commitChar, out completeWord));
        }
        public override string GetDisplayText(int index)
        {
            if (Result.ImportCompletion && OverloadPossibility[index].Overloads != null && OverloadPossibility[index].Overloads.Count > 0)
            {
                return(NemerleCompletionResult.MekeDisplayText(OverloadPossibility[index].Overloads[0]));
            }

            return(OverloadPossibility[index].DisplayName);
        }