• Login
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 5.7k Views
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.
  • G
    Gary Anson
    last edited by Jan 28, 2017, 12:46 AM

    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
    • M
      MAPJe71
      last edited by Jan 28, 2017, 1:20 AM

      @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
      • P
        Pritvinath Obla
        last edited by Pritvinath Obla Mar 27, 2017, 9:39 PM Mar 27, 2017, 9:38 PM

        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.

        A G 2 Replies Last reply Jan 8, 2020, 4:57 PM Reply Quote 1
        • L
          Long Nguyễn Xuân
          last edited by Jun 14, 2018, 4:44 AM

          @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
          • D
            dfs-
            last edited by Apr 26, 2019, 2:05 PM

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

            1 Reply Last reply Reply Quote 0
            • A
              aks2161989 @Pritvinath Obla
              last edited by Jan 8, 2020, 4:57 PM

              @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
              • G
                Greg Osborne @Pritvinath Obla
                last edited by Apr 13, 2020, 7:15 PM

                @Pritvinath-Obla Adding the missing tag worked for me

                1 Reply Last reply Reply Quote 1
                • E
                  Ed Eaglehouse
                  last edited by Oct 8, 2020, 12:48 PM

                  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>
                  
                  S 1 Reply Last reply Jan 5, 2021, 7:51 PM Reply Quote 1
                  • S
                    Sasha Bond @Ed Eaglehouse
                    last edited by Jan 5, 2021, 7:51 PM

                    @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
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors