mastorm/CodeStats.Client

Using DisplayName directly can lead to unintended language names.

Opened this issue · 6 comments

pulse.IncrementExperience(_textView.TextBuffer.ContentType.DisplayName);

Using _textView.TextBuffer.ContentType.DisplayName can lead to things showing up with things like "HTMLXProjection" for .cshtml-files.

Hm. Thats ultra weird. One way would be asking @Nicd if he can remap them on the backend, but i somehow get the feeling that its something that they use for more than just cshtml, so i kinda need to find a workaround for that. Ill put some research in it. If someone knows what api it is, hit me up!

Nicd commented

It's not possible to alias "HTMLXProjection" to both "HTML" and "CSHTML" on the backend so need to find an API in the plugin that returns the correct language name.

Nicd commented

HTMLXProjection is now aliased to HTML.

Visual Studio code maps those as "Razor" which is the MS templating language.

Nicd commented

You cant remap it to Razor. This has to be a plugin-side fix. The only thing you can do is keep it as HTML for now, because thats the "most consistent" solution. As long as its just Razor pages, I can check the file extension and send Razor if its cshtml - as an idea for a hotfix.