Module io.quarkus.qute.debug
Class SourceTemplateRegistry
java.lang.Object
io.quarkus.qute.debug.agent.source.SourceTemplateRegistry
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 Summary
ConstructorsConstructorDescriptionSourceTemplateRegistry(BreakpointsRegistry breakpointsRegistry, SourceReferenceRegistry sourceReferenceRegistry, JavaSourceResolver javaFileInfoProvider, io.quarkus.qute.Engine engine) Creates a registry with default base paths and file extensions.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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of supported file extensions.Attempts to resolve aRemoteSourcefor a given Qute template ID.static URItoUri(org.eclipse.lsp4j.debug.Source source) Converts aSourceobject into a normalizedURI.
-
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
- Default base paths:
-
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 breakpointssourceReferenceRegistry- registry responsible for DAP source referencesengine- the Qute template engine instancebasePaths- list of possible base directories where templates might be locatedfileExtensions- list of supported file extensions for template files
-
-
Method Details
-
getSource
Attempts to resolve aRemoteSourcefor 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
EngineviaEngine.locate(String). - Previously known sources (from breakpoints or cached URIs).
- Parameters:
templateId- the Qute template identifierpreviousSource- the previously known source, used to infer relative paths (optional)- Returns:
- the resolved
RemoteSource, ornullif none could be found
- The
-
getFileExtensions
Returns the list of supported file extensions. -
toUri
Converts aSourceobject into a normalizedURI. Supports fallback for Windows paths and relative URIs.
-