Applies WorkspaceEdit 请求

workspace/applyEdit 请求从服务器发送到客户端,用于在客户端修改资源。

客户端能力(Client capability):

  • 属性路径: workspace.applyEdit
  • 属性类型: boolean

另请参阅 WorkspaceEditClientCapabilities,了解工作区编辑支持的功能。

请求(Request):

  • method: "workspace/applyEdit"
  • params: ApplyWorkspaceEditParams, 定义如下:
export interface ApplyWorkspaceEditParams {
	/**
	 * An optional label of the workspace edit. This label is
	 * presented in the user interface for example on an undo
	 * stack to undo the workspace edit.
	 */
	label?: string;

	/**
	 * The edits to apply.
	 */
	edit: WorkspaceEdit;
}

响应(Response):

  • result: ApplyWorkspaceEditResult, 定义如下:
export interface ApplyWorkspaceEditResult {
	/**
	 * Indicates whether the edit was applied or not.
	 */
	applied: boolean;

	/**
	 * An optional textual description for why the edit was not applied.
	 * This may be used by the server for diagnostic logging or to provide
	 * a suitable error for a request that triggered the edit.
	 */
	failureReason?: string;

	/**
	 * Depending on the client's failure handling strategy `failedChange`
	 * might contain the index of the change that failed. This property is
	 * only available if the client signals a `failureHandling` strategy
	 * in its client capabilities.
	 */
	failedChange?: uinteger;
}