Class EmbeddedApexLsBridge
java.lang.Object
io.github.apexdevtools.apexls.mcp.bridge.EmbeddedApexLsBridge
- All Implemented Interfaces:
ApexLsBridge,AutoCloseable
Embedded bridge implementation that accesses apex-ls core functionality directly within the same
JVM process.
This bridge uses the OrgAPI interface directly from the apex-ls JAR on the classpath, converting Scala Futures to Java CompletableFutures and results to JSON strings for consumption by the Java 17 MCP tools.
OrgAPI instances are cached per workspace to avoid expensive open() calls.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Shutdown the bridge and release resources.findUsages(String workspaceDirectory, String filePath, int line, int offset) Find usages of an identifier at a specific position.getDefinition(String workspaceDirectory, String filePath, int line, int offset) Get definition location for an identifier at a specific position.Get static analysis issues for a workspace.getTestClassItemsChanged(String workspaceDirectory, String[] changedPaths) Find test classes that should be run based on changes to specific source files.Get version information from apex-ls core.getWorkspaceInfo(String workspaceDirectory) Get workspace information and metadata.voidInitialize the bridge and establish connection to apex-ls core.booleanisReady()Check if the bridge is ready for operations.
-
Constructor Details
-
EmbeddedApexLsBridge
-
-
Method Details
-
initialize
Description copied from interface:ApexLsBridgeInitialize the bridge and establish connection to apex-ls core.- Specified by:
initializein interfaceApexLsBridge- Throws:
Exception- if bridge initialization fails
-
isReady
public boolean isReady()Description copied from interface:ApexLsBridgeCheck if the bridge is ready for operations.- Specified by:
isReadyin interfaceApexLsBridge- Returns:
- true if bridge is connected and ready
-
getIssues
public CompletableFuture<String> getIssues(String workspaceDirectory, boolean includeWarnings, int maxIssuesPerFile) Description copied from interface:ApexLsBridgeGet static analysis issues for a workspace.- Specified by:
getIssuesin interfaceApexLsBridge- Parameters:
workspaceDirectory- path to workspaceincludeWarnings- include warning-level issuesmaxIssuesPerFile- maximum number of issues to return per file- Returns:
- future containing issues in JSON format
-
findUsages
public CompletableFuture<String> findUsages(String workspaceDirectory, String filePath, int line, int offset) Description copied from interface:ApexLsBridgeFind usages of an identifier at a specific position.- Specified by:
findUsagesin interfaceApexLsBridge- Parameters:
workspaceDirectory- path to workspacefilePath- path to fileline- line number (0-based)offset- character offset within line- Returns:
- future containing usages in JSON format
-
getDefinition
public CompletableFuture<String> getDefinition(String workspaceDirectory, String filePath, int line, int offset) Description copied from interface:ApexLsBridgeGet definition location for an identifier at a specific position.- Specified by:
getDefinitionin interfaceApexLsBridge- Parameters:
workspaceDirectory- path to workspacefilePath- path to fileline- line number (0-based)offset- character offset within line- Returns:
- future containing definition location in JSON format
-
getWorkspaceInfo
Description copied from interface:ApexLsBridgeGet workspace information and metadata.- Specified by:
getWorkspaceInfoin interfaceApexLsBridge- Parameters:
workspaceDirectory- path to workspace- Returns:
- future containing workspace info in JSON format
-
getVersion
Description copied from interface:ApexLsBridgeGet version information from apex-ls core.- Specified by:
getVersionin interfaceApexLsBridge- Returns:
- future containing version string
-
getTestClassItemsChanged
public CompletableFuture<String> getTestClassItemsChanged(String workspaceDirectory, String[] changedPaths) Description copied from interface:ApexLsBridgeFind test classes that should be run based on changes to specific source files.- Specified by:
getTestClassItemsChangedin interfaceApexLsBridge- Parameters:
workspaceDirectory- path to workspacechangedPaths- array of file paths that have been changed- Returns:
- future containing impacted test classes in JSON format
-
close
Description copied from interface:ApexLsBridgeShutdown the bridge and release resources.- Specified by:
closein interfaceApexLsBridge- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-