IWordCompletionSession IWordCompletionSessionFactoryService.CreateWordCompletionSession(ITextView textView, SnapshotSpan wordSpan, IEnumerable<string> wordCollection, bool isForward) { var completionData = new CompletionData( wordSpan, new ReadOnlyCollection<string>(wordCollection.ToList())); textView.Properties[_completionDataKey] = completionData; try { // Dismiss any active ICompletionSession instances. It's possible and possibly common for // normal intellisense to be active when the user invokes word completion. We want only word // completion displayed at this point foreach (var existingCompletionSession in _completionBroker.GetSessions(textView)) { existingCompletionSession.Dismiss(); } // Create a completion session at the start of the word. The actual session information will // take care of mapping it to a specific span var trackingPoint = textView.TextSnapshot.CreateTrackingPoint(wordSpan.Start, PointTrackingMode.Positive); var completionSession = _completionBroker.CreateCompletionSession(textView, trackingPoint, true); completionSession.Properties[WordCompletionSessionKey] = WordCompletionSessionKey; // Start the completion. This will cause it to get populated at which point we can go about // filtering the data completionSession.Start(); // Now move the word completion set to the fron var wordCompletionSet = completionSession.CompletionSets.FirstOrDefault(x => x.Moniker == WordCompletionSetName); if (wordCompletionSet == null) { wordCompletionSet = new CompletionSet(); } completionSession.SelectedCompletionSet = wordCompletionSet; var intellisenseSessionStack = _intellisenseSessionStackMapService.GetStackForTextView(textView); var wordTrackingSpan = wordSpan.Snapshot.CreateTrackingSpan(wordSpan.Span, SpanTrackingMode.EdgeInclusive); var wordCompletionSession = new WordCompletionSession( wordTrackingSpan, intellisenseSessionStack, completionSession, wordCompletionSet); // Ensure the correct item is selected and committed to the ITextBuffer. If this is a forward completion // then we select the first item, else the last. Sending the command will go ahead and insert the // completion in the given span var command = isForward ? IntellisenseKeyboardCommand.TopLine : IntellisenseKeyboardCommand.BottomLine; wordCompletionSession.SendCommand(command); return wordCompletionSession; } finally { textView.Properties.RemoveProperty(_completionDataKey); } }
public AutoCompleteResponse() { } // for deserialisation public AutoCompleteResponse(CompletionData d) { DisplayText = d.DisplayText; CompletionText = d.CompletionText; Description = d.Description; RequiredNamespaceImport = d.RequiredNamespaceImport; MethodHeader = d.MethodHeader; ReturnType = d.ReturnType; Snippet = d.Snippet; }
/// <summary> /// Initializes a new instance of the <see cref="CsTextEditor"/> class. /// </summary> public CsTextEditor() { // Adjust appearance FontFamily = new System.Windows.Media.FontFamily("Consolas"); FontSize = 14; Options.IndentationSize = 4; Options.HighlightCurrentLine = true; SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#"); var indentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(Options); indentationStrategy.IndentationString = " "; TextArea.IndentationStrategy = indentationStrategy; // Add event handlers TextArea.TextEntering += TextArea_TextEntering; TextArea.TextEntered += TextArea_TextEntered; // Remove binding for Enter (we want to do something else :)) InputBinding newLineBinding = null; foreach (var binding in TextArea.InputBindings) { var keyBinding = binding as KeyBinding; if (keyBinding != null) { if (keyBinding.Key == Key.Enter) { newLineBinding = keyBinding; break; } } } TextArea.InputBindings.Remove(newLineBinding); // Add special commands AddKeyGesture(ModifierKeys.Control, Key.Space, TextArea_ControlSpace); AddKeyGesture(ModifierKeys.None, Key.Enter, TextArea_ExecuteCSharpScript); AddKeyGesture(ModifierKeys.Control, Key.Enter, TextArea_ExecuteWinDbgCommand); AddKeyGesture(ModifierKeys.Shift, Key.Enter, TextArea_RegularNewLine); // Initialize project content projectContent = new ICSharpCode.NRefactory.CSharp.CSharpProjectContent(); // Initialize images CompletionData testData = new CompletionData(CompletionDataType.Unknown, ""); }
public CodeBlockCompletionData(CompletionData completionData) { this.Text = completionData.Text; this.Stub = completionData.Stub; //this.Description = completionData.Description; if (CodeBlockCompletionData.TypeToIcon == null) { var assembly = Assembly.GetExecutingAssembly(); TypeToIcon = new Dictionary<CompletionData.CompletionType, BitmapImage>(); TypeToIcon.Add(CompletionData.CompletionType.Method, GetBitmapImage(assembly, "method.png")); TypeToIcon.Add(CompletionData.CompletionType.Constructor, GetBitmapImage(assembly, "constructor.png")); TypeToIcon.Add(CompletionData.CompletionType.Class, GetBitmapImage(assembly, @"class.png")); TypeToIcon.Add(CompletionData.CompletionType.Property, GetBitmapImage(assembly, @"property.png")); TypeToIcon.Add(CompletionData.CompletionType.Keyword, GetBitmapImage(assembly, @"keyword.png")); } this.Image = TypeToIcon[completionData.Type]; }
public override bool IsOverload(CompletionData other) { return(false); }
public static bool Invoke(CM_PageRundown_New __instance) { var completionData = CompletionData.LoadFromCache(); Utilities.Log.Message("Load completion data"); Debug.Log("CM_PageRundown_New.UpdateRundownExpeditionProgression, RundownManager.RundownProgressionReady: " + RundownManager.RundownProgressionReady.ToString()); int totalMain = 0; int totalSecond = 0; int totalThird = 0; int totalPE = 0; int totalCompletesMain = 0; int totalCompletesSecond = 0; int totalCompletesThird = 0; int totalCompletesPE = 0; if (__instance.m_expIconsAll != null) { for (int index = 0; index < __instance.m_expIconsAll.Count; index++) { var icon = __instance.m_expIconsAll[index]; string expeditionKey = RundownManager.GetRundownProgressionExpeditionKey(icon.Tier, icon.ExpIndex); var completes = completionData.GetData(icon.Tier, icon.ExpIndex); if (completes.highCompletes > 0) { totalCompletesMain++; } if (completes.extremeCompletes > 0) { totalCompletesSecond++; } if (completes.overloadCompletes > 0) { totalCompletesThird++; } if (completes.peCompletes > 0) { totalCompletesPE++; } totalMain++; if (RundownManager.HasSecondaryLayer(icon.DataBlock)) { totalSecond++; } if (RundownManager.HasThirdLayer(icon.DataBlock)) { totalThird++; } if (RundownManager.HasAllCompletetionPossibility(icon.DataBlock)) { totalPE++; } } } if (__instance.m_tierMarkerSectorSummary != null) { __instance.m_tierMarkerSectorSummary.SetSectorIconTextForMain(totalCompletesMain.ToString() + "<size=50%><color=#FFFFFF33><size=55%>/" + totalMain + "</color></size>"); __instance.m_tierMarkerSectorSummary.SetSectorIconTextForSecondary(totalCompletesSecond.ToString() + "<size=50%><color=#FFFFFF33><size=55%>/" + totalSecond + "</color></size>"); __instance.m_tierMarkerSectorSummary.SetSectorIconTextForThird(totalCompletesThird.ToString() + "<size=50%><color=#FFFFFF33><size=55%>/" + totalThird + "</color></size>"); __instance.m_tierMarkerSectorSummary.SetSectorIconTextForAllCleared(totalCompletesPE.ToString() + "<size=50%><color=#FFFFFF33><size=55%>/" + totalPE + "</color></size>"); } if (__instance.m_tierMarker1 == null) { return(false); } var tierBReq = __instance.m_currentRundownData.ReqToReachTierB; var tierCReq = __instance.m_currentRundownData.ReqToReachTierC; var tierDReq = __instance.m_currentRundownData.ReqToReachTierD; var tierEReq = __instance.m_currentRundownData.ReqToReachTierE; var progressionData = new RundownManager.RundownProgData() { totalMain = totalMain, totalSecondary = totalSecond, totalThird = totalThird, totalAllClear = totalPE, clearedMain = totalCompletesMain, clearedSecondary = totalCompletesSecond, clearedThird = totalCompletesThird, clearedAllClear = totalCompletesPE, tierBUnlocked = totalCompletesMain >= tierBReq.MainSectors && totalCompletesSecond >= tierBReq.SecondarySectors && totalCompletesThird >= tierBReq.ThirdSectors && totalCompletesPE >= tierBReq.AllClearedSectors, tierCUnlocked = totalCompletesMain >= tierCReq.MainSectors && totalCompletesSecond >= tierCReq.SecondarySectors && totalCompletesThird >= tierCReq.ThirdSectors && totalCompletesPE >= tierCReq.AllClearedSectors, tierDUnlocked = totalCompletesMain >= tierDReq.MainSectors && totalCompletesSecond >= tierDReq.SecondarySectors && totalCompletesThird >= tierDReq.ThirdSectors && totalCompletesPE >= tierDReq.AllClearedSectors, tierEUnlocked = totalCompletesMain >= tierEReq.MainSectors && totalCompletesSecond >= tierEReq.SecondarySectors && totalCompletesThird >= tierEReq.ThirdSectors && totalCompletesPE >= tierEReq.AllClearedSectors }; __instance.m_tierMarker1.SetProgression(progressionData, new RundownTierProgressionData()); __instance.UpdateTierIconsWithProgression(null, __instance.m_expIconsTier1, __instance.m_tierMarker1, true); __instance.m_tierMarker2.SetProgression(progressionData, tierBReq); __instance.UpdateTierIconsWithProgression(null, __instance.m_expIconsTier2, __instance.m_tierMarker2, progressionData.tierBUnlocked); __instance.m_tierMarker3.SetProgression(progressionData, tierCReq); __instance.UpdateTierIconsWithProgression(null, __instance.m_expIconsTier3, __instance.m_tierMarker3, progressionData.tierCUnlocked); __instance.m_tierMarker4.SetProgression(progressionData, tierDReq); __instance.UpdateTierIconsWithProgression(null, __instance.m_expIconsTier4, __instance.m_tierMarker4, progressionData.tierDUnlocked); __instance.m_tierMarker5.SetProgression(progressionData, tierEReq); __instance.UpdateTierIconsWithProgression(null, __instance.m_expIconsTier5, __instance.m_tierMarker5, progressionData.tierEUnlocked); return(false); }
public CodeBlockInsightItem(CompletionData completionData) { this.Signature = completionData.Stub; this.MethodName = completionData.Text; }
public virtual CompletionData GetExpressionCompletionData(EvaluationContext ctx, string exp) { int i; if (exp.Length == 0) { return(null); } if (exp [exp.Length - 1] == '.') { exp = exp.Substring(0, exp.Length - 1); i = 0; while (i < exp.Length) { ValueReference vr = null; try { vr = ctx.Evaluator.Evaluate(ctx, exp.Substring(i), null); if (vr != null) { CompletionData data = new CompletionData(); foreach (ValueReference cv in vr.GetChildReferences(ctx.Options)) { data.Items.Add(new CompletionItem(cv.Name, cv.Flags)); } data.ExpressionLenght = 0; return(data); } } catch (Exception ex) { Console.WriteLine(ex); } i++; } return(null); } i = exp.Length - 1; bool lastWastLetter = false; while (i >= 0) { char c = exp [i--]; if (!char.IsLetterOrDigit(c) && c != '_') { break; } lastWastLetter = !char.IsDigit(c); } if (lastWastLetter) { string partialWord = exp.Substring(i + 1); CompletionData data = new CompletionData(); data.ExpressionLenght = partialWord.Length; // Local variables foreach (ValueReference vc in GetLocalVariables(ctx)) { if (vc.Name.StartsWith(partialWord)) { data.Items.Add(new CompletionItem(vc.Name, vc.Flags)); } } // Parameters foreach (ValueReference vc in GetParameters(ctx)) { if (vc.Name.StartsWith(partialWord)) { data.Items.Add(new CompletionItem(vc.Name, vc.Flags)); } } // Members ValueReference thisobj = GetThisReference(ctx); if (thisobj != null) { data.Items.Add(new CompletionItem("this", ObjectValueFlags.Field | ObjectValueFlags.ReadOnly)); } object type = GetEnclosingType(ctx); foreach (ValueReference vc in GetMembers(ctx, null, type, thisobj != null ? thisobj.Value : null)) { if (vc.Name.StartsWith(partialWord)) { data.Items.Add(new CompletionItem(vc.Name, vc.Flags)); } } if (data.Items.Count > 0) { return(data); } } return(null); }
IWordCompletionSession IWordCompletionSessionFactoryService.CreateWordCompletionSession(ITextView textView, SnapshotSpan wordSpan, IEnumerable <string> wordCollection, bool isForward) { var completionData = new CompletionData( wordSpan, new ReadOnlyCollection <string>(wordCollection.ToList())); textView.Properties[_completionDataKey] = completionData; try { // Dismiss any active ICompletionSession instances. It's possible and possibly common for // normal intellisense to be active when the user invokes word completion. We want only word // completion displayed at this point foreach (var existingCompletionSession in _completionBroker.GetSessions(textView)) { existingCompletionSession.Dismiss(); } // Create a completion session at the start of the word. The actual session information will // take care of mapping it to a specific span var trackingPoint = textView.TextSnapshot.CreateTrackingPoint(wordSpan.Start, PointTrackingMode.Positive); var completionSession = _completionBroker.CreateCompletionSession(textView, trackingPoint, true); completionSession.Properties[WordCompletionSessionKey] = WordCompletionSessionKey; // Start the completion. This will cause it to get populated at which point we can go about // filtering the data completionSession.Start(); // It's possible for the Start method to dismiss the ICompletionSession. This happens when there // is an initialization error such as being unable to find a CompletionSet. If this occurs we // just return the equivalent IWordCompletionSession (one which is dismissed) if (completionSession.IsDismissed) { return(new DismissedWordCompletionSession(textView)); } // Now move the word completion set to the fron var wordCompletionSet = completionSession.CompletionSets.OfType <WordCompletionSet>().FirstOrDefault(); if (wordCompletionSet == null) { wordCompletionSet = new WordCompletionSet(); } completionSession.SelectedCompletionSet = wordCompletionSet; var intellisenseSessionStack = _intellisenseSessionStackMapService.GetStackForTextView(textView); var wordTrackingSpan = wordSpan.Snapshot.CreateTrackingSpan(wordSpan.Span, SpanTrackingMode.EdgeInclusive); var wordCompletionSession = new WordCompletionSession( wordTrackingSpan, intellisenseSessionStack, completionSession, wordCompletionSet); // Ensure the correct item is selected and committed to the ITextBuffer. If this is a forward completion // then we select the first item, else the last. Sending the command will go ahead and insert the // completion in the given span var command = isForward ? IntellisenseKeyboardCommand.TopLine : IntellisenseKeyboardCommand.BottomLine; wordCompletionSession.SendCommand(command); return(wordCompletionSession); } finally { textView.Properties.RemoveProperty(_completionDataKey); } }
public override bool IsCommitCharacter(CompletionData completionItem, char ch, string textTypedSoFar) { // Only commit on dot. return(ch == '.'); }
public void GetCompletedData() { ListDataKeywords = new List <CompletionData>(); ListDataTypes = new List <CompletionData>(); ListDataMembers = new List <CompletionData>(); ListDataProperties = new List <CompletionData>(); ListDataEvents = new List <CompletionData>(); AllCompletionRepeat = new CompletionDataList(); AllCompletionOnlyOne = new CompletionDataList(); NewCompletion = new CompletionDataList(); DotCompletion = new CompletionDataList(); if (!System.IO.File.Exists(FilePath)) { Tool.Logger.Error("CodeCompletion file not exist!", null); return; } SqlLiteDal sqlLiteDal = new SqlLiteDal(FilePath); SqliteConnection dbcon = (SqliteConnection)sqlLiteDal.GetConnect(); //GetConnect(); if (dbcon == null) { return; } SqliteCommand dbcmd = dbcon.CreateCommand(); string sql = "SELECT * FROM completed;"; dbcmd.CommandText = sql; SqliteDataReader reader = null; try { reader = dbcmd.ExecuteReader(); int numberCollumns = reader.FieldCount; if (numberCollumns < 5) { return; } while (reader.Read()) { CompletionData cd; string name = reader.GetValue(1).ToString(); string signature = reader.GetValue(2).ToString(); int type = reader.GetInt32(3); string parent = reader.GetValue(4).ToString(); string summary = ""; string returnType = ""; if (numberCollumns >= 6) { summary = reader.GetValue(5).ToString(); } if (numberCollumns >= 7) { returnType = reader.GetValue(6).ToString(); } cd = new CompletionData(name, null, signature, name, 1, parent, returnType); cd.Signature = signature; if (!string.IsNullOrEmpty(summary)) { cd.Description = cd.Description + Environment.NewLine + summary; //+Environment.NewLine; } if (type == (int)CompletionDataTyp.keywords) { ListDataKeywords.Add(cd); } else if (type == (int)CompletionDataTyp.members) { ListDataMembers.Add(cd); } else if (type == (int)CompletionDataTyp.types) { ListDataTypes.Add(cd); } else if (type == (int)CompletionDataTyp.properties) { ListDataProperties.Add(cd); } else if (type == (int)CompletionDataTyp.events) { ListDataEvents.Add(cd); } } } catch (Exception ex) { Console.WriteLine(ex.Message); Tool.Logger.Error("ERROR LOADING COMPLETED CACHE"); Tool.Logger.Error(ex.Message); //MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error); //ms.ShowDialog(); } finally { if (reader != null) { reader.Close(); } reader = null; dbcmd.Dispose(); dbcmd = null; dbcon.Close(); dbcon = null; } AllCompletionRepeat = GetCompletionData(CompletionTyp.allType, false); AllCompletionOnlyOne = GetCompletionData(CompletionTyp.allType, true); NewCompletion = GetCompletionData(CompletionTyp.newType, true); DotCompletion = GetCompletionData(CompletionTyp.dotType, true); IncludeCompletion = GetCompletionData(CompletionTyp.includeType, true); }
private void TreeViewItem_Expanded(object sender, RoutedEventArgs e) { try { TreeViewItem item = e.Source as TreeViewItem; TreeListView tree = null; FrameworkElement parent = item?.Parent as FrameworkElement; while (tree == null && parent != null) { tree = parent as TreeListView; parent = parent.Parent as FrameworkElement; } if ((item.Items.Count == 1) && (item.Items[0].ToString() == ExpandingItemText)) { TreeViewItemTag tag = item.Tag as TreeViewItemTag; System.Threading.Tasks.Task.Run(() => { IResultVisualizer resultTreeItem = tag.ResultTreeItem as IResultVisualizer; IEnumerable <IResultVisualizer> children = tag.ResultTreeItem as IEnumerable <IResultVisualizer>; try { if (resultTreeItem != null) { List <Tuple <string, IEnumerable <IResultVisualizer> > > customChildren = new List <Tuple <string, IEnumerable <IResultVisualizer> > >(); foreach (Tuple <string, IEnumerable <IResultVisualizer> > customChild in resultTreeItem.ChildrenGroups) { if (customChild.Item2.Any()) { if (customChild.Item1 == ResultVisualizer.ExpandedGroupName) { List <IResultVisualizer> cachedItems = customChild.Item2.ToList(); customChildren.Add(Tuple.Create(customChild.Item1, (IEnumerable <IResultVisualizer>)cachedItems)); foreach (IResultVisualizer child in cachedItems) { child.Initialize(); } } else { customChildren.Add(customChild); } } } item.Dispatcher.InvokeAsync(() => { try { int level = tag.Level; item.Items.Clear(); foreach (Tuple <string, IEnumerable <IResultVisualizer> > customChild in customChildren) { if (customChild.Item1 == ResultVisualizer.ExpandedGroupName) { foreach (IResultVisualizer child in customChild.Item2) { item.Items.Add(CreateTreeItem(tree, child, level + 1)); } } else { TreeViewItem customItem = CreateTreeItem(tree, customChild.Item1, CompletionData.GetImage(CompletionDataType.Namespace), level + 1, nameItalic: true); customItem.Tag = new TreeViewItemTag() { Level = level + 1, ResultTreeItem = customChild.Item2, }; customItem.Items.Add(ExpandingItemText); customItem.Expanded += TreeViewItem_Expanded; item.Items.Add(customItem); // If we have only one child and if it is [Dynamic] group, let's expand it... if (customChildren.Count == 1 && customChild.Item1 == ResultVisualizer.DynamicGroupName) { customItem.IsExpanded = true; } } } } catch (Exception ex3) { MessageBox.Show(ex3.ToString()); } }); } else if (children != null) { List <IResultVisualizer> cachedItems = children.ToList(); foreach (IResultVisualizer child in children) { child.Initialize(); } item.Dispatcher.InvokeAsync(() => { try { int level = tag.Level; item.Items.Clear(); foreach (IResultVisualizer child in cachedItems) { item.Items.Add(CreateTreeItem(tree, child, level + 1)); } } catch (Exception ex3) { MessageBox.Show(ex3.ToString()); } }); } } catch (Exception ex2) { MessageBox.Show(ex2.ToString()); } }); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Extracts entries that should be visualized. /// </summary> /// <returns>Entries that should be visualized as a group.</returns> private IEnumerable <IResultVisualizer> ExtractItems() { foreach (DictionaryEntry entry in dictionary) { yield return(Create(GetValue(() => entry.Value), resultType.GetElementType(), entry.Key.ToString(), CompletionData.GetImage(CompletionDataType.Variable), interactiveResultVisualizer)); } }
private CompletionDataList GetCompletionData(CompletionTyp completiontype, bool onlyOne) { CompletionDataList listComplete = new CompletionDataList(); if (completiontype == CompletionTyp.includeType) { listComplete.Add(new CompletionData("lib", null, "lib", "lib://")); listComplete.Add(new CompletionData("app", null, "app", "app://")); return(listComplete); } if (MainClass.CompletedCache.ListDataKeywords != null) { foreach (CompletionData cd in MainClass.CompletedCache.ListDataKeywords) { if (cd != null) { CompletionData cdParent = listComplete.Find(cd.DisplayText); if ((cdParent == null) || (!onlyOne)) { if (completiontype != CompletionTyp.newType) { cdParent = cd.Clone(); cdParent.OverloadedData.Add(cd.Clone()); listComplete.Add(cdParent); } } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.IsOverloaded = true; cdParent.OverloadedData.Add(cd.Clone()); cdParent.Description = cdParent.Description + Environment.NewLine + Environment.NewLine + cd.Description; } } } } } //Types (from doc T:) //i = 0; if (MainClass.CompletedCache.ListDataTypes != null) { foreach (CompletionData cd in MainClass.CompletedCache.ListDataTypes) { if (cd != null) { CompletionData cdParent = listComplete.Find(cd.DisplayText); if ((cdParent == null) || (!onlyOne)) { if (completiontype != CompletionTyp.dotType) { cdParent = cd.Clone(); cdParent.OverloadedData.Add(cd.Clone()); listComplete.Add(cdParent); } } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.IsOverloaded = true; cdParent.OverloadedData.Add(cd.Clone()); cdParent.Description = cdParent.Description + Environment.NewLine + Environment.NewLine + cd.Description; } } } } } // M P E //Member (from doc M: ) //i = 0; if (MainClass.CompletedCache.ListDataMembers != null) { foreach (CompletionData cd in MainClass.CompletedCache.ListDataMembers) { if (cd != null) { //if (cd.DisplayText==baseWord) // i++; CompletionData cdParent = listComplete.Find(cd.DisplayText); if ((cdParent == null) || (!onlyOne)) { if (completiontype != CompletionTyp.newType) { cdParent = cd.Clone(); cdParent.OverloadedData.Add(cd.Clone()); listComplete.Add(cdParent); } } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.IsOverloaded = true; cdParent.OverloadedData.Add(cd.Clone()); cdParent.Description = cdParent.Description + Environment.NewLine + Environment.NewLine + cd.Description; } } } } } //Member (from doc P:) //i = 0; if (MainClass.CompletedCache.ListDataProperties != null) { foreach (CompletionData cd in MainClass.CompletedCache.ListDataProperties) { if (cd != null) { //if (cd.DisplayText==baseWord) // i++; //if(!onlyOne) // if(cd.DisplayText=="width") // Console.WriteLine("1"); CompletionData cdParent = listComplete.Find(cd.DisplayText); if ((cdParent == null) || (!onlyOne)) { if (completiontype != CompletionTyp.newType) { cdParent = cd.Clone(); cdParent.OverloadedData.Add(cd.Clone()); listComplete.Add(cdParent); } } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.IsOverloaded = true; cdParent.OverloadedData.Add(cd.Clone()); cdParent.Description = cdParent.Description + Environment.NewLine + Environment.NewLine + cd.Description; } } } } } //Member (from doc E:) //i = 0; if (MainClass.CompletedCache.ListDataEvents != null) { foreach (CompletionData cd in MainClass.CompletedCache.ListDataEvents) { if (cd != null) { //if (cd.DisplayText==baseWord) // i++; CompletionData cdParent = listComplete.Find(cd.DisplayText); if ((cdParent == null) || (!onlyOne)) { if (completiontype != CompletionTyp.newType) { cdParent = cd.Clone(); cdParent.OverloadedData.Add(cd.Clone()); listComplete.Add(cdParent); } } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.IsOverloaded = true; cdParent.OverloadedData.Add(cd.Clone()); cdParent.Description = cdParent.Description + Environment.NewLine + Environment.NewLine + cd.Description; } } } } } return(listComplete); }
/// <summary> /// Extracts fields of the object that will be visualized in [Expanded] group. /// </summary> /// <returns></returns> private IEnumerable <IResultVisualizer> ExtractFields() { CodeType codeType = variable.GetCodeType(); if (extractUsingClasses) { foreach (string baseClass in codeType.InheritedClasses.Keys) { object baseClassValue = GetValue(() => variable.GetBaseClass(baseClass)); Variable baseClassVariable = baseClassValue as Variable; if (baseClassVariable != null) { yield return(new VariableResultVisualizer(baseClassVariable, typeof(Variable), $"[{baseClass}]", CompletionData.GetImage(CompletionDataType.Class), interactiveResultVisualizer)); } else { yield return(Create(baseClassValue, typeof(Variable), $"[{baseClass}]", CompletionData.GetImage(CompletionDataType.Class), interactiveResultVisualizer)); } } foreach (string fieldName in codeType.ClassFieldNames) { yield return(Create(GetValue(() => variable.GetClassField(fieldName)), typeof(Variable), fieldName, CompletionData.GetImage(CompletionDataType.Variable), interactiveResultVisualizer)); } } else { foreach (string fieldName in codeType.FieldNames) { yield return(Create(GetValue(() => variable.GetField(fieldName)), typeof(Variable), fieldName, CompletionData.GetImage(CompletionDataType.Variable), interactiveResultVisualizer)); } } }
/// <summary> /// Gets group of array elements to be visualized. /// </summary> /// <param name="start">Array index of the group start.</param> /// <param name="end">Array index of the group end (not included).</param> /// <returns>Group of array elements to be visualized.</returns> private IEnumerable <IResultVisualizer> GetArrayElements(int start, int end) { for (int i = start; i < end; i++) { yield return(Create(GetValue(() => variable.GetArrayElement(i)), typeof(Variable), $"[{i}]", CompletionData.GetImage(CompletionDataType.Variable), interactiveResultVisualizer)); } }
public MainWindow() { InitializeComponent(); provinia = new Map(Map.Region.Provinia); undercity = new Map(Map.Region.Undercity); faery = new Map(Map.Region.Faery); hades = new Map(Map.Region.Hades); cloud = new Map(Map.Region.Cloud); nobles = new Nobles(new[] { provinia, undercity, faery, hades, cloud }); gateLayer = new GatesLayer(provinia); tradeRoutesLayer = new TradeRoutesLayer(provinia); garrisonLayer = new GarrisonLayer(provinia); Provinces.ItemsSource = provinia; Tunnels.ItemsSource = undercity; Faery.ItemsSource = faery; Hades.ItemsSource = hades; Cloud.ItemsSource = cloud; GatesLayer.ItemsSource = gateLayer.Gates; GateHitsLayer.ItemsSource = gateLayer.GateHitsAndDetections; TradeRoutesLayer.ItemsSource = tradeRoutesLayer.TradeRoutes; GarrisonLayer.ItemsSource = garrisonLayer.Garrisons; search.DataContext = provinia; Filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "olyviewer-temp.txt"); textEditor.SyntaxHighlighting = LoadHighlightingDefinition("oly.xshd"); textEditor.TextChanged += new EventHandler(textEditor_TextChanged); textEditor.TextArea.TextEntered += new TextCompositionEventHandler(TextArea_TextEntered); textEditor.TextArea.TextEntering += new TextCompositionEventHandler(TextArea_TextEntering); textEditor.MouseHover += new MouseEventHandler(textEditor_MouseHover); textEditor.MouseHoverStopped += new MouseEventHandler(textEditor_MouseHoverStopped); textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"w"), new KeyGesture(Key.Left, ModifierKeys.Control))); textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"n"), new KeyGesture(Key.Up, ModifierKeys.Control))); textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"e"), new KeyGesture(Key.Right, ModifierKeys.Control))); textEditor.TextArea.DefaultInputHandler.InputBindings.Add(new InputBinding(new MoveCommand(textEditor,"s"), new KeyGesture(Key.Down, ModifierKeys.Control))); foreach (var order in Orders.All) { var o = new CompletionData(order.Name, order.Help); orderCompletionData.Add(o); } }
public override bool IsCommitCharacter(CompletionData completionItem, char ch, string textTypedSoFar) { return(ch == ' ' || ch == '(' || ch == '{' || ch == '['); }
public virtual bool IsCommitCharacter(CompletionData completionItem, char ch, string textTypedSoFar) { return(csharpCommitChars.Contains(ch)); }
/// <summary> /// Vrati vsetky mozne autokompletion , do zoznamu prida aj slova zo samotneho dokumentu /// </summary> /// <returns> /// Zoznam autoCompletion slov odpovesajuci baseWord a completiontype /// </returns> public static ICompletionDataList GetCompletionData(this TextEditor editor, string baseWord, string fullWord, CompletionTyp completiontype) { string codestring = editor.Document.Text; string type = ""; string parent = ""; editor.ParseString(fullWord, out parent, out type); Regex regex = new Regex(@"\W", RegexOptions.Compiled); codestring = regex.Replace(codestring, " "); string[] list = codestring.Split(' '); CompletionDataList listComplete = new CompletionDataList(); listComplete.CompletionSelectionMode = CompletionSelectionMode.OwnTextField; if (!String.IsNullOrEmpty(type)) { //List<CompletionData> lst = MainClass.CompletedCache.AllCompletionOnlyOne.FindAll(x=>x.Parent == type); List <CompletionData> lst = MainClass.CompletedCache.AllCompletionRepeat.FindAll(x => x.Parent == type); foreach (CompletionData cd in lst) { string expres = cd.Parent + ".on"; if (cd.Signature.StartsWith(expres)) { //expres = cd.Signature.Replace(cd.Parent+".", cd.DisplayText +" = function "); expres = cd.Signature.Replace(cd.Parent + "." + cd.DisplayText, cd.DisplayText + " = function "); cd.DisplayDescription = expres + "{}"; cd.CompletionText = expres + "{" + Environment.NewLine + "}"; } } if (lst != null) { listComplete.AddRange(lst.ToArray()); } if (listComplete != null && listComplete.Count > 0) { return(listComplete); } } switch (completiontype) { case CompletionTyp.allType: { listComplete.AddRange(MainClass.CompletedCache.AllCompletionOnlyOne); break; } case CompletionTyp.newType: { listComplete.AddRange(MainClass.CompletedCache.NewCompletion); break; } case CompletionTyp.dotType: { listComplete.AddRange(MainClass.CompletedCache.DotCompletion); break; } } int i = 0; foreach (string s in list) { if (!String.IsNullOrEmpty(s.Trim())) { if (s == baseWord) { i++; } if ((listComplete.Find(s) == null) && (s.Length > 2) && ((s != baseWord) || (i == 1))) { CompletionData cd = new CompletionData(s, null, s, s); if (completiontype == CompletionTyp.newType) { if (char.ToUpper(s[0]) == s[0] && !char.IsDigit(s[0]) && !char.IsSymbol(s[0]) && char.IsLetter(s[0])) { CompletionData cdParent = listComplete.Find(cd.DisplayText); if (cdParent == null) { listComplete.Add(cd); } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.Description = cdParent.Description + Environment.NewLine + cd.Description; } } } } else { CompletionData cdParent = listComplete.Find(cd.DisplayText); if (cdParent == null) { listComplete.Add(cd); } else { if (!cdParent.Description.Contains(cd.Description)) { cdParent.Description = cdParent.Description + Environment.NewLine + cd.Description; } } } } } } return(listComplete); }
public virtual bool SendEnterThroughToEditor(CompletionData completionItem, string textTypedSoFar) { return(string.Compare(completionItem.DisplayText, textTypedSoFar, StringComparison.OrdinalIgnoreCase) == 0); }
internal BankIdCollectCompletedEvent(string orderRef, CompletionData completionData) : base(BankIdEventTypes.CollectCompletedId, BankIdEventTypes.CollectCompletedName, BankIdEventSeverity.Success) { OrderRef = orderRef; CompletionData = completionData; }
public CSharpTextEditorCompletion.CompletionDataCollector AddAccessibleCodeCompletionData(ExpressionContext context, CSharpTextEditorCompletion.CompletionDataCollector col) { if (context != ExpressionContext.Global && context != ExpressionContext.TypeName) { AddContentsFromClassAndMembers(context, col); if (lookupTableVisitor != null && lookupTableVisitor.Variables != null) { // int callingMemberline = CallingMember != null ? CallingMember.Location.Line : 0; // local variables could be outside members (LINQ initializers) foreach (KeyValuePair <string, List <LocalLookupVariable> > pair in lookupTableVisitor.Variables) { if (pair.Value != null && pair.Value.Count > 0) { foreach (LocalLookupVariable v in pair.Value) { DomLocation varStartPos = new DomLocation(lookupVariableLine + v.StartPos.Line, v.StartPos.Column - 1); DomLocation varEndPos = new DomLocation(lookupVariableLine + v.EndPos.Line, v.EndPos.Column - 1); if (varStartPos > this.resolvePosition || (!v.EndPos.IsEmpty && varEndPos < this.resolvePosition)) { continue; } col.Add(new LocalVariable(CallingMember, pair.Key, ConvertTypeReference(v.TypeRef), DomRegion.Empty)); } } } } if (CallingMember is IProperty) { IProperty property = (IProperty)callingMember; if (property.HasSet && editor != null && property.SetRegion.Contains(resolvePosition.Line, editor.CursorColumn)) { col.Add("value"); } } if (CallingMember is IEvent) { col.Add("value"); } } List <string> namespaceList = new List <string> (); namespaceList.Add(""); List <string> namespaceDeclList = new List <string> (); namespaceDeclList.Add(""); if (unit != null) { foreach (IUsing u in unit.Usings) { foreach (string alias in u.Aliases.Keys) { col.Add(alias); } if (u.Namespaces == null) { continue; } bool isNamespaceDecl = u.IsFromNamespace && u.Region.Contains(this.resolvePosition); if (u.IsFromNamespace && !isNamespaceDecl) { continue; } foreach (string ns in u.Namespaces) { namespaceList.Add(ns); if (isNamespaceDecl) { namespaceDeclList.Add(ns); } } } foreach (object o in dom.GetNamespaceContents(namespaceList, true, true)) { if (context.FilterEntry(o)) { continue; } if (o is Namespace) { Namespace ns = o as Namespace; bool skip = true; foreach (string str in namespaceDeclList) { if (dom.NamespaceExists(str.Length > 0 ? str + "." + ns.Name : ns.Name)) { skip = false; break; } } if (skip) { continue; } } //IMember member = o as IMember; //if (member != null && completionList.Find (member.Name) != null) // continue; if (context == ExpressionContext.Attribute) { IType t = o as IType; if (t != null && !t.IsBaseType(attributeType)) { continue; } } CompletionData data = col.Add(o); if (data != null && context == ExpressionContext.Attribute && data.CompletionText != null && data.CompletionText.EndsWith("Attribute")) { string newText = data.CompletionText.Substring(0, data.CompletionText.Length - "Attribute".Length); data.SetText(newText); } } CodeTemplateService.AddCompletionDataForMime("text/x-csharp", col.CompletionList); } return(col); }
public override bool SendEnterThroughToEditor(CompletionData completionItem, string textTypedSoFar) { return(false); }
public void ConnectionCompleted(CompletionData completionData) => CompletionDataList.Add(completionData);
/// <summary> /// Returns an array of <see cref="CompletionData"/> items. /// </summary> /// <returns></returns> public CompletionData[] ToArray() { CompletionData[] data = new CompletionData[Count]; CopyTo(data, 0); return(data); }
/// <summary> /// No usages??? /// </summary> /// <param name="entity"></param> /// <param name="text"></param> /// <returns></returns> public ICompletionData CreateEntityCompletionData(ICSharpCode.NRefactory.TypeSystem.IEntity entity, string text) { var cd = new CompletionData(text); return cd; }
public virtual bool IsFilterCharacter(CompletionData completionItem, char ch, string textTypedSoFar) { return(false); }
public static void Invoke() { var state = WardenObjectiveManager.CurrentState; var exp = RundownManager.GetActiveExpeditionData(); var completionData = CompletionData.LoadFromCache(); var data = completionData.GetData(exp.tier, exp.expeditionIndex); bool pe = true; if (state.main_status == eWardenObjectiveStatus.WardenObjectiveItemSolved) { data.highCompletes++; } else { pe = false; } if (state.second_status == eWardenObjectiveStatus.WardenObjectiveItemSolved) { data.extremeCompletes++; } else { pe = false; } if (state.third_status == eWardenObjectiveStatus.WardenObjectiveItemSolved) { data.overloadCompletes++; } else { pe = false; } if (pe) { data.peCompletes++; } completionData.Save(); bool highSolved = WardenObjectiveManager.CurrentState.main_status == eWardenObjectiveStatus.WardenObjectiveItemSolved; bool extremeSolved = RundownManager.HasSecondaryLayer(RundownManager.ActiveExpedition) && WardenObjectiveManager.CurrentState.second_status == eWardenObjectiveStatus.WardenObjectiveItemSolved; bool overloadSolved = RundownManager.HasThirdLayer(RundownManager.ActiveExpedition) && WardenObjectiveManager.CurrentState.third_status == eWardenObjectiveStatus.WardenObjectiveItemSolved; var progressionData = ExtendedPlayerAgent.LocalPlayer.ProgressionData; var expeditionSettingsBlocks = ExpeditionSettingsDataBlock.GetAllBlocks(); foreach (var expeditionSettingsBlock in expeditionSettingsBlocks) { if (expeditionSettingsBlock.Expedition.ExpeditionIndex == exp.expeditionIndex && expeditionSettingsBlock.Expedition.Tier == exp.tier) { var completionSettings = expeditionSettingsBlock.CompletionSettings; foreach (var progressionUpdate in completionSettings.ProgressionUpdates) { if (GameInfo.MeetsProgressionRequirements(progressionUpdate.ProgressionRequirements)) { if (progressionUpdate.HighCompleted == highSolved && progressionUpdate.ExtremeCompleted == extremeSolved && progressionUpdate.OverloadCompleted == overloadSolved) { progressionData.SetProgressionValue(exp.tier, exp.expeditionIndex, progressionUpdate.Value); } } } } } progressionData.Save(); }
public Task StoreCollectCompletedCompletionData(string orderRef, CompletionData completionData) { _logger.LogTrace(_eventId, "Storing completion data for OrderRef '{OrderRef}' (UserPersonalIdentityNumber: '{UserPersonalIdentityNumber}'; UserGivenName: '{UserGivenName}'; UserSurname: '{UserSurname}'; UserName: '******'; Signature: '{Signature}'; OcspResponse: '{OcspResponse}')", orderRef, completionData.User.PersonalIdentityNumber, completionData.User.GivenName, completionData.User.Surname, completionData.User.Name, completionData.Signature, completionData.OcspResponse); return(Task.CompletedTask); }
public static void BankIdCollectCompleted(this ILogger logger, string orderRef, CompletionData completionData) { logger.LogInformation(BankIdLoggingEvents.BankIdCollectCompleted, "BankID collect is completed for OrderRef '{OrderRef}'", orderRef); logger.LogTrace(BankIdLoggingEvents.BankIdCollectCompleted, "BankID collect is completed for OrderRef '{OrderRef}' with User (PersonalIdentityNumber: '{UserPersonalIdentityNumber}'; GivenName: '{UserGivenName}'; Surname: '{UserSurname}'; Name: '{UserName}'), Signature '{Signature}' and OcspResponse '{OcspResponse}'", orderRef, completionData.User.PersonalIdentityNumber, completionData.User.GivenName, completionData.User.Surname, completionData.User.Name, completionData.Signature, completionData.OcspResponse); }
public CompletionData GetExpressionCompletionData(int frameIndex, string exp) { SelectFrame(frameIndex); bool pointer = exp.EndsWith("->"); int i; if (pointer || exp.EndsWith(".")) { exp = exp.Substring(0, exp.Length - (pointer ? 2 : 1)); i = 0; while (i < exp.Length) { ObjectValue val = CreateVarObject(exp); if (!val.IsUnknown && !val.IsError) { CompletionData data = new CompletionData(); foreach (ObjectValue cv in val.GetAllChildren()) { data.Items.Add(new CompletionItem(cv.Name, cv.Flags)); } data.ExpressionLenght = 0; return(data); } i++; } return(null); } i = exp.Length - 1; bool lastWastLetter = false; while (i >= 0) { char c = exp [i--]; if (!char.IsLetterOrDigit(c) && c != '_') { break; } lastWastLetter = !char.IsDigit(c); } if (lastWastLetter) { string partialWord = exp.Substring(i + 1); CompletionData cdata = new CompletionData(); cdata.ExpressionLenght = partialWord.Length; // Local variables GdbCommandResult res = session.RunCommand("-stack-list-locals", "0"); foreach (ResultData data in res.GetObject("locals")) { string name = data.GetValue("name"); if (name.StartsWith(partialWord)) { cdata.Items.Add(new CompletionItem(name, ObjectValueFlags.Variable)); } } // Parameters res = session.RunCommand("-stack-list-arguments", "0", frameIndex.ToString(), frameIndex.ToString()); foreach (ResultData data in res.GetObject("stack-args").GetObject(0).GetObject("frame").GetObject("args")) { string name = data.GetValue("name"); if (name.StartsWith(partialWord)) { cdata.Items.Add(new CompletionItem(name, ObjectValueFlags.Parameter)); } } if (cdata.Items.Count > 0) { return(cdata); } } return(null); }
/// <summary> /// No usages??? /// </summary> /// <param name="entity"></param> /// <returns></returns> public ICompletionData CreateEntityCompletionData(ICSharpCode.NRefactory.TypeSystem.IUnresolvedEntity entity) { var cd = new CompletionData(entity.Name); return cd; }
/// <summary> /// No usages??? /// </summary> /// <param name="entity"></param> /// <param name="text"></param> /// <returns></returns> public ICompletionData CreateEntityCompletionData(ICSharpCode.NRefactory.TypeSystem.IEntity entity, string text) { var cd = new CompletionData(text); return(cd); }
/// <summary> /// No usages??? /// </summary> /// <param name="entity"></param> /// <returns></returns> public ICompletionData CreateEntityCompletionData(ICSharpCode.NRefactory.TypeSystem.IUnresolvedEntity entity) { var cd = new CompletionData(entity.Name); return(cd); }
private void avalonEdit_TextEntered(object sender, TextCompositionEventArgs e) { if (char.IsLetter(e.Text[0]) || e.Text[0] == '_') { int pos = avalonEdit.TextArea.Caret.Offset; string leftFromInput = avalonEdit.Text.Substring(0, pos); string rightFromInput = avalonEdit.Text.Substring(pos, avalonEdit.Text.Length - pos); //match first character in left half which is not word character Match matchLeft = Regex.Match(leftFromInput, "[^a-zA-Z&_]", RegexOptions.RightToLeft); //match first character in right half which is not word character Match matchRight = Regex.Match(rightFromInput, "[^a-zA-Z&_&0-9]"); int posLeft = matchLeft.Index; int posRight = matchRight.Index; //if match then move to first character of word if (matchLeft.Success) { posLeft += 1; } //if no match subtract current pos from end of file, later it increments if (!matchRight.Success) { posRight = avalonEdit.Text.Length - pos; } string currentWord = avalonEdit.Text.Substring(posLeft, ((posRight + pos) - posLeft)); //remove 'currentWord' from left and right halfs leftFromInput = leftFromInput.Substring(0, posLeft); rightFromInput = rightFromInput.Substring(posRight, rightFromInput.Length - posRight); //match all words that start with 'currentWord' (case insensitive) MatchCollection matchCollection = Regex.Matches(leftFromInput + rightFromInput, "(?i)\\b(" + currentWord + "\\w*)\\b"); if (matchCollection.Count > 0) { completionWindow = new CompletionWindow(avalonEdit.TextArea); IList <ICompletionData> data = completionWindow.CompletionList.CompletionData; HashSet <ICompletionData> uniqueData = new HashSet <ICompletionData>(); //insert matched words into window foreach (Match match in matchCollection) { CompletionData completionData = new CompletionData(match.Value, posLeft, currentWord.Length); //if not already inserted if (uniqueData.Add(completionData)) { data.Add(completionData); } } completionWindow.Show(); completionWindow.Closed += delegate { completionWindow = null; }; } else if (completionWindow != null) //if nothing matches close window if opened { completionWindow.Close(); } } }