All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 Describe lsp#uivim#code_lens
2 Describe lsp#ui#vim#code_lens#_get_subtitle
3 It should generate subtitle from response of rust-analyzer
4 " Example response of Code Lens extracted from #1118
11 \ 'cargoArgs': ['test', '--package', 'tmp', '--lib'],
12 \ 'cargoExtraArgs': [],
13 \ 'executableArgs': ['tests::it_works', '--exact', '--nocapture'],
14 \ 'overrideCargo': v:null,
15 \ 'workspaceRoot': '/tmp'
18 \ 'label': 'test tests::it_works',
20 \ 'targetRange': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}},
21 \ 'targetSelectionRange': {'end': {'character': 15, 'line': 12}, 'start': {'character': 7, 'line': 12}},
22 \ 'targetUri': 'file:////tmp/src/lib.rs'
26 \ 'command': 'rust-analyzer.runSingle',
27 \ 'title': '▶︎ Run Test'
29 \ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
31 \ 'server': 'rust-analyzer'
34 let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
35 Assert Equals(subtitle, ': test tests::it_works')
38 It should generate subtitle from multiple labels of command arguments
46 \ 'label': 'do command1',
52 \ 'label': 'do command2',
56 \ 'command': 'server.someCommand',
57 \ 'title': 'lens title'
59 \ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
61 \ 'server': 'rust-analyzer'
64 let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
65 Assert Equals(subtitle, ': do command1 > do command2')
68 It should return empty string when 'arguments' field is not found
72 \ 'command': 'server.someCommand',
73 \ 'title': 'lens title'
75 \ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
77 \ 'server': 'rust-analyzer'
80 let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
81 Assert Equals(subtitle, '')
84 It should return empty string when 'arguments' field is not an object
93 \ 'command': 'server.someCommand',
94 \ 'title': 'lens title'
96 \ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
98 \ 'server': 'rust-analyzer'
101 let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
102 Assert Equals(subtitle, '')
105 It should return empty string when at least one of elements in 'arguments' field does not have 'label' field
113 \ 'label': 'do command1',
122 \ 'command': 'server.someCommand',
123 \ 'title': 'lens title'
125 \ 'range': {'end': {'character': 5, 'line': 14}, 'start': {'character': 4, 'line': 11}}
127 \ 'server': 'rust-analyzer'
130 let subtitle = lsp#ui#vim#code_lens#_get_subtitle(item)
131 Assert Equals(subtitle, '')