Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
211 changes: 209 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ drop_bomb = "0.1.5"
camino = "1.1.9"
pg_query = "6.1.0"
rowan = "0.15.15"
salsa = "0.26.0"
smol_str = "0.3.2"
enum-iterator = "2.1.0"
itertools = "0.14.0"
Expand Down
1 change: 1 addition & 0 deletions crates/squawk_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ simplelog.workspace = true
lsp-server.workspace = true
lsp-types.workspace = true
rowan.workspace = true
salsa.workspace = true
serde.workspace = true
serde_json.workspace = true
squawk-ide.workspace = true
Expand Down
29 changes: 29 additions & 0 deletions crates/squawk_server/src/db.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use ::line_index::LineIndex;
use salsa::Database as Db;
use salsa::Storage;
use squawk_syntax::{Parse, SourceFile};

#[salsa::input]
pub struct File {
#[returns(ref)]
pub content: String,
pub version: i32,
}

#[salsa::tracked]
pub fn parse(db: &dyn Db, file: File) -> Parse<SourceFile> {
SourceFile::parse(file.content(db))
}

#[salsa::tracked]
pub fn line_index(db: &dyn Db, file: File) -> LineIndex {
LineIndex::new(file.content(db))
}

#[salsa::db]
#[derive(Default)]
pub struct Database {
storage: Storage<Self>,
}

impl salsa::Database for Database {}
Loading
Loading