diff --git a/core/tests/integration/main.rs b/core/tests/integration/main.rs index 420afb81c..fdc1b498a 100644 --- a/core/tests/integration/main.rs +++ b/core/tests/integration/main.rs @@ -27,8 +27,8 @@ fn check_annotated_nickel_file(path: &str) { let test: TestCase = read_annotated_test_case(path).expect("Failed to parse annotated program"); - // By default, cargo runs tests with a 2MB stack, which we can overflow in - // debug mode. To avoid this we run the tests with an increased stack size. + // By default, cargo runs tests with a 2MB stack, which is easy to overflow. To avoid this we + // run the tests with an increased stack size. const STACK_SIZE: usize = 4 * 1024 * 1024; let path = String::from(project_root().join(path).to_string_lossy()); diff --git a/lsp/nls/src/main.rs b/lsp/nls/src/main.rs index 57f162dae..092203234 100644 --- a/lsp/nls/src/main.rs +++ b/lsp/nls/src/main.rs @@ -1,4 +1,4 @@ -use std::{fs, io, path::PathBuf}; +use std::{fs, io, path::PathBuf, thread}; use anyhow::Result; @@ -29,6 +29,10 @@ mod usage; mod utils; mod world; +// Default stack size is 1MB on Windows, which is too small. We make it 8MB, which is the default +// size on Linux. +const STACK_SIZE: usize = 8 * 1024 * 1024; + use crate::{config::LspConfig, trace::Trace}; #[derive(clap::Parser, Debug)] @@ -59,6 +63,15 @@ struct Options { } fn main() -> Result<()> { + let handle = thread::Builder::new() + .stack_size(STACK_SIZE) + .spawn(run) + .unwrap(); + + handle.join().unwrap() +} + +fn run() -> Result<()> { use clap::Parser; env_logger::init(); diff --git a/lsp/nls/src/server.rs b/lsp/nls/src/server.rs index 04bd43c0f..e6371b3c6 100644 --- a/lsp/nls/src/server.rs +++ b/lsp/nls/src/server.rs @@ -96,6 +96,7 @@ impl Server { .send(Message::Response(response)) .unwrap(); } + pub(crate) fn notify(&mut self, notification: Notification) { trace!("Sending notification: {:#?}", notification); self.connection