Closed avestura closed 5 years ago
Isn't it possible to use System.Web.Razor.Parser.SyntaxTree and in general the Parser namespace utils to add @using directives in top of razor documents?
I had a look into this already too but wasn't successful on finding a solution either. The current roslyn parser is simply not compatible with Razor pages, it would require a complete standalone solution for them. Guess completely disabling it for Razor pages would be the best approach for the moment.
Completion are disabled for Razor files (thanks @daberni for PR!). I'll reopen the issue, but as suggestion for improvement. Maybe I'll be able to implement it later (not in the nearest future though)
Added corresponding bug to Roslyn: https://github.com/dotnet/roslyn/issues/35172
Thanks for reporting!
Actually, I'm even surprised that it works at all in cshtml files - that was never intended. Problem is that from Roslyn perspective cshtml file looks like huge unreadable auto-generated C# code, so I wont be able to add valid Razor 'using' directive (using Roslyn, at least).
So I think I'm going to disable extention completely for cshtml files.