|
1 | 1 | use simple_completion_language_server::{ac_searcher, search, server, snippets, RopeReader};
|
2 |
| -use std::collections::HashMap; |
| 2 | +use std::collections::BTreeMap; |
3 | 3 | use std::io::Read;
|
4 | 4 |
|
5 | 5 | use std::pin::Pin;
|
@@ -75,7 +75,7 @@ struct TestContext {
|
75 | 75 | impl TestContext {
|
76 | 76 | pub async fn new(
|
77 | 77 | snippets: Vec<snippets::Snippet>,
|
78 |
| - unicode_input: HashMap<String, String>, |
| 78 | + unicode_input: BTreeMap<String, String>, |
79 | 79 | home_dir: String,
|
80 | 80 | ) -> anyhow::Result<Self> {
|
81 | 81 | let (request_tx, rx) = mpsc::unbounded_channel::<String>();
|
@@ -227,7 +227,7 @@ fn words_search() -> anyhow::Result<()> {
|
227 | 227 |
|
228 | 228 | #[test_log::test(tokio::test)]
|
229 | 229 | async fn initialize() -> anyhow::Result<()> {
|
230 |
| - let mut context = TestContext::new(Vec::new(), HashMap::new(), String::new()).await?; |
| 230 | + let mut context = TestContext::new(Vec::new(), BTreeMap::new(), String::new()).await?; |
231 | 231 |
|
232 | 232 | let request = jsonrpc::Request::build("initialize")
|
233 | 233 | .id(1)
|
@@ -258,7 +258,7 @@ async fn initialize() -> anyhow::Result<()> {
|
258 | 258 |
|
259 | 259 | #[test_log::test(tokio::test)]
|
260 | 260 | async fn completion() -> anyhow::Result<()> {
|
261 |
| - let mut context = TestContext::new(Vec::new(), HashMap::new(), String::new()).await?; |
| 261 | + let mut context = TestContext::new(Vec::new(), BTreeMap::new(), String::new()).await?; |
262 | 262 | context.initialize().await?;
|
263 | 263 | context.send_all(&[
|
264 | 264 | r#"{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"python","text":"hello\nhe","uri":"file:///tmp/main.py","version":0}}}"#,
|
@@ -295,7 +295,7 @@ async fn completion() -> anyhow::Result<()> {
|
295 | 295 |
|
296 | 296 | #[test_log::test(tokio::test)]
|
297 | 297 | async fn completion_by_quoted_word() -> anyhow::Result<()> {
|
298 |
| - let mut context = TestContext::new(Vec::new(), HashMap::new(), String::new()).await?; |
| 298 | + let mut context = TestContext::new(Vec::new(), BTreeMap::new(), String::new()).await?; |
299 | 299 | context.initialize().await?;
|
300 | 300 | context.send_all(&[
|
301 | 301 | r#"{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"python","text":"function(\"hello\")\nhe","uri":"file:///tmp/main.py","version":0}}}"#,
|
@@ -334,7 +334,7 @@ async fn snippets() -> anyhow::Result<()> {
|
334 | 334 | description: None,
|
335 | 335 | },
|
336 | 336 | ],
|
337 |
| - HashMap::new(), |
| 337 | + BTreeMap::new(), |
338 | 338 | String::new(),
|
339 | 339 | )
|
340 | 340 | .await?;
|
@@ -374,7 +374,7 @@ async fn snippets_inline_by_word_tail() -> anyhow::Result<()> {
|
374 | 374 | body: "^2".to_string(),
|
375 | 375 | description: None,
|
376 | 376 | }],
|
377 |
| - HashMap::new(), |
| 377 | + BTreeMap::new(), |
378 | 378 | String::new(),
|
379 | 379 | )
|
380 | 380 | .await?;
|
@@ -428,7 +428,7 @@ async fn snippets_inline_by_word_tail() -> anyhow::Result<()> {
|
428 | 428 | async fn unicode_input() -> anyhow::Result<()> {
|
429 | 429 | let mut context = TestContext::new(
|
430 | 430 | Vec::new(),
|
431 |
| - HashMap::from_iter([ |
| 431 | + BTreeMap::from_iter([ |
432 | 432 | ("alpha".to_string(), "α".to_string()),
|
433 | 433 | ("betta".to_string(), "β".to_string()),
|
434 | 434 | ]),
|
@@ -484,7 +484,7 @@ async fn unicode_input() -> anyhow::Result<()> {
|
484 | 484 | async fn paths() -> anyhow::Result<()> {
|
485 | 485 | std::fs::create_dir_all("/tmp/scls-test/sub-folder")?;
|
486 | 486 |
|
487 |
| - let mut context = TestContext::new(Vec::new(), HashMap::new(), "/tmp".to_string()).await?; |
| 487 | + let mut context = TestContext::new(Vec::new(), BTreeMap::new(), "/tmp".to_string()).await?; |
488 | 488 | context.initialize().await?;
|
489 | 489 |
|
490 | 490 | let request = jsonrpc::Request::from_str(&serde_json::to_string(&serde_json::json!(
|
@@ -625,7 +625,7 @@ bibliography: "/tmp/scls-test-citation/test.bib" # could also be surrounded by b
|
625 | 625 |
|
626 | 626 | std::fs::write("/tmp/scls-test-citation/test.bib", bib)?;
|
627 | 627 |
|
628 |
| - let mut context = TestContext::new(Vec::new(), HashMap::new(), String::new()).await?; |
| 628 | + let mut context = TestContext::new(Vec::new(), BTreeMap::new(), String::new()).await?; |
629 | 629 | context.initialize().await?;
|
630 | 630 |
|
631 | 631 | let request = jsonrpc::Request::from_str(&serde_json::to_string(&serde_json::json!(
|
|
0 commit comments