C Sharp (C#) Function list not working in npp 7.3.1 32bit although CPP and C work just fine.
-
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 -
@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#.
-
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. -
@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. -
Well, it’s still unfixed, but the workaround still applies.
-
@Pritvinath-Obla The parser code block for C# ends like this-
</function> </classRange> </parser>
Can You tell me which to change?
Thanks.
-
@Pritvinath-Obla Adding the missing tag worked for me
-
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]*(?<modifier1>(?:public|protected|internal|private)\s*)?(?<modifier2>(?:new|static|virtual|sealed|override|abstract|extern)\s*)?(partial\s*)?(?<type>(?!(return|if|else))\w+(?<genericType><[\w,\s<>]+>)?\s+)(?<name>\w+(?<genericNameType><[\w,\s<>]+>)?\s?)\((?<params>[\w\s,<>\[\]\:=\.]*)\)(?<ctorChain>\s*\:\s*(?:base|this)\s*\((?<ctorParams>[\w\s,<>\[\]\:=\.]*)\))?[\w\s<>\:,\(\)\[\]]*(?:\{|;)" > <functionName> <funcNameExpr expr="(\w+(<[\w,\s<>]+>)?\s?)\(" /> <funcNameExpr expr="(\w+(<[\w,\s<>]+>)?\s?)" /> </functionName> </function> </classRange> <!-- The following tag was missing from the distributed file. --> <function mainExpr=""> </function> </parser>
-
@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}");