codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

Spade Doesn't Parse Razor Files With `@Function` Blocks #330

Open jeroldhaas opened 8 years ago

jeroldhaas commented 8 years ago

Environment

Replace this text with a short description and code sample.

Steps to recreate

  1. Open a Razor file that uses @function {} (like a helper file)
  2. Display Spade (CodeMaid -> Spade)
  3. public static methods in file don't display

    Current behavior

It's not parsing / locating the static methods in the @function block, Spade is empty.

Expected behavior

Display parsed static class and its contained methods in Razor file, including normal Spade functionality.

codecadwallader commented 8 years ago

Thanks for reporting the issue. Spade currently works based on the EnvDTE FileCodeModel's, and after some debugging I've confirmed that no FileCodeModel appears to be available for Razor code. Since the IDE isn't exposing an API object we can work with, the result is an empty Spade. This is effectively the same as opening a raw text file.

It's possible that the Roslyn API may expose C# code models for Razor objects, but I'm not sure. Switching to a Roslyn API is on our roadmap, but is a fairly large effort. We can keep this issue for investigation to add support for Razor files once Roslyn is utilized within CodeMaid.