Function list for C# not showing any function

Function list for C# not showing any function

3

    Apr 08, 2009#1

    I had assumed the Function List just didn't work well, but now I'm not certain and think perhaps something is messed up with my setup. I've just install v15 (so finally decided to confront this issue as it's my main disappointment with UltraEdit and with a new release not working I'm getting frustrated that this feature doesn't work). For Csharp c# cs files I don't get any functions listed in the Function List it shows No Functions! Here's one class I've butchered (to simplify) that returns no functions:

    Code: Select all

    using System;
    using System.Windows.Forms;
    
    namespace NoFuncs
    {
        public partial class FormMain : Form
        {
            public FormMain()
            {
                InitializeComponent();
            }
    
            private void cmdGen_Click(object sender, EventArgs e)
            {
                lblCDKey.Text = "Test Functions";
            }
    
            private void cmdGenerate_Click(object sender, EventArgs e)
            {
                txtKey.Text = "Test Functions";
                System.IO.File.WriteAllText(@"C:\Documents and Settings\Test.lic", txtKey.Text);
            }
    
            private void cmdGetQty_Click(object sender, EventArgs e)
            {
                MessageBox.Show("Test Functions");
            }
    
            private void cmdGenerateA_Click(object sender, EventArgs e)
            {
                //comment
            }
    
            private void cmdCreate_Click(object sender, EventArgs e)
            {
                txtKey.Text = "Test Functions";
                System.IO.File.WriteAllText(@"C:\Documents and Settings\C.lic", txtKey.Text);
            }
        }
    }
    
    Here's another:

    Code: Select all

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;
    
    namespace WI
    {
        static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new FormMain());
            }
        }
    }
    
    I also have issues with vbs files, it lists subs but not functions, the following code doesn't show up in the Function List:

    Code: Select all

    Public Function FSIsPt(piShapeType)
    	FSIsPt = false
    	If piShapeType = 1 Then
    		FSIsPt = true
    	End If
    End Function
    
    Are others experiencing this behavior? Is there something off with my coding style or .. How can I get UltraEdit to show Functions?

    6,687587
    Grand MasterGrand Master
    6,687587

      Apr 09, 2009#2

      First open Advanced - Configuration - Editor Display - Syntax Highlighting and look if UE v15.00 is using the wordfile from the previous version with several languages stored in that file or if it uses the standard wordfiles in the wordfile directory. Verify also if the wordfile or the directory with the wordfiles exist. Next verify at View - View As (Highlighting File Type) which syntax highlighting language is used for the active file. After all that verifications post the function strings defined in the wordfile(s) for your C# and VBS files.
      Best regards from an UC/UE/UES for Windows user from Austria

      3

        Apr 10, 2009#3

        Does that mean you get functions listed for the pasted code?
        Here's the answers to your questions (Thank you for the advice/help).
        My Syntax Highlighting is set to use this file, which I have opened (so it exists): C:\Documents and Settings\CBiggerstaff\Application Data\IDMComp\UltraEdit\WORDFILE.UEW
        Yep the View As is set to C#. The VBS was set to Visual Basic when I changed it to VBScript ASP that got the Function and Subs to show - you figured out that one, thank you.
        Here's the function strings defined in the C:\Documents and Settings\CBiggerstaff\Application Data\IDMComp\UltraEdit\WORDFILE.UEW file for C#:

        Code: Select all

        /Function String = "%[a-zA-Z_]*)[~;]"
        FYI I've been playing with this a bit I've now changed my Wordfile setting to the folder: C:\Documents and Settings\CBiggerstaff\Application Data\IDMComp\UltraEdit\wordfiles
        I then edited the visualbasic.uew removing vbs extension and added it to vbscript.uew (I find it odd that isn't the default). I like this folder approach for uew files versus 1 huge file. Still no functions showing (not a single one) in my C# code.

        6,687587
        Grand MasterGrand Master
        6,687587

          Apr 10, 2009#4

          I'm not a C# programmer. I'm only an expert for regular expressions using the UltraEdit regular expression engine.

          %[a-zA-Z_]*)[~;] in the standard wordfile for programming language C# means:
          • find a line starting with a lowercase or uppercase letter or an underscore,
          • then any character can follow until ) is found in that line
          • and the next character after ) is not a semi-colon.
          The line with namespace does not contain a ).
          The line with class does also not contain a ).
          And the function lines start with spaces or tabs.
          Therefore no function is found with that regular expression in your CS file.

          The user contributed wordfile for C# http://www.ultraedit.com/files/wf/csharp.uew you can download from Downloads - Extras - Wordfiles and used in the power tip Adding a wordfile in UltraEdit v15.00 and greater contains 3 function strings.

          The first one is for lines with namespace, the second one for lines class and the third one is for function definition lines. If you compare that wordfile for C# NOW (10.04.2009 11:05) with the standard wordfile for C# you will see also other differences and of course also mistakes. That's the reason why I have just a few minutes ago sent an email to IDM with an updated version of this file. Too bad for me and IDM that I have not answered your question first, because the regular expressions in that wordfile are also not perfect. You get duplicate lines with it and uppercase characters are also not allowed in function definition lines. I fixed now that mistakes in the function strings too with the help of your examples.

          The resulting files are hopefully better for all C# programmers. And updated wordfile for C# is already available for download and has 3 function strings. With UE v15.00.0.1042 an updated wordfile for C# is installed which contains the better function string for finding function definitions in C#.

          Because I'm not a C# programmer, I can only hope the new versions are much better.

          You might take a look also on C# Perl function list.

          1
          NewbieNewbie
          1

            Apr 13, 2009#5

            I agree with the previous post. The default csharp.uew file will not do anybody much good in playing with real C# files. I am attaching the version I normally use. It shows only the method/property names -- I didn't want the parameters in the function list.
            csharp.zip (1.13 KiB)   351
            Unzip into wordfiles folder to get just C# method/property names