FormattedText GetFunctionIntelliSense(IntelliSenseFunctionInfo functionInfo, int currentArgIndex) { var nameLine = new TextLine { new TextRun { Text = functionInfo.FunctionName + "(" } }; if (functionInfo.ArgumentList.Count > 0) { var argNames = functionInfo.ArgumentList.Take(currentArgIndex).Select(arg => arg.ArgumentName).ToArray(); if (argNames.Length >= 1) { nameLine.Add(new TextRun { Text = string.Join(", ", argNames) }); } if (functionInfo.ArgumentList.Count > currentArgIndex) { if (argNames.Length >= 1) { nameLine.Add(new TextRun { Text = ", " }); } nameLine.Add(new TextRun { Text = functionInfo.ArgumentList[currentArgIndex].ArgumentName, Style = System.Drawing.FontStyle.Bold }); argNames = functionInfo.ArgumentList.Skip(currentArgIndex + 1).Select(arg => arg.ArgumentName).ToArray(); if (argNames.Length >= 1) { nameLine.Add(new TextRun { Text = ", " + string.Join(", ", argNames) }); } } } nameLine.Add(new TextRun { Text = ")" }); var descriptionLines = GetFunctionDescription(functionInfo); var formattedText = new FormattedText { nameLine, descriptionLines }; if (functionInfo.ArgumentList.Count > currentArgIndex) { formattedText.Add(GetArgumentDescription(functionInfo.ArgumentList[currentArgIndex])); } return(formattedText); }
IEnumerable <TextLine> GetFunctionDescription(IntelliSenseFunctionInfo functionInfo) { return (functionInfo.Description .Split(new string[] { Environment.NewLine }, StringSplitOptions.None) .Select(line => new TextLine { new TextRun { Style = System.Drawing.FontStyle.Regular, Text = line } })); }
public void RegisterFunctionInfo(IntelliSenseFunctionInfo functionInfo) { // TODO : Dictionary from KeyLookup _functionInfoMap.Add(functionInfo.FunctionName, functionInfo); }
FormattedText GetFunctionIntelliSense(IntelliSenseFunctionInfo functionInfo, int currentArgIndex) { var nameLine = new TextLine { new TextRun { Text = functionInfo.FunctionName + "(" } }; if (functionInfo.ArgumentList.Count > 0) { var argNames = functionInfo.ArgumentList.Take(currentArgIndex).Select(arg => arg.ArgumentName).ToArray(); if (argNames.Length >= 1) { nameLine.Add(new TextRun { Text = string.Join(", ", argNames) }); } if (functionInfo.ArgumentList.Count > currentArgIndex) { if (argNames.Length >= 1) { nameLine.Add(new TextRun { Text = ", " }); } nameLine.Add(new TextRun { Text = functionInfo.ArgumentList[currentArgIndex].ArgumentName, Style = System.Drawing.FontStyle.Bold }); argNames = functionInfo.ArgumentList.Skip(currentArgIndex + 1).Select(arg => arg.ArgumentName).ToArray(); if (argNames.Length >= 1) { nameLine.Add(new TextRun {Text = ", " + string.Join(", ", argNames)}); } } } nameLine.Add(new TextRun { Text = ")" }); var descriptionLines = GetFunctionDescription(functionInfo); var formattedText = new FormattedText { nameLine, descriptionLines }; if (functionInfo.ArgumentList.Count > currentArgIndex) { formattedText.Add(GetArgumentDescription(functionInfo.ArgumentList[currentArgIndex])); } return formattedText; }
IEnumerable<TextLine> GetFunctionDescription(IntelliSenseFunctionInfo functionInfo) { return functionInfo.Description .Split(new string[] { Environment.NewLine }, StringSplitOptions.None) .Select(line => new TextLine { new TextRun { Style = System.Drawing.FontStyle.Regular, Text = line }}); }
TextLine GetArgumentDescription(IntelliSenseFunctionInfo.ArgumentInfo argumentInfo) { return new TextLine { new TextRun { Style = System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic, Text = argumentInfo.ArgumentName + ": " }, new TextRun { Style = System.Drawing.FontStyle.Italic, Text = argumentInfo.Description }, }; }
public void RegisterFunctionInfo(IntelliSenseFunctionInfo functionInfo) { // TODO : Dictionary from KeyLookup _functionInfoMap.Add(functionInfo.FunctionName, functionInfo); }