Return a document symbol representing the "Render" method for a Razor file#12568
Conversation
…en though it doesn't map
|
@danroth27 @sayedihashimi @DamianEdwards If anyone has any feedback on using |
|
@davidwengier "Component" for *.razor files and "View" for *.cshtml files is probably the best generalization, although I'm wondering if the method name the code is emitted into would actually be more helpful? |
|
How about |
|
What about |
Not sure what that means? IIUC the symbol is already correct for things like methods/properties in |
|
Ah, ok, that makes sense. The name of the actual rendering method sounds reasonable then. |
There was a problem hiding this comment.
Code LGTM.
If you will allow me to bikeshed further, I much prefer <Component> and <View> to the underlying method names, as we're exposing a C# concept in a razor file where it doesn't directly exist. This is not blocking, just wanted to 'go on record' 😆
Must be an engineer vs PM thing because I agree with you, but I feel better deferring to Dan and Damian on matters of taste |
|
I won't make a fuss either way. I'll leave to @danroth27 to make the final call between |
|
I think sticking with the method names is fine. The rendering logic in the Razor file is effectively defining the implementation of these methods. The methods aren't secret; they are part of the API surface area. In Blazor, for example, it's not uncommon to implement components without using a .razor file and the |
|
Suits me, since I don't need to change the code again :) |



Currently we don't return any document symbols in Razor files unless there are C# constructs that are mappable, which means either code in a
@codeor@functionsblock, or an@injectsince that is emitted as a property.While investigating an issue with document symbols not appearing on newly opened files, this made it really annoying to determine whether we were returning no symbols, or we were returning symbols but the editor wasn't displaying them. This PR fixes that by ensuring we always return at least one symbol, and also I think improves the look of things. Selfishly, it should make it easier to demonstrate to the editor team that they have a bug :)
Looks like this:
.razor file:

cshtml file:

VS Code:
