Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 9 Posters 6.7k Views 2 Watching
    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 AnsonG Offline
      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
      • MAPJe71M Offline
        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 OblaP Offline
          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.

          aks2161989A Greg OsborneG 2 Replies Last reply Reply Quote 1
          • Long Nguyễn XuânL Offline
            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-D Offline
              dfs-
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • aks2161989A Offline
                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 OsborneG Offline
                  Greg Osborne @Pritvinath Obla
                  last edited by

                  @Pritvinath-Obla Adding the missing tag worked for me

                  1 Reply Last reply Reply Quote 1
                  • Ed EaglehouseE Offline
                    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 BondS 1 Reply Last reply Reply Quote 1
                    • Sasha BondS Offline
                      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

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors