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
|
# The mouse chord and the two introspection builtins.
#
# Ctrl-left-click IS `gd`. It rides the ordinary left-click drag rather than
# firing on the press, because a click does not place the modal cursor until
# RELEASE — asking at press time would answer about wherever the cursor
# happened to be sitting, which is the bug this test would not have caught.
#
# `SPC l w` and `SPC l i` exist because this backend never fails loudly: a
# thrown analyser must not take the editor with it, but that makes a broken
# backend and a correct one that found nothing look identical. These two tell
# them apart, so they are worth a test that proves they say something TRUE.
file z.zig const std = @import("std");\n\nfn helper() u32 {\n return 3;\n}\n\npub fn main() void {\n const v = helper();\n _ = v;\n}\n
start 44 120 z.zig
wait 8000 fn helper
stable 700 20000
snap opened
# Ctrl-click on the `helper` of the CALL (row 10 = file line 8, col 22 = the
# `h`). One definition, so it jumps rather than listing: the cursor lands on
# line 3, the `helper` of `fn helper()`, in this same pane.
press ctrl-left 22 10
release ctrl-left 22 10
stable 700 15000
snap ctrlclick
# A PLAIN left click in the same place must NOT jump — the modifier is the
# whole difference, and without this the test above would pass on a bug that
# made every click a goto.
press left 22 10
release left 22 10
stable 700 15000
snap plainclick
# `SPC l w` on a keyword: `gd` finds nothing there, and the point of Lspwhy is
# that it says WHY rather than leaving you with a no-op key. It narrates the
# real resolution path — the position context is the analyser's own answer,
# not a guess reconstructed beside it.
text 3gg1g|
stable 400 10000
key space
key l
key w
wait 10000 position context
stable 700 15000
snap why
# `SPC l i`: which ZLS, which stdlib, what it answers, and the query log —
# which by now holds the two gotos and the explain above, with their timings.
# It answers from any pane, including one with no file, because it is about
# the BACKEND.
key space
key l
key i
wait 10000 zls-inproc
stable 700 15000
snap info
|