Page Comparison - Mixed Languages (v.1 vs v.2)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

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:

Code Block
languagecsharp
psiSourceFile.GetPsiFile<JavaScriptLanguage>();