BREAKING: KCL @settings are the source of truth for units (#5808)
This commit is contained in:
@ -69,7 +69,6 @@ pub async fn lsp_run_kcl(config: LspServerConfig, token: String, baseurl: String
|
||||
let (service, socket) = LspService::build(|client| {
|
||||
kcl_lib::KclLspBackend::new_wasm(client, executor_ctx, fs, zoo_client, can_send_telemetry).unwrap()
|
||||
})
|
||||
.custom_method("kcl/updateUnits", kcl_lib::KclLspBackend::update_units)
|
||||
.custom_method("kcl/updateCanExecute", kcl_lib::KclLspBackend::update_can_execute)
|
||||
.finish();
|
||||
|
||||
|
@ -269,6 +269,17 @@ pub fn change_kcl_settings(code: &str, settings_str: &str) -> Result<String, Str
|
||||
Ok(formatted)
|
||||
}
|
||||
|
||||
/// Returns true if the given KCL is empty or only contains settings that would
|
||||
/// be auto-generated.
|
||||
#[wasm_bindgen]
|
||||
pub fn is_kcl_empty_or_only_settings(code: &str) -> Result<JsValue, String> {
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
let program = Program::parse_no_errs(code).map_err(|e| e.to_string())?;
|
||||
|
||||
JsValue::from_serde(&program.is_empty_or_only_settings()).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Get the version of the kcl library.
|
||||
#[wasm_bindgen]
|
||||
pub fn get_kcl_version() -> String {
|
||||
|
Reference in New Issue
Block a user