Skip to content

Commit

Permalink
test(els): add ELS test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Aug 30, 2023
1 parent f69e45f commit 49c4ae6
Show file tree
Hide file tree
Showing 7 changed files with 622 additions and 7 deletions.
115 changes: 111 additions & 4 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions crates/els/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.85"
lsp-types = { version = "0.93.2", features = ["proposed"] }

[dev-dependencies]
gag = "1"

[lib]
path = "lib.rs"

Expand Down
2 changes: 1 addition & 1 deletion crates/els/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl FileCacheEntry {

/// Stores the contents of the file on-memory.
/// This struct can save changes in real-time & incrementally.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct FileCache {
pub files: Shared<Dict<NormalizedUrl, FileCacheEntry>>,
}
Expand Down
1 change: 1 addition & 0 deletions crates/els/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ mod server;
mod sig_help;
mod util;
pub use server::*;
pub use util::*;
4 changes: 2 additions & 2 deletions crates/els/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl AnalysisResult {
}
}

pub(crate) const TRIGGER_CHARS: [&str; 4] = [".", ":", "(", " "];
pub const TRIGGER_CHARS: [&str; 4] = [".", ":", "(", " "];

#[derive(Debug, Clone, Default)]
pub struct AnalysisResultCache(Shared<Dict<NormalizedUrl, AnalysisResult>>);
Expand Down Expand Up @@ -664,7 +664,7 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
Ok(Value::from_str(&s)?)
}

fn dispatch(&mut self, msg: Value) -> ELSResult<()> {
pub fn dispatch(&mut self, msg: Value) -> ELSResult<()> {
match (
msg.get("id").and_then(|i| i.as_i64()),
msg.get("method").and_then(|m| m.as_str()),
Expand Down
2 changes: 2 additions & 0 deletions crates/els/tests/a.er
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x = 1
_ = x + 1
Loading

0 comments on commit 49c4ae6

Please sign in to comment.