Reputation: 78
I would like to my Visual Studio extension to have C# syntax highlighting for a file with .customExt. The desirable effect is easily achievable form VS UI : Tools -> Options -> Text Editor -> File Extension
, but how to achieve similar effect from extension level?
Is it possible to get existing VS csharp classifier?
Or maybe there is a way to associate .customExt to existing Microsoft Visual C# editor?
I have tried:
[Export]
[FileExtension(".customExt")]
[ContentType("CSharp")]
internal static FileExtensionToContentTypeDefinition hiddenFileExtensionDefinition;
but it obviously does not work as expected.
Upvotes: 0
Views: 239
Reputation: 78
I found a solution on how to associate a custom file type with the existing editor here:
It is very simple, it only requires adding .pkgdef file to VSIX project:
[$RootKey$\Languages\File Extensions\.customExt]
@="{694dd9b6-b865-4c5b-ad85-86356e9c88dc}"
[$RootKey$\Editors\{08467b34-b90f-4d91-bdca-eb8c8cf3033a}\Extensions]
"customExt"=dword:00000027
The file should have the following properties set:
Upvotes: 1