checkpoint before gfm ast parser design
This commit is contained in:
@@ -49,6 +49,33 @@ pub enum KernelProjectionKind {
|
||||
RagIndex,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum WorkspaceSourceKind {
|
||||
LocalFolder,
|
||||
ConvexWorkspace,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum WorkspaceSourceCapability {
|
||||
LoadSnapshot,
|
||||
Watch,
|
||||
PreflightCommand,
|
||||
ExecuteCommand,
|
||||
ResolvePageAggregate,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WorkspaceSource {
|
||||
pub source_kind: WorkspaceSourceKind,
|
||||
pub root_uri: String,
|
||||
pub workspace_id: String,
|
||||
#[serde(default)]
|
||||
pub capabilities: Vec<WorkspaceSourceCapability>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum KernelProjectionCapability {
|
||||
@@ -638,4 +665,31 @@ mod tests {
|
||||
assert_eq!(value["resourceMeta"]["resourceKind"], json!("document"));
|
||||
assert_eq!(value["iconHint"], json!("page"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workspace_source_serializes_minimal_command_source_contract() {
|
||||
let source = WorkspaceSource {
|
||||
source_kind: WorkspaceSourceKind::ConvexWorkspace,
|
||||
root_uri: "convex://workspace/ws_1".into(),
|
||||
workspace_id: "ws_1".into(),
|
||||
capabilities: vec![
|
||||
WorkspaceSourceCapability::LoadSnapshot,
|
||||
WorkspaceSourceCapability::PreflightCommand,
|
||||
WorkspaceSourceCapability::ExecuteCommand,
|
||||
],
|
||||
};
|
||||
|
||||
let value = serde_json::to_value(&source).expect("workspace source 应可序列化");
|
||||
assert_eq!(value["sourceKind"], json!("convex_workspace"));
|
||||
assert_eq!(value["rootUri"], json!("convex://workspace/ws_1"));
|
||||
assert_eq!(value["workspaceId"], json!("ws_1"));
|
||||
assert_eq!(
|
||||
value["capabilities"],
|
||||
json!(["load-snapshot", "preflight-command", "execute-command"])
|
||||
);
|
||||
|
||||
let decoded: WorkspaceSource =
|
||||
serde_json::from_value(value).expect("workspace source 应可反序列化");
|
||||
assert_eq!(decoded, source);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ pub use kernel::{
|
||||
KernelProjectionCapability, KernelProjectionFilter, KernelProjectionItem, KernelProjectionKind,
|
||||
KernelProjectionRequest, KernelProjectionResourceKind, KernelProjectionResourceMeta,
|
||||
KernelProjectionResult, KernelProjectionRowKind, KernelRefsPayload, KernelSubtreeRef,
|
||||
KernelSubtreeResult, KernelTraverseGraph, KernelUpdateNode,
|
||||
KernelSubtreeResult, KernelTraverseGraph, KernelUpdateNode, WorkspaceSource,
|
||||
WorkspaceSourceCapability, WorkspaceSourceKind,
|
||||
};
|
||||
pub use mindmap::{
|
||||
MindmapCommand, MindmapNodeData, MindmapNodeInput, MindmapNodeRef, MindmapOp,
|
||||
|
||||
@@ -102,7 +102,7 @@ impl Default for PageOptions {
|
||||
wide_layout: false,
|
||||
small_text: false,
|
||||
layout_density: "normal".into(),
|
||||
show_heading_numbers: true,
|
||||
show_heading_numbers: false,
|
||||
show_toc: false,
|
||||
show_structure: false,
|
||||
protect_editing: false,
|
||||
@@ -116,6 +116,16 @@ impl Default for PageOptions {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PageOptions;
|
||||
|
||||
#[test]
|
||||
fn page_options_default_disables_heading_numbers() {
|
||||
assert!(!PageOptions::default().show_heading_numbers);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PageBody {
|
||||
|
||||
Reference in New Issue
Block a user