Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    C Sharp (C#) Function list not working in npp 7.3.1 32bit although CPP and C work just fine.

    Help wanted · · · – – – · · ·
    9
    9
    3276
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Gary Anson
      Gary Anson last edited by

      I have been trying to list the methods of a c# source file in npp to no luck. I get a hyphen and the filename and a icon at the top of the list but no + symbol and double-clicking on the filename does not work either. I do not know that this makes any difference but the file is part of a VS 2013 C# project.
      Any help would be greatly appreciated. I’ve searched up and down the intertubes and all over the netscrape and have only found mentions of getting function list plugin working in older version of npp like 6.5.

      Thanks much!
      -Gary

      1 Reply Last reply Reply Quote 1
      • MAPJe71
        MAPJe71 last edited by

        @Gary-Anson
        The C# parser for the (build-in) Function List is far from functional. It’s on the To-Do list but won’t be available anytime soon.

        You could try a plugin like Source Cookifier, NppGTags, TagLEET, TagsJump or TagsView but I am not sure which supports C#.

        1 Reply Last reply Reply Quote 0
        • Pritvinath Obla
          Pritvinath Obla last edited by Pritvinath Obla

          There is a missing function node just above the end </parser> tag:
          <function mainExpr=“”>
          </function>
          Adding the missing function node to %APPDATA%\Notepad++\functionList.xml fixes the issue. Looks like someone made some edits and (accidentally ?) deleted the above node.

          aks2161989 Greg Osborne 2 Replies Last reply Reply Quote 1
          • Long Nguyễn Xuân
            Long Nguyễn Xuân last edited by

            @MAPJe71 : it’s been a year from your comment, is there any update about C# funtion list? It’s still not working now (2018-06-14)
            Regards, LongNX.

            1 Reply Last reply Reply Quote 0
            • dfs-
              dfs- last edited by

              Well, it’s still unfixed, but the workaround still applies.

              1 Reply Last reply Reply Quote 0
              • aks2161989
                aks2161989 @Pritvinath Obla last edited by

                @Pritvinath-Obla The parser code block for C# ends like this-

                </function>
                	</classRange>
                </parser>
                

                Can You tell me which to change?

                Thanks.

                1 Reply Last reply Reply Quote 0
                • Greg Osborne
                  Greg Osborne @Pritvinath Obla last edited by

                  @Pritvinath-Obla Adding the missing tag worked for me

                  1 Reply Last reply Reply Quote 1
                  • Ed Eaglehouse
                    Ed Eaglehouse last edited by

                    Using the workaround provided by @Pritvinath-Obla, here is a complete working parser configuration for C# in the functionList.xml file:

                    <!-- ========================================================== [ C# ] -->
                    
                    <!--
                    |   Based on:
                    |       http://sourceforge.net/p/notepad-plus/patches/613/
                    \-->
                    <parser
                    	displayName="C#"
                    	id         ="csharp_class"
                    	commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
                    >
                    	<classRange
                    		mainExpr    ="^[\t\x20]*((public|protected|private|internal)\s+)?(\w+\s*)?(class|struct|interface)[\t\x20]+[^\{]+\{"
                    		openSymbole ="\{"
                    		closeSymbole="\}"
                    	>
                    		<className>
                    			<nameExpr expr="(class|struct|interface)[\t\x20]+\w+" />
                    			<nameExpr expr="[\t\x20]+\w+" />
                    			<nameExpr expr="\w+" />
                    		</className>
                    		<function
                    			mainExpr="^[^\S\r\n]*(?&lt;modifier1&gt;(?:public|protected|internal|private)\s*)?(?&lt;modifier2&gt;(?:new|static|virtual|sealed|override|abstract|extern)\s*)?(partial\s*)?(?&lt;type&gt;(?!(return|if|else))\w+(?&lt;genericType&gt;&lt;[\w,\s&lt;&gt;]+&gt;)?\s+)(?&lt;name&gt;\w+(?&lt;genericNameType&gt;&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)\((?&lt;params&gt;[\w\s,&lt;&gt;[]\:=\.]*)\)(?&lt;ctorChain&gt;\s*\:\s*(?:base|this)\s*\((?&lt;ctorParams&gt;[\w\s,&lt;&gt;[]\:=\.]*)\))?[\w\s&lt;&gt;\:,\(\)[]]*(?:\{|;)"
                    		>
                    			<functionName>
                    				<funcNameExpr expr="(\w+(&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)\(" />
                    				<funcNameExpr expr="(\w+(&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)" />
                    			</functionName>
                    		</function>
                    	</classRange>
                    	<!-- The following tag was missing from the distributed file. -->
                    	<function mainExpr="">
                    	</function>
                    </parser>
                    
                    Sasha Bond 1 Reply Last reply Reply Quote 1
                    • Sasha Bond
                      Sasha Bond @Ed Eaglehouse last edited by

                      @Ed-Eaglehouse I am not sure what it fixes, but I see that cs file cannot be parsed if it contains interpolation string like

                      var s_command = "some";
                      var s_target= "some 2";
                      var s_command_info= "some 3";
                      jsSupportLines.Add($"    echo('not implemented: {s_command} ({s_target})'); // {s_command_info}");
                      
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Copyright © 2014 NodeBB Forums | Contributors