Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Expose debug symbol start and end for the language server #289

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ authors = ["Leo Lara <[email protected]>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[patch.crates-io]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "da4983e" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "bc857a7" }

[patch."https://github.com/scroll-tech/halo2.git"]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "da4983e" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "bc857a7" }

[dependencies]
pyo3 = { version = "0.19.1", features = ["extension-module"] }

halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, features = [ "circuit-params", "derive_serde"], rev = "da4983e"}
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, features = [ "circuit-params", "derive_serde"], rev = "bc857a7"}

halo2_middleware = { git = "https://github.com/privacy-scaling-explorations/halo2.git", rev = "da4983e" }
halo2_backend = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features = ["derive_serde"], rev = "da4983e" }
halo2_middleware = { git = "https://github.com/privacy-scaling-explorations/halo2.git", rev = "bc857a7" }
halo2_backend = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features = ["derive_serde"], rev = "bc857a7" }

num-bigint = { version = "0.4", features = ["rand"] }
uuid = { version = "1.4.0", features = ["v1", "rng"] }
Expand Down
31 changes: 30 additions & 1 deletion src/parser/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ impl PartialEq for DebugSymRef {
}
}

/// Interface of the debug symbol reference to use with the Chiquito language server
pub trait LanguageServerInterface {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alxkzmn I don't think it is custom in Rust to call Interface to a trait. Also, the interface is used by the Language Server, not an interface to the Language Server.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be something like GetPos? or something refering to the actions that are allowed by the trait

fn get_start(&self) -> usize;
fn get_end(&self) -> usize;
}

impl LanguageServerInterface for DebugSymRef {
fn get_start(&self) -> usize {
self.start
}

fn get_end(&self) -> usize {
self.end
}
}

#[derive(Clone, PartialEq, Eq)]
pub struct Identifier(
/// Name
Expand Down Expand Up @@ -227,7 +243,20 @@ mod test {

use codespan_reporting::files::SimpleFile;

use crate::parser::ast::{DebugSymRef, Identifier};
use crate::parser::ast::{DebugSymRef, Identifier, LanguageServerInterface};

#[test]
fn test_language_server_interface() {
let debug_sym_ref = DebugSymRef {
start: 0,
end: 1,
file: Arc::new(SimpleFile::new("file_path".to_string(), "".to_string())),
virt: false,
};

assert_eq!(debug_sym_ref.get_start(), 0);
assert_eq!(debug_sym_ref.get_end(), 1);
}

#[test]
fn test_from_string() {
Expand Down
Loading