Skip to content

Commit 6a025d1

Browse files
committed
[ty] Redact ranking of completions from e2e LSP tests
I think changes to this value are generally noise. It's hard to tell what it means and it isn't especially actionable. We already have an eval running in CI for completion ranking, so I don't think it's terribly important to care about ranking here in e2e tests _generally_.
1 parent f054e7e commit 6a025d1

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

crates/ty_server/tests/e2e/notebook.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use ty_server::ClientOptions;
55

66
use crate::{TestServer, TestServerBuilder};
77

8+
static FILTERS: &[(&str, &str)] = &[(r#""sortText": "[0-9 ]+""#, r#""sortText": "[RANKING]""#)];
9+
810
#[test]
911
fn publish_diagnostics_open() -> anyhow::Result<()> {
1012
let mut server = TestServerBuilder::new()?
@@ -309,7 +311,11 @@ b: Litera
309311

310312
let completions = literal_completions(&mut server, &second_cell, Position::new(1, 9));
311313

312-
assert_json_snapshot!(completions);
314+
insta::with_settings!({
315+
filters => FILTERS.iter().copied(),
316+
}, {
317+
assert_json_snapshot!(completions);
318+
});
313319

314320
Ok(())
315321
}
@@ -340,7 +346,11 @@ b: Litera
340346

341347
let completions = literal_completions(&mut server, &first_cell, Position::new(1, 9));
342348

343-
assert_json_snapshot!(completions);
349+
insta::with_settings!({
350+
filters => FILTERS.iter().copied(),
351+
}, {
352+
assert_json_snapshot!(completions);
353+
});
344354

345355
Ok(())
346356
}
@@ -373,7 +383,11 @@ b: Litera
373383

374384
let completions = literal_completions(&mut server, &second_cell, Position::new(1, 9));
375385

376-
assert_json_snapshot!(completions);
386+
insta::with_settings!({
387+
filters => FILTERS.iter().copied(),
388+
}, {
389+
assert_json_snapshot!(completions);
390+
});
377391

378392
Ok(())
379393
}
@@ -409,7 +423,11 @@ b: Litera
409423

410424
let completions = literal_completions(&mut server, &second_cell, Position::new(1, 9));
411425

412-
assert_json_snapshot!(completions);
426+
insta::with_settings!({
427+
filters => FILTERS.iter().copied(),
428+
}, {
429+
assert_json_snapshot!(completions);
430+
});
413431

414432
Ok(())
415433
}

crates/ty_server/tests/e2e/snapshots/e2e__notebook__auto_import.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ expression: completions
66
{
77
"label": "Literal (import typing)",
88
"kind": 6,
9-
"sortText": " 35",
9+
"sortText": "[RANKING]",
1010
"insertText": "Literal",
1111
"additionalTextEdits": [
1212
{
@@ -27,7 +27,7 @@ expression: completions
2727
{
2828
"label": "LiteralString (import typing)",
2929
"kind": 6,
30-
"sortText": " 36",
30+
"sortText": "[RANKING]",
3131
"insertText": "LiteralString",
3232
"additionalTextEdits": [
3333
{

crates/ty_server/tests/e2e/snapshots/e2e__notebook__auto_import_docstring.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ expression: completions
66
{
77
"label": "Literal (import typing)",
88
"kind": 6,
9-
"sortText": " 35",
9+
"sortText": "[RANKING]",
1010
"insertText": "Literal",
1111
"additionalTextEdits": [
1212
{
@@ -27,7 +27,7 @@ expression: completions
2727
{
2828
"label": "LiteralString (import typing)",
2929
"kind": 6,
30-
"sortText": " 36",
30+
"sortText": "[RANKING]",
3131
"insertText": "LiteralString",
3232
"additionalTextEdits": [
3333
{

crates/ty_server/tests/e2e/snapshots/e2e__notebook__auto_import_from_future.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ expression: completions
66
{
77
"label": "Literal (import typing)",
88
"kind": 6,
9-
"sortText": " 35",
9+
"sortText": "[RANKING]",
1010
"insertText": "Literal",
1111
"additionalTextEdits": [
1212
{
@@ -27,7 +27,7 @@ expression: completions
2727
{
2828
"label": "LiteralString (import typing)",
2929
"kind": 6,
30-
"sortText": " 36",
30+
"sortText": "[RANKING]",
3131
"insertText": "LiteralString",
3232
"additionalTextEdits": [
3333
{

crates/ty_server/tests/e2e/snapshots/e2e__notebook__auto_import_same_cell.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ expression: completions
66
{
77
"label": "Literal (import typing)",
88
"kind": 6,
9-
"sortText": " 35",
9+
"sortText": "[RANKING]",
1010
"insertText": "Literal",
1111
"additionalTextEdits": [
1212
{
@@ -27,7 +27,7 @@ expression: completions
2727
{
2828
"label": "LiteralString (import typing)",
2929
"kind": 6,
30-
"sortText": " 36",
30+
"sortText": "[RANKING]",
3131
"insertText": "LiteralString",
3232
"additionalTextEdits": [
3333
{

0 commit comments

Comments
 (0)