Rust executor in kcl lsp server (just rust side for now) (#2103)
* start of cleaning up executor Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup executor Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * do nothing if the file does not change Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * execution is lsp Signed-off-by: Jess Frazelle <github@jessfraz.com> * add the custom notifications Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * custom notifications Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix spawn local Signed-off-by: Jess Frazelle <github@jessfraz.com> * update derive-docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * ckeanups Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * emptu --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "derive-docs"
|
||||
description = "A tool for generating documentation from Rust derive macros"
|
||||
version = "0.1.13"
|
||||
version = "0.1.14"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/KittyCAD/modeling-app"
|
||||
|
@ -383,7 +383,7 @@ fn do_stdlib_inner(
|
||||
fn #boxed_fn_name_ident(
|
||||
args: crate::std::Args,
|
||||
) -> std::pin::Pin<
|
||||
Box<dyn std::future::Future<Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>>>,
|
||||
Box<dyn std::future::Future<Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>> + Send>,
|
||||
> {
|
||||
Box::pin(#fn_name_ident(args))
|
||||
}
|
||||
@ -783,11 +783,10 @@ fn generate_code_block_test(
|
||||
let tokens = crate::token::lexer(#code_block);
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone()).await.unwrap();
|
||||
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx).await.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_show {
|
||||
let tokens = crate::token::lexer("This is another code block.\nyes sirrr.\nshow");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -123,14 +120,11 @@ mod test_examples_show {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nshow");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -205,8 +199,8 @@ fn boxed_show(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(show(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_show {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nshow");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -110,8 +107,8 @@ fn boxed_show(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(show(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_my_func {
|
||||
let tokens = crate::token::lexer("This is another code block.\nyes sirrr.\nmyFunc");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -123,14 +120,11 @@ mod test_examples_my_func {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nmyFunc");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -205,8 +199,8 @@ fn boxed_my_func(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(my_func(args))
|
||||
|
@ -29,14 +29,11 @@ mod test_examples_import {
|
||||
let tokens = crate::token::lexer("This is another code block.\nyes sirrr.\nimport");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -125,14 +122,11 @@ mod test_examples_import {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nimport");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -207,8 +201,8 @@ fn boxed_import(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(import(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_line_to {
|
||||
let tokens = crate::token::lexer("This is another code block.\nyes sirrr.\nlineTo");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -123,14 +120,11 @@ mod test_examples_line_to {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nlineTo");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -205,8 +199,8 @@ fn boxed_line_to(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(line_to(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_min {
|
||||
let tokens = crate::token::lexer("This is another code block.\nyes sirrr.\nmin");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -123,14 +120,11 @@ mod test_examples_min {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nmin");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -205,8 +199,8 @@ fn boxed_min(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(min(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_show {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nshow");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -110,8 +107,8 @@ fn boxed_show(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(show(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_import {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nimport");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -110,8 +107,8 @@ fn boxed_import(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(import(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_import {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nimport");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -110,8 +107,8 @@ fn boxed_import(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(import(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_import {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nimport");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -110,8 +107,8 @@ fn boxed_import(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(import(args))
|
||||
|
@ -28,14 +28,11 @@ mod test_examples_show {
|
||||
let tokens = crate::token::lexer("This is code.\nIt does other shit.\nshow");
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
ctx.run(program, None).await.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
@ -110,8 +107,8 @@ fn boxed_show(
|
||||
) -> std::pin::Pin<
|
||||
Box<
|
||||
dyn std::future::Future<
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
>,
|
||||
Output = anyhow::Result<crate::executor::MemoryItem, crate::errors::KclError>,
|
||||
> + Send,
|
||||
>,
|
||||
> {
|
||||
Box::pin(show(args))
|
||||
|
Reference in New Issue
Block a user