pub trait BuildServer {
Show 16 methods
// Required method
fn initialize(
&self,
params: InitializeBuild,
) -> Result<InitializeBuildResult>;
// Provided methods
fn on_initializtion(&self) { ... }
fn build_shutdown(&self) -> Result<Option<Value>> { ... }
fn on_build_exit(&self) { ... }
fn workspace_bts(&self) -> Result<WorkspaceBuildTargetsResult> { ... }
fn workspace_reload(&self) -> Result<Option<Value>> { ... }
fn bt_dependency_modules(
&self,
params: BuildTargetDependencyModules,
) -> Result<BuildTargetDependencyModulesResult> { ... }
fn debug_session_start(
&self,
params: DebugSessionStart,
) -> Result<DebugSessionStartResult> { ... }
fn bt_sources(
&self,
params: BuildTargetSources,
) -> Result<BuildTargetSourcesResult> { ... }
fn bt_inverse_sources(
&self,
params: TextDocumentInverseSources,
) -> Result<BuildTargetInverseSourcesResult> { ... }
fn bt_dependency_sources(
&self,
params: BuildTargetDependencySources,
) -> Result<BuildTargetDependencySourcesResult> { ... }
fn bt_resources(
&self,
params: BuildTargetResources,
) -> Result<BuildTargetResourcesResult> { ... }
fn bt_run(&self, params: BuildTargetRun) -> Result<BuildTargetRunResult> { ... }
fn bt_compile(
&self,
params: BuildTargetCompile,
) -> Result<BuildTargetCompileResult> { ... }
fn bt_test(&self, params: BuildTargetTest) -> Result<BuildTargetTestResult> { ... }
fn bt_clean_cache(
&self,
params: BuildTargetCleanCache,
) -> Result<BuildTargetCleanCacheResult> { ... }
}Required Methods§
Sourcefn initialize(&self, params: InitializeBuild) -> Result<InitializeBuildResult>
fn initialize(&self, params: InitializeBuild) -> Result<InitializeBuildResult>
Invoked when client sends server “build/initialize”
The initialize request is sent as the first request from the client to the server. If the server receives a request or notification before the initialize request it should act as follows:
-
For a request the response should be an error with code: -32002. The message can be picked by the server.
-
Notifications should be dropped, except for the exit notification. This will allow the exit of a server without an initialize request.
Until the server has responded to the initialize request with an InitializeBuildResult,
the client must not send any additional requests or notifications to the server.
Provided Methods§
Sourcefn on_initializtion(&self)
fn on_initializtion(&self)
Invoked when client sends server “build/initialized”
A notification is sent from the client to the server after the client received the result of the initialize request but before the client is sending any other request or notification to the server. The server can use the initialized notification for example to initialize intensive computation such as dependency resolution or compilation. The initialized notification may only be sent once.
Sourcefn build_shutdown(&self) -> Result<Option<Value>>
fn build_shutdown(&self) -> Result<Option<Value>>
Invoked when client sends server “build/shutdown”
The shutdown build request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client). There is a separate exit notification that asks the server to exit.
Sourcefn on_build_exit(&self)
fn on_build_exit(&self)
Invoked when client sends server “build/exit”
A notification to ask the server to exit its process. The server should exit with success code 0 if the shutdown request has been received before; otherwise with error code 1.
Sourcefn workspace_bts(&self) -> Result<WorkspaceBuildTargetsResult>
fn workspace_bts(&self) -> Result<WorkspaceBuildTargetsResult>
Invoked when client sends server “workspace/buildTargets”
The workspace build targets request is sent from the client to the server to ask for the list of all available build targets in the workspace.
Sourcefn workspace_reload(&self) -> Result<Option<Value>>
fn workspace_reload(&self) -> Result<Option<Value>>
Invoked when client sends server “workspace/reload”
Sourcefn bt_dependency_modules(
&self,
params: BuildTargetDependencyModules,
) -> Result<BuildTargetDependencyModulesResult>
fn bt_dependency_modules( &self, params: BuildTargetDependencyModules, ) -> Result<BuildTargetDependencyModulesResult>
Invoked when client sends server “buildTarget/dependencyModules”
The build target dependency modules request is sent from the client to the server to query for the libraries of build target dependencies that are external to the workspace including meta information about library and their sources. It’s an extended version of buildTarget/sources.
Sourcefn debug_session_start(
&self,
params: DebugSessionStart,
) -> Result<DebugSessionStartResult>
fn debug_session_start( &self, params: DebugSessionStart, ) -> Result<DebugSessionStartResult>
Invoked when client sends server “buildTarget/dependencyModules”
The debug request is sent from the client to the server to debug build target(s). The server launches a Microsoft DAP server and returns a connection URI for the client to interact with.
Sourcefn bt_sources(
&self,
params: BuildTargetSources,
) -> Result<BuildTargetSourcesResult>
fn bt_sources( &self, params: BuildTargetSources, ) -> Result<BuildTargetSourcesResult>
Invoked when client sends server “buildTarget/sources”
The build target sources request is sent from the client to the server to query for the list of text documents and directories that are belong to a build target. The sources response must not include sources that are external to the workspace.
Sourcefn bt_inverse_sources(
&self,
params: TextDocumentInverseSources,
) -> Result<BuildTargetInverseSourcesResult>
fn bt_inverse_sources( &self, params: TextDocumentInverseSources, ) -> Result<BuildTargetInverseSourcesResult>
Invoked when client sends server “buildTarget/inverseSources”
Sourcefn bt_dependency_sources(
&self,
params: BuildTargetDependencySources,
) -> Result<BuildTargetDependencySourcesResult>
fn bt_dependency_sources( &self, params: BuildTargetDependencySources, ) -> Result<BuildTargetDependencySourcesResult>
Invoked when client sends server “buildTarget/dependencySources”
The inverse sources request is sent from the client to the server to query for the list of build targets containing a text document. The server communicates during the initialize handshake whether this method is supported or not. This request can be viewed as the inverse of buildTarget/sources, except it only works for text documents and not directories.
Sourcefn bt_resources(
&self,
params: BuildTargetResources,
) -> Result<BuildTargetResourcesResult>
fn bt_resources( &self, params: BuildTargetResources, ) -> Result<BuildTargetResourcesResult>
Invoked when client sends server “buildTarget/resources”
The build target resources request is sent from the client to the server to query for the list of resources of a given list of build targets.
A resource is a data dependency required to be present in the runtime classpath when a build target is run or executed. The server communicates during the initialize handshake whether this method is supported or not.
This request can be used by a client to highlight the resources in a project view, for example.
Sourcefn bt_run(&self, params: BuildTargetRun) -> Result<BuildTargetRunResult>
fn bt_run(&self, params: BuildTargetRun) -> Result<BuildTargetRunResult>
Invoked when client sends server “buildTarget/run”
The run request is sent from the client to the server to run a build target. The server communicates during the initialize handshake whether this method is supported or not.
Sourcefn bt_compile(
&self,
params: BuildTargetCompile,
) -> Result<BuildTargetCompileResult>
fn bt_compile( &self, params: BuildTargetCompile, ) -> Result<BuildTargetCompileResult>
Invoked when client sends server “buildTarget/compile”
The run request is sent from the client to the server to run a build target. The server communicates during the initialize handshake whether this method is supported or not.
Sourcefn bt_test(&self, params: BuildTargetTest) -> Result<BuildTargetTestResult>
fn bt_test(&self, params: BuildTargetTest) -> Result<BuildTargetTestResult>
Invoked when client sends server “buildTarget/test”
The test build target request is sent from the client to the server to test the given list of build targets. The server communicates during the initialize handshake whether this method is supported or not.
Sourcefn bt_clean_cache(
&self,
params: BuildTargetCleanCache,
) -> Result<BuildTargetCleanCacheResult>
fn bt_clean_cache( &self, params: BuildTargetCleanCache, ) -> Result<BuildTargetCleanCacheResult>
Invoked when client sends server “buildTarget/cleanCache”
The clean cache request is sent from the client to the server to reset any state associated with a given build target. The state can live either in the build tool or in the file system.
The build tool defines the exact semantics of the clean cache request:
Stateless build tools are free to ignore the request and respond with a successful response. Stateful build tools must ensure that invoking compilation on a target that has been cleaned results in a full compilation.