ontocore_core/
quick_fix.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
7#[serde(tag = "kind", rename_all = "snake_case")]
8pub enum QuickFix {
9 InsertText { label: String, line: usize, column: usize, text: String },
11 ApplyPatch { label: String, document_path: String, patches: Vec<serde_json::Value> },
13 RemoveLine { label: String, line: usize },
15}
16
17impl QuickFix {
18 pub fn encode(&self) -> Option<String> {
19 serde_json::to_string(self).ok()
20 }
21
22 pub fn decode(raw: &str) -> Option<Self> {
23 serde_json::from_str(raw).ok()
24 }
25}