Aspnetcore: Make Razor projection handling smarter

Created on 24 Jul 2020  路  1Comment  路  Source: dotnet/aspnetcore

Details of the bug in the description of https://github.com/dotnet/aspnetcore-tooling/pull/2228

We want to figure out a better way to accomplish what that PR was trying to do.

Done area-razor.tooling feature-razor.languageserver investigate

Most helpful comment

Adding more context for future us,

The core of the problem here is that a cursor position could represent different languages based on the question being asked.
Consider,
@(DateTim|), | is cursor

  • If we ask, what language's intellisense should be provided at the given location, then answer is RazorLanguageKind.CSharp (This is what ProjectionProvider currently does)
  • If we ask, what language does the character under cursor, ), belong to, the answer is RazorLanguageKind.Razor

    • Ideally, we want to have this be a first class method on projectionProvider but given that this is currently only needed by onTypeFormatting we'll not do this just yet.

>All comments

Adding more context for future us,

The core of the problem here is that a cursor position could represent different languages based on the question being asked.
Consider,
@(DateTim|), | is cursor

  • If we ask, what language's intellisense should be provided at the given location, then answer is RazorLanguageKind.CSharp (This is what ProjectionProvider currently does)
  • If we ask, what language does the character under cursor, ), belong to, the answer is RazorLanguageKind.Razor

    • Ideally, we want to have this be a first class method on projectionProvider but given that this is currently only needed by onTypeFormatting we'll not do this just yet.

Was this page helpful?
0 / 5 - 0 ratings