IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

Implementing Web Symbols

Edit pageLast modified: 13 June 2024

The core element of the framework is a WebSymbol, representing an entity in the Web Symbols model. This symbol is characterized by namespace, kind and name properties, with its lifecycle encapsulated within a single read action. To ensure its survival between read actions, use WebSymbol.createPointer() to create a symbol pointer. Provided the symbol remains valid, dereferencing the pointer will return a new instance of the symbol. It should be noted that during a write action, the symbol might not survive a PSI tree commit. Therefore, creating a pointer prior to the commit and dereferencing it post-commit is advised.

The property namespace describes which language or concept (not tied to a particular language) the symbol belongs to, and kind describes which group of symbols within that particular language or concept it belongs to. Examples:

  • a CSS property: namespace: CSS, kind: properties

  • a Java class: namespace: Java, kind: classes

  • a plugin extension: namespace: ij-plugin, kind: extensions

A Web Symbol can originate from source code analysis, or it can be a symbol statically defined through Web Types (JSON) or some other custom format. In both cases, such a symbol can have some source defined. Each symbol is treated by the framework the same, regardless of their origin.