Class XMLWorkspaceIndexSettings

java.lang.Object
org.eclipse.lemminx.settings.XMLWorkspaceIndexSettings

public class XMLWorkspaceIndexSettings extends Object
Settings for the workspace Bloom index (xml.workspaceIndex).

Disabled by default — users must opt in by setting "xml.workspaceIndex.enabled": true in their VS Code settings.

When enabled, the server maintains a per-file Bloom filter that powers cross-file grammar reference features: Find References on grammar files, the "N references" code lens, and automatic reference updates on rename.

  • Field Details

    • DEFAULT_EXCLUDE_DIRECTORIES

      public static final List<String> DEFAULT_EXCLUDE_DIRECTORIES
      Default directory names that are excluded from the workspace scan. These directories are skipped entirely during the initial index build.
  • Constructor Details

    • XMLWorkspaceIndexSettings

      public XMLWorkspaceIndexSettings()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Returns true when the workspace Bloom index is active.

      Use case:

      invalid reference
      WorkspaceIndexPlugin
      checks this flag on every settings change to decide whether to trigger a scan or clear the index.
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables or disables the workspace Bloom index.

      Use case: Bound to "xml.workspaceIndex.enabled" in the client settings JSON. When switched to false, the plugin immediately clears the index so no stale candidates are served. When switched back to true, a fresh workspace scan is triggered.

    • getExcludeDirectories

      public List<String> getExcludeDirectories()
      Returns the directory names to skip during the workspace scan. Any directory whose name exactly matches an entry in this list is skipped entirely (along with all its descendants).
    • setExcludeDirectories

      public void setExcludeDirectories(List<String> excludeDirectories)
      Sets the directory names to skip during the workspace scan. Falls back to DEFAULT_EXCLUDE_DIRECTORIES when null is supplied.

      Use case: Bound to "xml.workspaceIndex.excludeDirectories". A project with a heavy generated-sources directory can add it here so the initial scan does not spend time indexing machine-generated XML.

    • getHeadLimits

      public Map<String,String> getHeadLimits()
      Returns the raw (unparsed) head-limits map. Keys are file extensions without dot or "*"; values are size strings.
    • setHeadLimits

      public void setHeadLimits(Map<String,String> headLimits)
      Sets the raw head-limits map.

      Use case: Bound to "xml.workspaceIndex.headLimits". The raw map is passed to HeadLimitRules.compile(Map) which compiles the glob patterns once for efficient per-file lookup.

    • parseSizeLimit

      public static int parseSizeLimit(String value)
      Parses a human-readable size string into a character count (not byte count — the index reads Java char units).

      Supported formats (case-insensitive):

      • null, "", "0" → Integer.MAX_VALUE (no limit)
      • "512" → 512 chars (raw integer)
      • "512KB" or "512Ko" → 524 288
      • "1MB" or "1Mo" → 1 048 576
      • "1GB" or "1Go" → 1 073 741 824
      Any unrecognised format returns Integer.MAX_VALUE (no limit).
      Parameters:
      value - raw size string from the settings JSON.
      Returns:
      parsed character limit, or Integer.MAX_VALUE for no limit.
    • merge

      public void merge(XMLWorkspaceIndexSettings newSettings)
      Copies all settings from newSettings into this instance.

      Use case: Called when the client sends didChangeConfiguration and the existing settings object needs to be updated in place (e.g. inside a cached XMLGeneralClientSettings that other components hold a reference to).