public void InsertCompletion(object obj, EventArgs args) { if (widget.BanCompletion) { return; } CompletionWindowManager.IsTemplateModes = false; ICompletionDataList completionList = new CompletionDataList(); currentCompletionContext = widget.CreateCodeCompletionContext(); string writeWord = widget.GetCompletionText(currentCompletionContext, false); string fullWord = widget.GetCompletionText(currentCompletionContext, true); CompletionTyp completiontype = (CompletionTyp)widget.GetCompletionTyp(); if (completiontype == CompletionTyp.includeType) { completionList = editor.GetCompletionData(writeWord, fullWord); } else { completionList = editor.GetCompletionData(writeWord, fullWord, completiontype); //ParseString(writeWord,fullWord,completiontype); } CompletionWindowManager.ShowWindow((char)0, completionList, widget, currentCompletionContext, OnCompletionWindowClosed); editor.GrabFocus(); }
internal void InitializeListWindow(ICompletionWidget completionWidget, CodeCompletionContext completionContext) { if (completionWidget == null) { throw new ArgumentNullException("completionWidget"); } if (completionContext == null) { throw new ArgumentNullException("completionContext"); } if (mutableList != null) { mutableList.Changing -= OnCompletionDataChanging; mutableList.Changed -= OnCompletionDataChanged; HideFooter(); } ResetState(); CompletionWidget = completionWidget; CodeCompletionContext = completionContext; string text = CompletionWidget.GetCompletionText(CodeCompletionContext); initialWordLength = CompletionWidget.SelectedLength > 0 ? 0 : text.Length; StartOffset = CompletionWidget.CaretOffset - initialWordLength; }
internal bool ShowListWindow(char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext, System.Action closedDelegate) { if (mutableList != null) { mutableList.Changing -= OnCompletionDataChanging; mutableList.Changed -= OnCompletionDataChanged; HideFooter(); } //initialWordLength = 0; this.completionDataList = list; this.CompleteWithSpaceOrPunctuation = true; //MonoDevelop.Core.PropertyService.Get ("CompleteWithSpaceOrPunctuation", true); this.CodeCompletionContext = completionContext; this.closedDelegate = closedDelegate; mutableList = completionDataList as IMutableCompletionDataList; List.PreviewCompletionString = completionDataList.CompletionSelectionMode == CompletionSelectionMode.OwnTextField; if (mutableList != null) { mutableList.Changing += OnCompletionDataChanging; mutableList.Changed += OnCompletionDataChanged; if (mutableList.IsChanging) { OnCompletionDataChanging(null, null); } } this.CompletionWidget = completionWidget; if (FillList()) { // not neccessarry, because list window is not reused anymore: // Reset (true); this.AutoSelect = list.AutoSelect; this.AutoCompleteEmptyMatch = list.AutoCompleteEmptyMatch; // makes control-space in midle of words to work string text = completionWidget.GetCompletionText(completionContext, false); DefaultCompletionString = completionDataList.DefaultCompletionString ?? ""; if (text.Length == 0) { UpdateWordSelection(); initialWordLength = 0; //completionWidget.SelectedLength; ResetSizes(); ShowAll(); UpdateWordSelection(); //if there is only one matching result we take it by default if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging) { CompleteWord(); CompletionWindowManager.HideWindow(); } return(true); } initialWordLength = text.Length /*+ completionWidget.SelectedLength*/; PartialWord = text; UpdateWordSelection(); //if there is only one matching result we take it by default if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging) { CompleteWord(); CompletionWindowManager.HideWindow(); } else { ResetSizes(); ShowAll(); } return(true); } CompletionWindowManager.HideWindow(); return(false); }
internal bool ShowListWindow(char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext) { if (list == null) { throw new ArgumentNullException("list"); } if (completionContext == null) { throw new ArgumentNullException("completionContext"); } if (completionContext == null) { throw new ArgumentNullException("completionContext"); } if (mutableList != null) { mutableList.Changing -= OnCompletionDataChanging; mutableList.Changed -= OnCompletionDataChanged; HideFooter(); } ResetState(); CompletionWidget = completionWidget; CompletionDataList = list; CodeCompletionContext = completionContext; mutableList = completionDataList as IMutableCompletionDataList; PreviewCompletionString = completionDataList.CompletionSelectionMode == CompletionSelectionMode.OwnTextField; if (mutableList != null) { mutableList.Changing += OnCompletionDataChanging; mutableList.Changed += OnCompletionDataChanged; if (mutableList.IsChanging) { OnCompletionDataChanging(null, null); } } if (FillList()) { AutoSelect = list.AutoSelect; AutoCompleteEmptyMatch = list.AutoCompleteEmptyMatch; AutoCompleteEmptyMatchOnCurlyBrace = list.AutoCompleteEmptyMatchOnCurlyBrace; CloseOnSquareBrackets = list.CloseOnSquareBrackets; // makes control-space in midle of words to work string text = completionWidget.GetCompletionText(completionContext); DefaultCompletionString = completionDataList.DefaultCompletionString ?? ""; if (text.Length == 0) { UpdateWordSelection(); initialWordLength = 0; //completionWidget.SelectedLength; StartOffset = completionWidget.CaretOffset; ResetSizes(); ShowAll(); UpdateWordSelection(); UpdateDeclarationView(); //if there is only one matching result we take it by default if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging) { CompleteWord(); CompletionWindowManager.HideWindow(); return(false); } return(true); } initialWordLength = completionWidget.SelectedLength > 0 ? 0 : text.Length; StartOffset = completionWidget.CaretOffset - initialWordLength; HideWhenWordDeleted = initialWordLength != 0; ResetSizes(); UpdateWordSelection(); //if there is only one matching result we take it by default if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging) { CompleteWord(); CompletionWindowManager.HideWindow(); return(false); } ShowAll(); UpdateDeclarationView(); return(true); } CompletionWindowManager.HideWindow(); return(false); }
string ICompletionWidget.GetCompletionText(CodeCompletionContext ctx) { return(completionWidget.GetCompletionText(ImportContext(ctx, projection))); }