Add a little bit of docs and change activation event
This commit is contained in:
1 parent
b5312732ba
commit
e96fd1ce57
6 files changed
+93
-241
No files matched your search
@@ -1,12 +1,8 @@
|
||||
//! This file exports functions into the vscode extension
|
||||
|
||||
use dioxus_autofmt::FormattedBlock;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn greeet() {
|
||||
//
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn format_rsx(raw: String) -> String {
|
||||
let block = dioxus_autofmt::fmt_block(&raw, 0);
|
||||
@@ -14,7 +10,34 @@ pub fn format_rsx(raw: String) -> String {
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn translate_rsx(contents: String, component: bool) -> String {
|
||||
pub fn format_selection(raw: String) -> String {
|
||||
let block = dioxus_autofmt::fmt_block(&raw, 0);
|
||||
block.unwrap()
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct FormatBlockInstance {
|
||||
new: String,
|
||||
_edits: Vec<FormattedBlock>,
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl FormatBlockInstance {
|
||||
#[wasm_bindgen]
|
||||
pub fn formatted(&self) -> String {
|
||||
self.new.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn format_file(contents: String) -> FormatBlockInstance {
|
||||
let _edits = dioxus_autofmt::fmt_file(&contents);
|
||||
let out = dioxus_autofmt::apply_formats(&contents, _edits.clone());
|
||||
FormatBlockInstance { new: out, _edits }
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn translate_rsx(contents: String, _component: bool) -> String {
|
||||
// Ensure we're loading valid HTML
|
||||
let dom = html_parser::Dom::parse(&contents).unwrap();
|
||||
|
||||
|
||||
Reference in new issue
Block a user