Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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
         }
     }));
 }
Exemplo n.º 3
0
 public void RegisterFunctionInfo(IntelliSenseFunctionInfo functionInfo)
 {
     // TODO : Dictionary from KeyLookup
     _functionInfoMap.Add(functionInfo.FunctionName, functionInfo);
 }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 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
                 }});
 }
Exemplo n.º 6
0
 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
             },
         };
 }
Exemplo n.º 7
0
 public void RegisterFunctionInfo(IntelliSenseFunctionInfo functionInfo)
 {
     // TODO : Dictionary from KeyLookup
     _functionInfoMap.Add(functionInfo.FunctionName, functionInfo);
 }