Package org.intellij.lang.annotations

# Annotation Interface Language

@Retention(CLASS) @Target({METHOD,FIELD,PARAMETER,LOCAL_VARIABLE,ANNOTATION_TYPE}) public @interface Language
Specifies that an element of the program represents a string that is a source code on a specified language. Code editors may use this annotation to enable syntax highlighting, code completion and other features inside the literals that assigned to the annotated variables, passed as arguments to the annotated parameters, or returned from the annotated methods.

This annotation also could be used as a meta-annotation, to define derived annotations for convenience. E.g. the following annotation could be defined to annotate the strings that represent Java methods:

       @Language(value = "JAVA", prefix = "class X{", suffix = "}")
       @interface JavaMethod {}

Note that using the derived annotation as meta-annotation is not supported. Meta-annotation works only one level deep.

## Required Element Summary

Required Elements
Modifier and Type
Required Element
Description
`@NonNls String`
`value`
Language name like "JAVA", "HTML", "XML", "RegExp", etc.

## Optional Element Summary

Optional Elements
Modifier and Type
Optional Element
Description
`@NonNls String`
`prefix`
A constant prefix that is assumed to be implicitly added before the literal.
`@NonNls String`
`suffix`
A constant suffix that is assumed to be implicitly added after the literal.

## Element Details

### value

@NonNls @NonNls String value
Language name like "JAVA", "HTML", "XML", "RegExp", etc. The complete list of supported languages is not specified. However, at least the following languages should be recognized:

- "JAVA" - Java programming language
- "HTML" - HTML
- "XML" - XML
- "RegExp" - Regular expression supported by Java `Pattern`

### prefix

@NonNls @NonNls String prefix
A constant prefix that is assumed to be implicitly added before the literal. This helps to apply proper highlighting when the program element represents only a part of the valid program. E.g. if the method parameter accepts a Java method, it could be annotated as `void methodProcessor(@Language(value="JAVA", prefix="class X {", suffix="}")`.

Default:
  `""`

### suffix

@NonNls @NonNls String suffix
A constant suffix that is assumed to be implicitly added after the literal. See `prefix()` for details.

Default:
  `""`