php-lsp 0.27.0

A PHP Language Server Protocol implementation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
use super::*;
use crate::editing::use_import::{build_use_import_edit, find_use_insert_line};
use crate::lang::config::{DiagnosticsConfig, FeaturesConfig, MAX_INDEXED_FILES};
use std::sync::Arc;
use tower_lsp_server::ls_types::{Position, Range, Uri};

#[tokio::test]
async fn dependent_reanalysis_is_skipped_before_index_ready() {
    // Given two open files while the workspace index is not ready.
    let docs = Arc::new(DocumentStore::new());
    let open_files = OpenFiles::new();
    let changed_uri = "file:///changed.php".parse::<Uri>().unwrap();
    let dependent_uri = "file:///dependent.php".parse::<Uri>().unwrap();
    open_files.set_open_text(
        &docs,
        changed_uri.clone(),
        "<?php\nfunction changed(): void {}\n".to_owned(),
    );
    open_files.set_open_text(&docs, dependent_uri, "<?php\nchanged();\n".to_owned());

    // When the changed file asks for dependent diagnostic publishes.
    let publishes = compute_dependent_publishes_owned(
        Arc::clone(&docs),
        open_files,
        changed_uri,
        DiagnosticsConfig::default(),
        false,
    )
    .await;

    // Then no dependent sweep starts before the initial scan completes.
    assert!(
        publishes.is_empty(),
        "dependent reanalysis must wait until the workspace index is ready"
    );
}

// DiagnosticsConfig::from_value tests
#[test]
fn diagnostics_config_default_is_enabled() {
    let cfg = DiagnosticsConfig::default();
    assert!(cfg.enabled);
    assert!(cfg.undefined_variables);
    assert!(cfg.undefined_functions);
    assert!(cfg.undefined_classes);
    assert!(cfg.arity_errors);
    assert!(cfg.type_errors);
    assert!(cfg.deprecated_calls);
    assert!(cfg.duplicate_declarations);
}

#[test]
fn diagnostics_config_from_empty_object_is_enabled() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!({}));
    assert!(cfg.enabled);
    assert!(cfg.undefined_variables);
}

#[test]
fn diagnostics_config_from_non_object_uses_defaults() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!(null));
    assert!(cfg.enabled);
}

#[test]
fn diagnostics_config_can_disable_individual_flags() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!({
        "enabled": true,
        "undefinedVariables": false,
        "undefinedFunctions": false,
        "undefinedClasses": true,
        "arityErrors": false,
        "typeErrors": true,
        "deprecatedCalls": false,
        "duplicateDeclarations": true,
    }));
    assert!(cfg.enabled);
    assert!(!cfg.undefined_variables);
    assert!(!cfg.undefined_functions);
    assert!(cfg.undefined_classes);
    assert!(!cfg.arity_errors);
    assert!(cfg.type_errors);
    assert!(!cfg.deprecated_calls);
    assert!(cfg.duplicate_declarations);
}

#[test]
fn diagnostics_config_parses_disabled_list() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!({
        "disabled": ["MissingThrowsDocblock", 42, "UnusedParam"],
    }));
    assert_eq!(cfg.disabled, vec!["MissingThrowsDocblock", "UnusedParam"]);
    assert!(DiagnosticsConfig::default().disabled.is_empty());
}

#[test]
fn diagnostics_config_parses_exclude_paths() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!({
        "excludePaths": ["vendor/*", 1, "src/Generated"],
    }));
    assert_eq!(cfg.exclude_paths, vec!["vendor/*", "src/Generated"]);
    assert!(DiagnosticsConfig::default().exclude_paths.is_empty());
}

#[test]
fn diagnostics_config_master_switch_disables_all() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!({"enabled": false}));
    assert!(!cfg.enabled);
    // Other flags still have their default values
    assert!(cfg.undefined_variables);
}

#[test]
fn diagnostics_config_master_switch_enables_all() {
    let cfg = DiagnosticsConfig::from_value(&serde_json::json!({"enabled": true}));
    assert!(cfg.enabled);
    assert!(cfg.undefined_variables);
}

// LspConfig::from_value tests
#[test]
fn lsp_config_default_is_empty() {
    let cfg = LspConfig::default();
    assert!(cfg.php_version.is_none());
    assert!(cfg.exclude_paths.is_empty());
    assert!(cfg.diagnostics.enabled);
}

#[test]
fn lsp_config_parses_php_version() {
    let cfg =
        LspConfig::from_value(&serde_json::json!({"phpVersion": crate::lang::autoload::PHP_8_2}));
    assert_eq!(
        cfg.php_version.as_deref(),
        Some(crate::lang::autoload::PHP_8_2)
    );
}

#[test]
fn lsp_config_parses_exclude_paths() {
    let cfg = LspConfig::from_value(&serde_json::json!({
        "excludePaths": ["cache/*", "generated/*"]
    }));
    assert_eq!(cfg.exclude_paths, vec!["cache/*", "generated/*"]);
}

#[test]
fn lsp_config_parses_include_paths() {
    let cfg = LspConfig::from_value(&serde_json::json!({
        "includePaths": ["vendor/yiisoft"]
    }));
    assert_eq!(cfg.include_paths, vec!["vendor/yiisoft"]);
}

#[test]
fn lsp_config_parses_both_exclude_and_include_paths() {
    let cfg = LspConfig::from_value(&serde_json::json!({
        "excludePaths": ["cache/*", "logs/*"],
        "includePaths": ["vendor/yiisoft"]
    }));
    assert_eq!(cfg.exclude_paths, vec!["cache/*", "logs/*"]);
    assert_eq!(cfg.include_paths, vec!["vendor/yiisoft"]);
}

#[test]
fn lsp_config_parses_diagnostics_section() {
    let cfg = LspConfig::from_value(&serde_json::json!({
        "diagnostics": {"enabled": false}
    }));
    assert!(!cfg.diagnostics.enabled);
}

#[test]
fn lsp_config_ignores_missing_fields() {
    let cfg = LspConfig::from_value(&serde_json::json!({}));
    assert!(cfg.php_version.is_none());
    assert!(cfg.exclude_paths.is_empty());
}

#[test]
fn lsp_config_parses_max_indexed_files() {
    let cfg = LspConfig::from_value(&serde_json::json!({"maxIndexedFiles": 5000}));
    assert_eq!(cfg.max_indexed_files, 5000);
}

#[test]
fn lsp_config_default_max_indexed_files() {
    let cfg = LspConfig::default();
    assert_eq!(cfg.max_indexed_files, MAX_INDEXED_FILES);
}

#[test]
fn lsp_config_default_debounce_ms() {
    let cfg = LspConfig::default();
    assert_eq!(cfg.debounce_ms, 100);
}

#[test]
fn lsp_config_parses_debounce_ms() {
    let cfg = LspConfig::from_value(&serde_json::json!({"debounceMs": 150}));
    assert_eq!(cfg.debounce_ms, 150);
}

#[test]
fn lsp_config_debounce_ms_minimum_one() {
    let cfg = LspConfig::from_value(&serde_json::json!({"debounceMs": 0}));
    assert_eq!(cfg.debounce_ms, 1);
}

// FeaturesConfig tests
#[test]
fn features_config_default_all_enabled() {
    let cfg = FeaturesConfig::default();
    assert!(cfg.completion);
    assert!(cfg.hover);
    assert!(cfg.definition);
    assert!(cfg.declaration);
    assert!(cfg.references);
    assert!(cfg.document_symbols);
    assert!(cfg.workspace_symbols);
    assert!(cfg.rename);
    assert!(cfg.signature_help);
    assert!(cfg.inlay_hints);
    assert!(cfg.semantic_tokens);
    assert!(cfg.selection_range);
    assert!(cfg.call_hierarchy);
    assert!(cfg.document_highlight);
    assert!(cfg.implementation);
    assert!(cfg.code_action);
    assert!(cfg.type_definition);
    assert!(cfg.code_lens);
    assert!(cfg.formatting);
    assert!(cfg.range_formatting);
    assert!(cfg.on_type_formatting);
    assert!(cfg.document_link);
    assert!(cfg.linked_editing_range);
    assert!(cfg.inline_values);
}

#[test]
fn features_config_from_empty_object_all_enabled() {
    let cfg = FeaturesConfig::from_value(&serde_json::json!({}));
    assert!(cfg.completion);
    assert!(cfg.hover);
    assert!(cfg.call_hierarchy);
    assert!(cfg.inline_values);
}

#[test]
fn features_config_can_disable_individual_flags() {
    let cfg = FeaturesConfig::from_value(&serde_json::json!({
        "callHierarchy": false,
    }));
    assert!(!cfg.call_hierarchy);
    assert!(cfg.completion);
    assert!(cfg.hover);
    assert!(cfg.definition);
    assert!(cfg.inline_values);
}

#[test]
fn lsp_config_parses_features_section() {
    let cfg = LspConfig::from_value(&serde_json::json!({
        "features": {"callHierarchy": false}
    }));
    assert!(!cfg.features.call_hierarchy);
    assert!(cfg.features.completion);
    assert!(cfg.features.hover);
}

// find_use_insert_line tests
#[test]
fn find_use_insert_line_after_php_open_tag() {
    let src = "<?php\nfunction foo() {}";
    assert_eq!(find_use_insert_line(src), 1);
}

#[test]
fn find_use_insert_line_after_existing_use() {
    let src = "<?php\nuse Foo\\Bar;\nuse Baz\\Qux;\nclass Impl {}";
    assert_eq!(find_use_insert_line(src), 3);
}

#[test]
fn find_use_insert_line_after_namespace() {
    let src = "<?php\nnamespace App\\Services;\nclass Service {}";
    assert_eq!(find_use_insert_line(src), 2);
}

#[test]
fn find_use_insert_line_after_namespace_and_use() {
    let src = "<?php\nnamespace App;\nuse Foo\\Bar;\nclass Impl {}";
    assert_eq!(find_use_insert_line(src), 3);
}

#[test]
fn find_use_insert_line_empty_file() {
    assert_eq!(find_use_insert_line(""), 0);
}

// indexed_file_op tests
#[test]
fn indexed_file_op_matches_php_files_by_default() {
    let op = indexed_file_op(&["php".to_string()]);
    assert_eq!(op.filters.len(), 1);
    let filter = &op.filters[0];
    assert_eq!(filter.scheme.as_deref(), Some("file"));
    assert_eq!(filter.pattern.glob, "**/*.php");
}

#[test]
fn indexed_file_op_adds_a_filter_per_configured_extension() {
    let op = indexed_file_op(&["php".to_string(), "phpt".to_string()]);
    let globs: Vec<&str> = op.filters.iter().map(|f| f.pattern.glob.as_str()).collect();
    assert_eq!(globs, vec!["**/*.php", "**/*.phpt"]);
}

#[test]
fn has_indexed_extension_matches_configured_extensions_only() {
    let exts = vec!["php".to_string(), "phpt".to_string()];
    assert!(has_indexed_extension("/src/Foo.php", &exts));
    assert!(has_indexed_extension("/tests/bug12345.phpt", &exts));
    assert!(!has_indexed_extension("/AGENTS.md", &exts));
}

// Uri regression tests (url::Url -> ls_types::Uri migration; the new Uri
// wraps fluent_uri, strict RFC 3986, instead of WHATWG-style url::Url)
#[test]
fn uri_from_file_path_wire_string_roundtrips_for_space_and_unicode_paths() {
    // A Uri's own wire-format string (what the server actually sends the
    // client, e.g. in a `definition` response) must parse back to an equal,
    // equally-hashable Uri — this is exactly the round trip a real editor
    // performs, and DocumentStore's Uri-keyed maps must recognize it as the
    // same file. Note: this parses the *percent-encoded* wire form, not a
    // raw path with an unencoded space — a real LSP client never sends the
    // latter (RFC 3986 requires encoding).
    let base = std::env::temp_dir();
    for path in [
        base.join("php-lsp test dir").join("Foo.php"),
        base.join("php-lsp-é-测试").join("Bar.php"),
        base.join("has spaces")
            .join("and-é-unicode")
            .join("Baz.php"),
    ] {
        let from_path = Uri::from_file_path(&path)
            .unwrap_or_else(|| panic!("from_file_path failed for {path:?}"));
        let wire_string = from_path.as_str().to_string();
        let parsed: Uri = wire_string
            .parse()
            .unwrap_or_else(|e| panic!("re-parsing {wire_string:?} (from {path:?}) failed: {e:?}"));
        assert_eq!(
            from_path, parsed,
            "Uri::from_file_path and re-parsing its own wire string disagree for {path:?}"
        );

        // Hash equality matters as much as `==`: DocumentStore's DashMap
        // relies on it to look up the same file regardless of which
        // construction path produced the key.
        let mut hasher_a = std::collections::hash_map::DefaultHasher::new();
        let mut hasher_b = std::collections::hash_map::DefaultHasher::new();
        std::hash::Hash::hash(&from_path, &mut hasher_a);
        std::hash::Hash::hash(&parsed, &mut hasher_b);
        assert_eq!(
            std::hash::Hasher::finish(&hasher_a),
            std::hash::Hasher::finish(&hasher_b),
            "hash mismatch between equal Uris for {path:?}"
        );
    }
}

#[test]
fn uri_to_file_path_roundtrips_space_and_unicode_paths() {
    // The two most common ways a percent-encoding bug would show up: a
    // project directory with a space (e.g. under "My Documents"), or with
    // accented/non-ASCII characters.
    let base = std::env::temp_dir();
    for path in [
        base.join("php-lsp test dir").join("Foo.php"),
        base.join("php-lsp-é-测试").join("Bar.php"),
    ] {
        let uri = Uri::from_file_path(&path)
            .unwrap_or_else(|| panic!("from_file_path failed for {path:?}"));
        let back = uri
            .to_file_path()
            .unwrap_or_else(|| panic!("to_file_path failed for {path:?}"));
        assert_eq!(
            back.as_ref(),
            path.as_path(),
            "round-trip mismatch for {path:?}"
        );
    }
}

// defer_actions tests
#[test]
fn defer_actions_strips_edit_and_adds_data() {
    let uri = ("file:///test.php").parse::<Uri>().unwrap();
    let range = Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 0,
            character: 5,
        },
    };
    let actions = vec![CodeActionOrCommand::CodeAction(CodeAction {
        title: "My Action".to_string(),
        kind: Some(CodeActionKind::REFACTOR),
        edit: Some(WorkspaceEdit::default()),
        data: None,
        ..Default::default()
    })];
    let deferred = defer_actions(actions, "test_kind", &uri, range);
    assert_eq!(deferred.len(), 1);
    if let CodeActionOrCommand::CodeAction(ca) = &deferred[0] {
        assert!(ca.edit.is_none(), "edit should be stripped");
        assert!(ca.data.is_some(), "data payload should be set");
        let data = ca.data.as_ref().unwrap();
        assert_eq!(data["php_lsp_resolve"], "test_kind");
        assert_eq!(data["uri"], uri.to_string());
    } else {
        panic!("expected CodeAction");
    }
}

// build_use_import_edit tests
#[test]
fn build_use_import_edit_inserts_after_php_tag() {
    let src = "<?php\nclass Foo {}";
    let uri = ("file:///test.php").parse::<Uri>().unwrap();
    let edit = build_use_import_edit(src, &uri, "App\\Services\\Bar");
    let changes = edit.changes.unwrap();
    let edits = changes.get(&uri).unwrap();
    assert_eq!(edits.len(), 1);
    assert_eq!(edits[0].new_text, "use App\\Services\\Bar;\n");
    assert_eq!(edits[0].range.start.line, 1);
}

#[test]
fn build_use_import_edit_inserts_after_existing_use() {
    let src = "<?php\nuse Foo\\Bar;\nclass Impl {}";
    let uri = ("file:///test.php").parse::<Uri>().unwrap();
    let edit = build_use_import_edit(src, &uri, "Baz\\Qux");
    let changes = edit.changes.unwrap();
    let edits = changes.get(&uri).unwrap();
    assert_eq!(edits[0].range.start.line, 2);
    assert_eq!(edits[0].new_text, "use Baz\\Qux;\n");
}

#[test]
fn undefined_function_message_not_matched_by_extraction() {
    // UndefinedFunction message format must NOT match the UndefinedClass extraction,
    // ensuring code action is not offered for undefined functions.
    let msg = "Function myHelper() is not defined";
    let name = msg
        .strip_prefix("Class ")
        .and_then(|s| s.strip_suffix(" does not exist"))
        .unwrap_or("")
        .trim();
    assert!(
        name.is_empty(),
        "function diagnostic should not extract a class name"
    );
}

#[test]
fn position_to_byte_offset_first_line() {
    let src = "<?php\nfoo();";
    // Character 0 → byte 0.
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 0,
                character: 0
            }
        ),
        Some(0)
    );
    // Character 4 → byte 4 (last char 'p' of "<?php").
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 0,
                character: 4
            }
        ),
        Some(4)
    );
    // Character 5 is past the end of "<?php" (5 chars) — clamps to line_content.len().
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 0,
                character: 5
            }
        ),
        Some(5)
    );
}

#[test]
fn position_to_byte_offset_second_line() {
    let src = "<?php\nfoo();";
    // Start of line 1 is byte 6 (after "<?php\n").
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 1,
                character: 0
            }
        ),
        Some(6)
    );
    // "foo" ends at character 3 → byte 9.
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 1,
                character: 3
            }
        ),
        Some(9)
    );
}

#[test]
fn position_to_byte_offset_line_boundary_returns_none() {
    // A source with exactly one line has only line 0; line 1 must return None.
    let src = "<?php";
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 1,
                character: 0
            }
        ),
        None
    );
    assert_eq!(
        position_to_byte_offset_strict(
            src,
            Position {
                line: 5,
                character: 0
            }
        ),
        None
    );
}

// --- LspConfig::merge_project_configs ---

#[test]
fn merge_file_only_uses_file_values() {
    let file = serde_json::json!({
        "phpVersion": "8.1",
        "excludePaths": ["vendor/*"],
        "maxIndexedFiles": 500,
    });
    let merged = LspConfig::merge_project_configs(Some(&file), None);
    let cfg = LspConfig::from_value(&merged);
    assert_eq!(cfg.php_version, Some("8.1".to_string()));
    assert_eq!(cfg.exclude_paths, vec!["vendor/*"]);
    assert_eq!(cfg.max_indexed_files, 500);
}

#[test]
fn merge_editor_wins_per_key_over_file() {
    let file = serde_json::json!({"phpVersion": "8.1", "maxIndexedFiles": 100});
    let editor = serde_json::json!({"phpVersion": "8.3", "maxIndexedFiles": 200});
    let merged = LspConfig::merge_project_configs(Some(&file), Some(&editor));
    let cfg = LspConfig::from_value(&merged);
    assert_eq!(cfg.php_version, Some("8.3".to_string()));
    assert_eq!(cfg.max_indexed_files, 200);
}

#[test]
fn merge_exclude_paths_concat_not_replace() {
    let file = serde_json::json!({"excludePaths": ["cache/*"]});
    let editor = serde_json::json!({"excludePaths": ["logs/*"]});
    let merged = LspConfig::merge_project_configs(Some(&file), Some(&editor));
    let cfg = LspConfig::from_value(&merged);
    // File entries come first, editor entries appended.
    assert_eq!(cfg.exclude_paths, vec!["cache/*", "logs/*"]);
}

#[test]
fn merge_include_paths_concat_not_replace() {
    let file = serde_json::json!({"includePaths": ["vendor/yiisoft"]});
    let editor = serde_json::json!({"includePaths": ["vendor/symfony"]});
    let merged = LspConfig::merge_project_configs(Some(&file), Some(&editor));
    let cfg = LspConfig::from_value(&merged);
    // File entries come first, editor entries appended.
    assert_eq!(cfg.include_paths, vec!["vendor/yiisoft", "vendor/symfony"]);
}

#[test]
fn merge_no_file_uses_editor_only() {
    let editor = serde_json::json!({"phpVersion": "8.2", "excludePaths": ["tmp/*"]});
    let merged = LspConfig::merge_project_configs(None, Some(&editor));
    let cfg = LspConfig::from_value(&merged);
    assert_eq!(cfg.php_version, Some("8.2".to_string()));
    assert_eq!(cfg.exclude_paths, vec!["tmp/*"]);
}

#[test]
fn merge_both_none_returns_defaults() {
    let merged = LspConfig::merge_project_configs(None, None);
    let cfg = LspConfig::from_value(&merged);
    assert!(cfg.php_version.is_none());
    assert!(cfg.exclude_paths.is_empty());
    assert_eq!(cfg.max_indexed_files, MAX_INDEXED_FILES);
}

#[test]
fn merge_file_editor_both_have_exclude_paths_all_present() {
    let file = serde_json::json!({"excludePaths": ["a/*", "b/*"]});
    let editor = serde_json::json!({"excludePaths": ["c/*"]});
    let merged = LspConfig::merge_project_configs(Some(&file), Some(&editor));
    let cfg = LspConfig::from_value(&merged);
    assert_eq!(cfg.exclude_paths, vec!["a/*", "b/*", "c/*"]);
}