Skip to content

Commit

Permalink
LS: Proc macro server connection (#6637)
Browse files Browse the repository at this point in the history
  • Loading branch information
Draggu authored Nov 25, 2024
1 parent d013153 commit 779da4d
Show file tree
Hide file tree
Showing 14 changed files with 651 additions and 17 deletions.
176 changes: 162 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/cairo-lang-language-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cairo-lang-syntax = { path = "../cairo-lang-syntax", version = "~2.8.5" }
cairo-lang-test-plugin = { path = "../cairo-lang-test-plugin", version = "~2.8.5" }
cairo-lang-utils = { path = "../cairo-lang-utils", version = "~2.8.5" }
crossbeam = "0.8.4"
governor = { version = "0.7.0", default-features = false, features = ["std", "quanta"]}
indent.workspace = true
indoc.workspace = true
itertools.workspace = true
Expand All @@ -35,6 +36,7 @@ lsp-types = "=0.95.0"
rustc-hash = "1.1.0"
salsa.workspace = true
scarb-metadata = "1.13"
scarb-proc-macro-server-types = "0.1"
serde = { workspace = true, default-features = true }
serde_json.workspace = true
smol_str.workspace = true
Expand Down
7 changes: 6 additions & 1 deletion crates/cairo-lang-language-server/src/lang/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use cairo_lang_utils::Upcast;
pub use self::semantic::*;
pub use self::swapper::*;
pub use self::syntax::*;
use super::proc_macros::db::{ProcMacroDatabase, init_proc_macro_group};
use crate::Tricks;

mod semantic;
Expand All @@ -33,7 +34,8 @@ mod syntax;
ParserDatabase,
SemanticDatabase,
SyntaxDatabase,
DocDatabase
DocDatabase,
ProcMacroDatabase
)]
pub struct AnalysisDatabase {
storage: salsa::Storage<Self>,
Expand All @@ -46,6 +48,9 @@ impl AnalysisDatabase {

init_files_group(&mut db);
init_lowering_group(&mut db, InliningStrategy::Default);
// proc-macro-server can be restarted many times but we want to keep these data across
// multiple server starts, so init it once per database, not per server.
init_proc_macro_group(&mut db);

db.set_cfg_set(Self::initial_cfg_set().into());

Expand Down
1 change: 1 addition & 0 deletions crates/cairo-lang-language-server/src/lang/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pub mod db;
pub mod diagnostics;
pub mod inspect;
pub mod lsp;
pub mod proc_macros;
Loading

0 comments on commit 779da4d

Please sign in to comment.