more lsp tests / pass python a bool on parse (#6975)

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* parse returns bool for python

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-05-15 11:04:53 -07:00
committed by GitHub
parent d34aea345b
commit d93a57d7bf
14 changed files with 89 additions and 26 deletions

View File

@ -229,7 +229,7 @@ async fn new_context_state(current_file: Option<std::path::PathBuf>) -> Result<(
/// Parse the kcl code from a file path.
#[pyfunction]
async fn parse(path: String) -> PyResult<()> {
async fn parse(path: String) -> PyResult<bool> {
tokio()
.spawn(async move {
let (code, path) = get_code_and_file_path(&path)
@ -238,7 +238,7 @@ async fn parse(path: String) -> PyResult<()> {
let _program = kcl_lib::Program::parse_no_errs(&code)
.map_err(|err| into_miette_for_parse(&path.display().to_string(), &code, err))?;
Ok(())
Ok(true)
})
.await
.map_err(|err| pyo3::exceptions::PyException::new_err(err.to_string()))?
@ -246,10 +246,10 @@ async fn parse(path: String) -> PyResult<()> {
/// Parse the kcl code.
#[pyfunction]
fn parse_code(code: String) -> PyResult<()> {
fn parse_code(code: String) -> PyResult<bool> {
let _program = kcl_lib::Program::parse_no_errs(&code).map_err(|err| into_miette_for_parse("", &code, err))?;
Ok(())
Ok(true)
}
/// Execute the kcl code from a file path.