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#utils#workspace_config
3 Describe lsp#utils#workspace_config#get
4 It should return the workspace config, when it is a dict
5 let l:name = 'Unit Test Server'
7 call lsp#register_server({
9 \ 'workspace_config': {
16 \ 'b': 'path/to/file',
20 let l:config = lsp#utils#workspace_config#get(l:name)
22 Assert Equals(l:config['a']['a1'], v:true)
23 Assert Equals(l:config['a']['a2']['a21'], 'disabled')
24 Assert Equals(l:config['b'], 'path/to/file')
27 It should return the workspace config, produced by a callback
28 let l:name = 'Unit Test Server'
32 call lsp#register_server({
34 \ 'workspace_config': {server_info->l:callResult},
37 let l:config = lsp#utils#workspace_config#get(l:name)
38 Assert Equals(l:config, {})
50 let l:config = lsp#utils#workspace_config#get(l:name)
51 Assert Equals(l:config['a']['a1'], v:true)
52 Assert Equals(l:config['a']['a2']['a21'], 'disabled')
53 Assert Equals(l:config['b'], 'path/to/file')
57 Describe lsp#utils#workspace_config#project
58 It should return a projection of a dictionary
66 \ 'b': 'path/to/file',
69 let l:config_a_a1 = lsp#utils#workspace_config#projection(
71 \ { 'section': 'a.a1' },
73 let l:config_a_a2_a21 = lsp#utils#workspace_config#projection(
75 \ { 'section': 'a.a2.a21' },
77 let l:config_b = lsp#utils#workspace_config#projection(
81 let l:config_c = lsp#utils#workspace_config#projection(
86 Assert Equals(l:config_a_a1, v:true)
87 Assert Equals(l:config_a_a2_a21, 'disabled')
88 Assert Equals(l:config_b, 'path/to/file')
89 Assert Equals(l:config_c, v:null)
93 Describe lsp#utils#workspace_config#get_value
94 It should return a projection of the workspace config, when it is a dict
95 let l:name = 'Unit Test Server'
97 call lsp#register_server({
99 \ 'workspace_config': {
106 \ 'b': "path/to/file",
110 let l:config_a_a1 = lsp#utils#workspace_config#get_value(
112 \ { 'section': 'a.a1' },
114 let l:config_a_a2_a21 = lsp#utils#workspace_config#get_value(
116 \ { 'section': 'a.a2.a21' },
118 let l:config_b = lsp#utils#workspace_config#get_value(
120 \ { 'section': 'b' },
122 let l:config_c = lsp#utils#workspace_config#get_value(
124 \ { 'section': 'c' },
127 Assert Equals(l:config_a_a1, v:true)
128 Assert Equals(l:config_a_a2_a21, 'disabled')
129 Assert Equals(l:config_b, 'path/to/file')
130 Assert Equals(l:config_c, v:null)
133 It should return a projection of the workspace config, produced by a callback
134 let l:name = 'Unit Test Server'
136 let l:callResult = {}
138 call lsp#register_server({
140 \ 'workspace_config': {server_info->l:callResult},
143 let l:config = lsp#utils#workspace_config#get_value(
147 Assert Equals(l:config, {})
156 \ 'b': "path/to/file",
159 let l:config_a_a1 = lsp#utils#workspace_config#get_value(
161 \ { 'section': 'a.a1' },
163 let l:config_a_a2_a21 = lsp#utils#workspace_config#get_value(
165 \ { 'section': 'a.a2.a21' },
167 let l:config_b = lsp#utils#workspace_config#get_value(
169 \ { 'section': 'b' },
171 let l:config_c = lsp#utils#workspace_config#get_value(
173 \ { 'section': 'c' },
176 Assert Equals(l:config_a_a1, v:true)
177 Assert Equals(l:config_a_a2_a21, 'disabled')
178 Assert Equals(l:config_b, 'path/to/file')
179 Assert Equals(l:config_c, v:null)