コード例 #1
0
 public bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
 {
     if (ch == '<')
     {
         editor.ShowCompletionWindow(new XamlCompletionDataProvider(XamlExpressionContext.Empty), ch);
         return(true);
     }
     else if (char.IsLetter(ch))
     {
         int offset = editor.ActiveTextAreaControl.TextArea.Caret.Offset;
         if (offset > 0)
         {
             char c = editor.Document.GetCharAt(offset - 1);
             if (c == ' ' || c == '\t')
             {
                 XmlElementPath path = XmlParser.GetActiveElementStartPathAtIndex(editor.Text, offset);
                 if (path != null && path.Elements.Count > 0)
                 {
                     editor.ShowCompletionWindow(
                         new XamlCompletionDataProvider(
                             new XamlExpressionContext(path, "", false)
                             )
                     {
                         IsAttributeCompletion = true
                     }
                         , '\0');
                     return(false);
                 }
             }
         }
     }
     return(false);
 }
コード例 #2
0
        public override bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
        {
            if (ch == ':')
            {
                if (editor.ActiveTextAreaControl.Caret.Offset >= 5 && editor.Document.GetText(editor.ActiveTextAreaControl.Caret.Offset - 5, 5) == "${res")
                {
                    IResourceFileContent content = ICSharpCodeCoreResourceResolver.GetICSharpCodeCoreLocalResourceSet(editor.FileName).ResourceFileContent;
                                        #if DEBUG
                    if (content != null)
                    {
                        LoggingService.Debug("ResourceToolkit: Found local ICSharpCode.Core resource file: " + content.FileName);
                    }
                                        #endif

                    IResourceFileContent hostContent = ICSharpCodeCoreResourceResolver.GetICSharpCodeCoreHostResourceSet(editor.FileName).ResourceFileContent;
                    if (hostContent != null)
                    {
                                                #if DEBUG
                        LoggingService.Debug("ResourceToolkit: Found host ICSharpCode.Core resource file: " + hostContent.FileName);
                                                #endif
                        if (content != null)
                        {
                            content = new MergedResourceFileContent(content, new IResourceFileContent[] { hostContent });
                        }
                        else
                        {
                            content = hostContent;
                        }
                    }

                    if (content != null)
                    {
                        editor.ShowCompletionWindow(new ResourceCodeCompletionDataProvider(content, null, null), ch);
                        return(true);
                    }
                }
            }
            else if (ch == '$')
            {
                // Provide ${res: as code completion
                // in an ICSharpCode.Core application
                if (ICSharpCodeCoreResourceResolver.GetICSharpCodeCoreHostResourceSet(editor.FileName).ResourceFileContent != null ||
                    ICSharpCodeCoreResourceResolver.GetICSharpCodeCoreLocalResourceSet(editor.FileName).ResourceFileContent != null)
                {
                    editor.ShowCompletionWindow(new ICSharpCodeCoreTagCompletionDataProvider(), ch);
                    return(true);
                }
            }

            return(false);
        }
        public override bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
        {
            if (this.CompletionPossible(editor, ch))
            {
                ResourceResolveResult result = ResourceResolverService.Resolve(editor, ch);
                if (result != null)
                {
                    IResourceFileContent content;
                    if ((content = result.ResourceFileContent) != null)
                    {
                        // If the resolved resource set is the local ICSharpCode.Core resource set
                        // (this may happen through the ICSharpCodeCoreNRefactoryResourceResolver),
                        // we will have to merge in the host resource set (if available)
                        // for the code completion window.
                        if (result.ResourceSetReference.ResourceSetName == ICSharpCodeCoreResourceResolver.ICSharpCodeCoreLocalResourceSetName)
                        {
                            IResourceFileContent hostContent = ICSharpCodeCoreResourceResolver.GetICSharpCodeCoreHostResourceSet(editor.FileName).ResourceFileContent;
                            if (hostContent != null)
                            {
                                content = new MergedResourceFileContent(content, new IResourceFileContent[] { hostContent });
                            }
                        }

                        editor.ShowCompletionWindow(new ResourceCodeCompletionDataProvider(content, this.OutputVisitor, result.CallingClass != null ? result.CallingClass.Name + "." : null), ch);
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #4
0
        public override bool InsertAction(ICompletionData data, ICSharpCode.TextEditor.TextArea textArea, int insertionOffset, char key)
        {
            CodeCompletionData ccData = data as CodeCompletionData;

            if (IsAttributeCompletion && ccData != null)
            {
                textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
                textArea.InsertString(ccData.Text + "=\"\"");
                textArea.Caret.Column -= 1;

                SharpDevelopTextAreaControl editor = textArea.MotherTextEditorControl as SharpDevelopTextAreaControl;
                if (editor != null)
                {
                    WorkbenchSingleton.SafeThreadAsyncCall(
                        delegate {
                        XamlCompletionDataProvider provider      = new XamlCompletionDataProvider();
                        provider.AllowCompleteExistingExpression = true;
                        editor.ShowCompletionWindow(provider, '\0');
                    }
                        );
                }
                return(false);
            }
            else
            {
                return(base.InsertAction(data, textArea, insertionOffset, key));
            }
        }
コード例 #5
0
        bool ShowNewCompletion(SharpDevelopTextAreaControl editor)
        {
            CSharpExpressionFinder ef         = CreateExpressionFinder(editor.FileName);
            int              cursor           = editor.ActiveTextAreaControl.Caret.Offset;
            string           documentToCursor = editor.Document.GetText(0, cursor);
            ExpressionResult expressionResult = ef.FindExpression(documentToCursor, cursor);

            LoggingService.Debug("ShowNewCompletion: expression is " + expressionResult);
            if (expressionResult.Context.IsObjectCreation)
            {
                LineSegment currentLine = editor.Document.GetLineSegmentForOffset(cursor);
                string      lineText    = editor.Document.GetText(currentLine.Offset, cursor - currentLine.Offset);
                // when the new follows an assignment, improve code-completion by detecting the
                // type of the variable that is assigned to
                if (lineText.Replace(" ", "").EndsWith("=new"))
                {
                    int pos = lineText.LastIndexOf('=');
                    ExpressionContext context = FindExactContextForNewCompletion(editor, documentToCursor,
                                                                                 currentLine, pos);
                    if (context != null)
                    {
                        expressionResult.Context = context;
                    }
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(expressionResult.Context), ' ');
                return(true);
            }
            return(false);
        }
コード例 #6
0
ファイル: Actions.cs プロジェクト: carlhuth/GenXSource
        public override void Execute(TextArea services)
        {
            SharpDevelopTextAreaControl sdtac = (SharpDevelopTextAreaControl)services.MotherTextEditorControl;

            services.AutoClearSelection = false;
            sdtac.ShowCompletionWindow(new TemplateCompletionDataProvider(), '\0');
        }
コード例 #7
0
        public bool CtrlSpace(SharpDevelopTextAreaControl editor)
        {
            XamlCompletionDataProvider provider = new XamlCompletionDataProvider();

            provider.AllowCompleteExistingExpression = true;
            editor.ShowCompletionWindow(provider, '\0');
            return(true);
        }
コード例 #8
0
ファイル: Actions.cs プロジェクト: vu111293/pat-design
        public override void Execute(TextArea textArea)
        {
            SharpDevelopTextAreaControl sdtac = (SharpDevelopTextAreaControl)textArea.MotherTextEditorControl;
            CodeCompletionDataProvider  ccdp  = new CodeCompletionDataProvider();

            ccdp.DebugMode = true;
            sdtac.ShowCompletionWindow(ccdp, '.');
        }
コード例 #9
0
ファイル: Actions.cs プロジェクト: vu111293/pat-design
        public override void Execute(TextArea textArea)
        {
            SharpDevelopTextAreaControl     sdtac    = (SharpDevelopTextAreaControl)textArea.MotherTextEditorControl;
            CtrlSpaceCompletionDataProvider provider = new CtrlSpaceCompletionDataProvider();

            provider.AllowCompleteExistingExpression = true;
            provider.DebugMode = true;
            sdtac.ShowCompletionWindow(provider, '\0');
        }
コード例 #10
0
        public override bool HandleKeyword(SharpDevelopTextAreaControl editor, string word)
        {
            switch (word.ToLowerInvariant())
            {
            case "import":
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Importable), ' ');
                return(true);

            case "as":
            case "isa":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Type), ' ');
                return(true);

            default:
                return(base.HandleKeyword(editor, word));
            }
        }
コード例 #11
0
        bool ShowNewCompletion(SharpDevelopTextAreaControl editor)
        {
            CSharpExpressionFinder ef = new CSharpExpressionFinder(editor.FileName);
            int cursor = editor.ActiveTextAreaControl.Caret.Offset;
            ExpressionContext context = ef.FindExpression(editor.Document.GetText(0, cursor) + " T.", cursor + 2).Context;

            if (context.IsObjectCreation)
            {
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(context), ' ');
                return(true);
            }
            return(false);
        }
コード例 #12
0
 public override bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
 {
     if (ch == '[')
     {
         int cursor = editor.ActiveTextAreaControl.Caret.Offset;
         for (int i = cursor - 1; i > 0; i--)
         {
             char c = editor.Document.GetCharAt(i);
             if (c == '\n' || c == '(' || c == ',')
             {
                 // -> Attribute completion
                 editor.ShowCompletionWindow(new AttributesDataProvider(ExpressionFinder.BooAttributeContext.Instance), ch);
                 return(true);
             }
             if (!char.IsWhiteSpace(c))
             {
                 break;
             }
         }
     }
     return(base.HandleKeyPress(editor, ch));
 }
コード例 #13
0
 /// <summary>
 /// Shows the code completion window.
 /// </summary>
 protected virtual void ShowCodeCompletionWindow(SharpDevelopTextAreaControl textAreaControl, ICompletionDataProvider completionDataProvider, char ch)
 {
     textAreaControl.ShowCompletionWindow(completionDataProvider, ch);
 }
コード例 #14
0
        public override bool HandleKeyword(SharpDevelopTextAreaControl editor, string word)
        {
            // TODO: Assistance writing Methods/Fields/Properties/Events:
            // use public/static/etc. as keywords to display a list with other modifiers
            // and possible return types.
            switch (word)
            {
            case "using":
                if (IsInComment(editor))
                {
                    return(false);
                }

                // TODO: check if we are inside class/namespace
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Namespace), ' ');
                return(true);

            case "as":
            case "is":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Type), ' ');
                return(true);

            case "override":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new OverrideCompletionDataProvider(), ' ');
                return(true);

            case "new":
                return(ShowNewCompletion(editor));

            case "case":
                if (IsInComment(editor))
                {
                    return(false);
                }
                return(DoCaseCompletion(editor));

            case "return":
                if (IsInComment(editor))
                {
                    return(false);
                }
                IMember m = GetCurrentMember(editor);
                if (m != null)
                {
                    return(ProvideContextCompletion(editor, m.ReturnType, ' '));
                }
                else
                {
                    goto default;
                }

            default:
                return(base.HandleKeyword(editor, word));
            }
        }
コード例 #15
0
        public override bool HandleKeyword(SharpDevelopTextAreaControl editor, string word)
        {
            // TODO: Assistance writing Methods/Fields/Properties/Events:
            // use public/static/etc. as keywords to display a list with other modifiers
            // and possible return types.
            switch (word.ToLowerInvariant())
            {
            case "imports":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CodeCompletionDataProvider(new ExpressionResult("Global", ExpressionContext.Importable)), ' ');
                return(true);

            case "as":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Type), ' ');
                return(true);

            case "new":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.ObjectCreation), ' ');
                return(true);

            case "inherits":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Type), ' ');
                return(true);

            case "implements":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Interface), ' ');
                return(true);

            case "overrides":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new OverrideCompletionDataProvider(), ' ');
                return(true);

            case "return":
                if (IsInComment(editor))
                {
                    return(false);
                }
                IMember m = GetCurrentMember(editor);
                if (m != null)
                {
                    ProvideContextCompletion(editor, m.ReturnType, ' ');
                    return(true);
                }
                else
                {
                    goto default;
                }

            case "option":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new TextCompletionDataProvider("Explicit On",
                                                                           "Explicit Off",
                                                                           "Strict On",
                                                                           "Strict Off",
                                                                           "Infer On",
                                                                           "Infer Off",
                                                                           "Compare Binary",
                                                                           "Compare Text"), ' ');
                return(true);

            default:
                return(base.HandleKeyword(editor, word));
            }
        }
コード例 #16
0
        public override bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
        {
            CSharpExpressionFinder ef = CreateExpressionFinder(editor.FileName);
            int cursor = editor.ActiveTextAreaControl.Caret.Offset;
            ExpressionContext context = null;

            if (ch == '(')
            {
                if (context != null)
                {
                    if (IsInComment(editor))
                    {
                        return(false);
                    }
                    editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(context), ch);
                    return(true);
                }
                else if (EnableMethodInsight && CodeCompletionOptions.InsightEnabled)
                {
                    editor.ShowInsightWindow(new MethodInsightDataProvider());
                    return(true);
                }
                return(false);
            }
            else if (ch == '[')
            {
                LineSegment line = editor.Document.GetLineSegmentForOffset(cursor);
                if (TextUtilities.FindPrevWordStart(editor.Document, cursor) <= line.Offset)
                {
                    // [ is first character on the line
                    // -> Attribute completion
                    editor.ShowCompletionWindow(new AttributesDataProvider(ParserService.CurrentProjectContent), ch);
                    return(true);
                }
            }
            else if (ch == ',' && CodeCompletionOptions.InsightRefreshOnComma && CodeCompletionOptions.InsightEnabled)
            {
                if (InsightRefreshOnComma(editor, ch))
                {
                    return(true);
                }
            }
            else if (ch == '=')
            {
                LineSegment curLine      = editor.Document.GetLineSegmentForOffset(cursor);
                string      documentText = editor.Text;
                int         position     = editor.ActiveTextAreaControl.Caret.Offset - 2;

                if (position > 0 && (documentText[position + 1] == '+'))
                {
                    ExpressionResult result = ef.FindFullExpression(documentText, position);

                    if (result.Expression != null)
                    {
                        ResolveResult resolveResult = ParserService.Resolve(result, editor.ActiveTextAreaControl.Caret.Line + 1, editor.ActiveTextAreaControl.Caret.Column + 1, editor.FileName, documentText);
                        if (resolveResult != null && resolveResult.ResolvedType != null)
                        {
                            IClass underlyingClass = resolveResult.ResolvedType.GetUnderlyingClass();
                            if (underlyingClass != null && underlyingClass.IsTypeInInheritanceTree(ParserService.CurrentProjectContent.GetClass("System.MulticastDelegate", 0)))
                            {
                                EventHandlerCompletitionDataProvider eventHandlerProvider = new EventHandlerCompletitionDataProvider(result.Expression, resolveResult);
                                eventHandlerProvider.InsertSpace = true;
                                editor.ShowCompletionWindow(eventHandlerProvider, ch);
                            }
                        }
                    }
                }
                else if (position > 0)
                {
                    ExpressionResult result = ef.FindFullExpression(documentText, position);

                    if (result.Expression != null)
                    {
                        ResolveResult resolveResult = ParserService.Resolve(result, editor.ActiveTextAreaControl.Caret.Line + 1, editor.ActiveTextAreaControl.Caret.Column + 1, editor.FileName, documentText);
                        if (resolveResult != null && resolveResult.ResolvedType != null)
                        {
                            if (ProvideContextCompletion(editor, resolveResult.ResolvedType, ch))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            else if (ch == '.')
            {
                editor.ShowCompletionWindow(new CSharpCodeCompletionDataProvider(), ch);
                return(true);
            }
            else if (ch == '>')
            {
                if (IsInComment(editor))
                {
                    return(false);
                }
                char prevChar = cursor > 1 ? editor.Document.GetCharAt(cursor - 1) : ' ';
                if (prevChar == '-')
                {
                    editor.ShowCompletionWindow(new PointerArrowCompletionDataProvider(), ch);

                    return(true);
                }
            }

            if (char.IsLetter(ch) && CodeCompletionOptions.CompleteWhenTyping)
            {
                if (editor.ActiveTextAreaControl.SelectionManager.HasSomethingSelected)
                {
                    // allow code completion when overwriting an identifier
                    cursor = editor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0].Offset;
                    int endOffset = editor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0].EndOffset;
                    // but block code completion when overwriting only part of an identifier
                    if (endOffset < editor.Document.TextLength && char.IsLetterOrDigit(editor.Document.GetCharAt(endOffset)))
                    {
                        return(false);
                    }
                    editor.ActiveTextAreaControl.SelectionManager.RemoveSelectedText();
                    editor.ActiveTextAreaControl.Caret.Position = editor.Document.OffsetToPosition(cursor);
                }
                char prevChar        = cursor > 1 ? editor.Document.GetCharAt(cursor - 1) : ' ';
                bool afterUnderscore = prevChar == '_';
                if (afterUnderscore)
                {
                    cursor--;
                    prevChar = cursor > 1 ? editor.Document.GetCharAt(cursor - 1) : ' ';
                }
                if (!char.IsLetterOrDigit(prevChar) && prevChar != '.' && !IsInComment(editor))
                {
                    ExpressionResult result = ef.FindExpression(editor.Text, cursor);
                    LoggingService.Debug("CC: Beginning to type a word, result=" + result);
                    if (result.Context != ExpressionContext.IdentifierExpected)
                    {
                        editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(result.Context)
                        {
                            ShowTemplates = true,
                            AllowCompleteExistingExpression = afterUnderscore
                        }, '\0');
                    }
                }
            }

            return(base.HandleKeyPress(editor, ch));
        }
コード例 #17
0
        public override bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
        {
            CSharpExpressionFinder ef = new CSharpExpressionFinder(editor.FileName);
            int cursor = editor.ActiveTextAreaControl.Caret.Offset;
            ExpressionContext context = null;

            if (ch == '(')
            {
                if (CodeCompletionOptions.KeywordCompletionEnabled)
                {
                    switch (editor.GetWordBeforeCaret().Trim())
                    {
                    case "for":
                    case "lock":
                        context = ExpressionContext.Default;
                        break;

                    case "using":
                        context = ExpressionContext.TypeDerivingFrom(ParserService.CurrentProjectContent.GetClass("System.IDisposable"), false);
                        break;

                    case "catch":
                        context = ExpressionContext.TypeDerivingFrom(ParserService.CurrentProjectContent.GetClass("System.Exception"), false);
                        break;

                    case "foreach":
                    case "typeof":
                    case "sizeof":
                    case "default":
                        context = ExpressionContext.Type;
                        break;
                    }
                }
                if (context != null)
                {
                    if (IsInComment(editor))
                    {
                        return(false);
                    }
                    editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(context), ch);
                    return(true);
                }
                else if (EnableMethodInsight && CodeCompletionOptions.InsightEnabled)
                {
                    editor.ShowInsightWindow(new MethodInsightDataProvider());
                    return(true);
                }
                return(false);
            }
            else if (ch == '[')
            {
                LineSegment line = editor.Document.GetLineSegmentForOffset(cursor);
                if (TextUtilities.FindPrevWordStart(editor.Document, cursor) <= line.Offset)
                {
                    // [ is first character on the line
                    // -> Attribute completion
                    editor.ShowCompletionWindow(new AttributesDataProvider(ParserService.CurrentProjectContent), ch);
                    return(true);
                }
            }
            else if (ch == ',' && CodeCompletionOptions.InsightRefreshOnComma && CodeCompletionOptions.InsightEnabled)
            {
                if (InsightRefreshOnComma(editor, ch))
                {
                    return(true);
                }
            }
            else if (ch == '=')
            {
                LineSegment curLine      = editor.Document.GetLineSegmentForOffset(cursor);
                string      documentText = editor.Text;
                int         position     = editor.ActiveTextAreaControl.Caret.Offset - 2;

                if (position > 0 && (documentText[position + 1] == '+'))
                {
                    ExpressionResult result = ef.FindFullExpression(documentText, position);

                    if (result.Expression != null)
                    {
                        ResolveResult resolveResult = ParserService.Resolve(result, editor.ActiveTextAreaControl.Caret.Line + 1, editor.ActiveTextAreaControl.Caret.Column + 1, editor.FileName, documentText);
                        if (resolveResult != null && resolveResult.ResolvedType != null)
                        {
                            IClass underlyingClass = resolveResult.ResolvedType.GetUnderlyingClass();
                            if (underlyingClass != null && underlyingClass.IsTypeInInheritanceTree(ParserService.CurrentProjectContent.GetClass("System.MulticastDelegate")))
                            {
                                EventHandlerCompletitionDataProvider eventHandlerProvider = new EventHandlerCompletitionDataProvider(result.Expression, resolveResult);
                                eventHandlerProvider.InsertSpace = true;
                                editor.ShowCompletionWindow(eventHandlerProvider, ch);
                            }
                        }
                    }
                }
                else if (position > 0)
                {
                    ExpressionResult result = ef.FindFullExpression(documentText, position);

                    if (result.Expression != null)
                    {
                        ResolveResult resolveResult = ParserService.Resolve(result, editor.ActiveTextAreaControl.Caret.Line + 1, editor.ActiveTextAreaControl.Caret.Column + 1, editor.FileName, documentText);
                        if (resolveResult != null && resolveResult.ResolvedType != null)
                        {
                            if (ProvideContextCompletion(editor, resolveResult.ResolvedType, ch))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            else if (ch == ';')
            {
                LineSegment curLine = editor.Document.GetLineSegmentForOffset(cursor);
                // don't return true when inference succeeds, otherwise the ';' won't be added to the document.
                TryDeclarationTypeInference(editor, curLine);
            }

            return(base.HandleKeyPress(editor, ch));
        }
コード例 #18
0
        public override bool HandleKeyword(SharpDevelopTextAreaControl editor, string word)
        {
            switch (word)
            {
            case "using":
                if (IsInComment(editor))
                {
                    return(false);
                }

                ParseInformation parseInfo = ParserService.GetParseInformation(editor.FileName);
                if (parseInfo != null)
                {
                    IClass innerMostClass = parseInfo.MostRecentCompilationUnit.GetInnermostClass(editor.ActiveTextAreaControl.Caret.Line + 1, editor.ActiveTextAreaControl.Caret.Column + 1);
                    if (innerMostClass == null)
                    {
                        editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Namespace), ' ');
                    }
                    return(true);
                }
                return(false);

            case "as":
            case "is":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Type), ' ');
                return(true);

            case "override":
                if (IsInComment(editor))
                {
                    return(false);
                }
                editor.ShowCompletionWindow(new OverrideCompletionDataProvider(), ' ');
                return(true);

            case "new":
                return(ShowNewCompletion(editor));

            case "case":
                if (IsInComment(editor))
                {
                    return(false);
                }
                return(DoCaseCompletion(editor));

            case "return":
                if (IsInComment(editor))
                {
                    return(false);
                }
                IMember m = GetCurrentMember(editor);
                if (m != null)
                {
                    return(ProvideContextCompletion(editor, m.ReturnType, ' '));
                }
                else
                {
                    goto default;
                }

            default:
                return(base.HandleKeyword(editor, word));
            }
        }
コード例 #19
0
ファイル: Actions.cs プロジェクト: carlhuth/GenXSource
        public override void Execute(TextArea services)
        {
            SharpDevelopTextAreaControl sdtac = (SharpDevelopTextAreaControl)services.MotherTextEditorControl;

            sdtac.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(), '\0');
        }