Mixed Languages

Skip to end of metadata
Go to start of metadata

Certain forms of mark-up that ReSharper supports actually involve several languages contained within one file. A typical example would be an HTML file which, in addition to the HTML mark-up, can also contain CSS declarations as well as JavaScript statements.

In such a situation, the HTML file is treated as 'primary' and its syntax tree gets built first. Then, using this syntax tree, all additions of JavaScript or CSS within the document are effectively parsed into separate documents.

To acquire the relevant document to work with, one needs to specify the correct generic parameter when calling GetPsiFile() on the source question. For example, to acquire the JavaScript document of an HTML file, given a source file, one would invoke the following: