Class SourceTemplateRegistry

java.lang.Object
io.quarkus.qute.debug.agent.source.SourceTemplateRegistry

public class SourceTemplateRegistry extends Object
Registry responsible for resolving and managing mappings between Qute template IDs and their corresponding RemoteSource instances.

This class plays a key role in the Qute debugger by allowing the Debug Adapter Protocol (DAP) to locate and serve the correct source file for a given template, whether it originates from a local filesystem or a JAR.

The registry maintains a cache of resolved template IDs to avoid redundant lookups and supports flexible base paths and file extensions to locate template files.

  • Constructor Details

    • SourceTemplateRegistry

      public SourceTemplateRegistry(BreakpointsRegistry breakpointsRegistry, SourceReferenceRegistry sourceReferenceRegistry, JavaSourceResolver javaFileInfoProvider, io.quarkus.qute.Engine engine)
      Creates a registry with default base paths and file extensions.
      • Default base paths:
        • src/main/resources/templates/
        • templates/
        • content/
      • Default file extensions:
        • .qute, .html, .qute.html
        • .yaml, .qute.yaml, .yml, .qute.yml
        • .txt, .qute.txt
        • .md, .qute.md
    • SourceTemplateRegistry

      public SourceTemplateRegistry(BreakpointsRegistry breakpointsRegistry, SourceReferenceRegistry sourceReferenceRegistry, JavaSourceResolver javaFileInfoProvider, io.quarkus.qute.Engine engine, List<String> basePaths, List<String> fileExtensions)
      Creates a registry with custom base paths and file extensions.
      Parameters:
      breakpointsRegistry - registry managing active breakpoints
      sourceReferenceRegistry - registry responsible for DAP source references
      engine - the Qute template engine instance
      basePaths - list of possible base directories where templates might be located
      fileExtensions - list of supported file extensions for template files
  • Method Details

    • getSource

      public RemoteSource getSource(String templateId, org.eclipse.lsp4j.debug.Source previousSource)
      Attempts to resolve a RemoteSource for a given Qute template ID.

      This method first checks the internal cache. If the source is not yet registered, it attempts to resolve it from:

      • The Engine via Engine.locate(String).
      • Previously known sources (from breakpoints or cached URIs).

      Parameters:
      templateId - the Qute template identifier
      previousSource - the previously known source, used to infer relative paths (optional)
      Returns:
      the resolved RemoteSource, or null if none could be found
    • getFileExtensions

      public List<String> getFileExtensions()
      Returns the list of supported file extensions.
    • toUri

      public static URI toUri(org.eclipse.lsp4j.debug.Source source)
      Converts a Source object into a normalized URI. Supports fallback for Windows paths and relative URIs.