4

Please note that this question is different from this one.

I have files with extensions like .sln, .csproj, .config etc. These are all XML files. When I open them in notepad++, the language is set to XML and I can see syntax highlighting because I have followed the procedure explained in the above hyperlink. However I can have an XML file (a file that contains valid XML) with extension .kangaroo. I would like to know if there is way - such that when I open this file in Notepad++, it detects that yes it's an XML file and then automatically sets the language to XML. As a result the XML syntax highlighting will be there.

By the way Microsoft Visual Studio already has this functionality i.e. if a file named Temp.kangaroo contains valid XML and I open it in VS 2012 then it will do syntax highlighting. However Notepad++ doesn't do that by default. We need to manually follow the process explained in the hyperlink above.

Thanks

4

2 回答 2

5

In current N++, detection of language according to content of the file is not implemented. Language is detected only by file extension.

于 2014-04-04T12:49:46.863 回答
1

According to the release notes, it would appear that v6.8.4 (released on 16 Oct 2015) implemented the auto-detect language feature (at least for a subset of languages):

  1. Apply new added language auto-detection (for php, xml, html and bash) in the case of unknown file extension.
于 2016-05-18T01:22:11.837 回答