Class Language

java.lang.Object
com.intellij.lang.Language
Direct Known Subclasses:
MetaLanguage

public abstract class Language extends Object
The base class for all programming language support implementations. Specific language implementations should inherit from this class and its registered instance wrapped with LanguageFileType via com.intellij.fileType extension point. There should be exactly one instance of each Language. It is usually created when creating LanguageFileType and can be retrieved later with findInstance(Class).
  • Field Details

    • ANY

      public static final Language ANY
  • Constructor Details

    • Language

      protected Language(@NonNls @NotNull @NonNls @NotNull String ID)
    • Language

      protected Language(@NonNls @NotNull @NonNls @NotNull String ID, @NonNls @NonNls String @NotNull ... mimeTypes)
    • Language

      protected Language(@Nullable @Nullable Language baseLanguage, @NonNls @NotNull @NonNls @NotNull String ID, @NonNls @NonNls String @NotNull ... mimeTypes)
    • Language

      protected Language(@NotNull @NotNull String ID, boolean register)
      Fake language identifier without registering
  • Method Details

    • getRegisteredLanguages

      @NotNull public static @NotNull Collection<Language> getRegisteredLanguages()
      Returns:
      collection of all languages registered so far.
    • unregisterLanguages

      public static void unregisterLanguages(ClassLoader classLoader)
    • unregisterLanguage

      public static void unregisterLanguage(@NotNull @NotNull Language language)
    • unregisterDialect

      public void unregisterDialect(Language language)
    • findInstance

      public static <T extends Language> T findInstance(@NotNull @NotNull Class<T> klass)
      Parameters:
      klass - java.lang.Class of the particular language. Serves key purpose.
      Returns:
      instance of the klass language registered if any.
    • findInstancesByMimeType

      @NotNull public static @NotNull Collection<Language> findInstancesByMimeType(@Nullable @Nullable String mimeType)
      Parameters:
      mimeType - of the particular language.
      Returns:
      collection of all languages for the given mimeType.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMimeTypes

      public String @NotNull [] getMimeTypes()
      Returns the list of MIME types corresponding to the language. The language MIME type is used for specifying the base language of a JSP page.
      Returns:
      The list of MIME types.
    • getID

      @NotNull public @NotNull String getID()
      Returns a user-readable name of the language.
      Returns:
      the name of the language.
    • getBaseLanguage

      @Nullable public @Nullable Language getBaseLanguage()
    • getDisplayName

      @NotNull public @NotNull String getDisplayName()
    • is

      public final boolean is(Language another)
    • isCaseSensitive

      public boolean isCaseSensitive()
      Returns:
      whether identifiers in this language are case-sensitive. By default, delegates to the base language (if present) or returns false (otherwise).
    • isKindOf

      public final boolean isKindOf(Language another)
    • isKindOf

      public final boolean isKindOf(@NotNull @NotNull String anotherLanguageId)
    • getDialects

      @NotNull public @NotNull List<Language> getDialects()
    • findLanguageByID

      @Nullable public static @Nullable Language findLanguageByID(String id)