-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Description
I'm writing a language grammar for Razor and throughout Razor there are several locations where we call through to C#'s grammar to run their rules. However, after having attempted to write an injection grammar to handle cases when Razor weaves HTML into specific C# constructs aka:
It doesn't seem like injecting code into the source.cs grammar is sufficient. For my injection grammar I've written:
name: ASP.NET Razor C# Injection
scopeName: 'text.aspnetcorerazor.injection'
injectionSelector: 'L:source.cs'
patterns:
- include: '#razor-template'
repository:
razor-template:
name: 'meta.structure.template.razor'
begin: '(@)(?=\<)'
beginCaptures:
1: { patterns: [ include: 'text.aspnetcorerazor#transition' ] }
patterns:
- include: 'text.aspnetcorerazor#wellformed-html'
end: '(?<=\>)'Which works fine in .cs files (haven't restricted where it can run yet):

However, when trying to make use of the injection in a Razor file in the embedded C#, it doesn't seem to apply:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

