Skip to content

Commit 362460f

Browse files
committed
Add workspace directories to debug info
1 parent 00acd20 commit 362460f

File tree

6 files changed

+90
-2
lines changed

6 files changed

+90
-2
lines changed

ycmd/completers/language_server/language_server_completer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,6 +2961,8 @@ def ServerStateDescription():
29612961
ServerStateDescription() ),
29622962
responses.DebugInfoItem( 'Project Directory',
29632963
self._project_directory ),
2964+
responses.DebugInfoItem( 'Open Workspaces',
2965+
self._server_workspace_dirs ),
29642966
responses.DebugInfoItem(
29652967
'Settings',
29662968
json.dumps( self._settings.get( 'ls', {} ),

ycmd/tests/clangd/debug_info_test.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def test_DebugInfo_NotInitialized( self, app ):
5858
'key': 'Project Directory',
5959
'value': None,
6060
} ),
61+
has_entries( {
62+
'key': 'Open Workspaces',
63+
'value': has_items()
64+
} ),
6165
has_entries( {
6266
'key': 'Settings',
6367
'value': '{}',
@@ -95,6 +99,10 @@ def test_DebugInfo_Initialized( self, app ):
9599
'key': 'Project Directory',
96100
'value': PathToTestFile(),
97101
} ),
102+
has_entries( {
103+
'key': 'Open Workspaces',
104+
'value': has_items()
105+
} ),
98106
has_entries( {
99107
'key': 'Settings',
100108
'value': '{}',
@@ -134,6 +142,10 @@ def test_DebugInfo_ExtraConf_ReturningFlags( self, app ):
134142
'key': 'Project Directory',
135143
'value': PathToTestFile( 'extra_conf' ),
136144
} ),
145+
has_entries( {
146+
'key': 'Open Workspaces',
147+
'value': has_items()
148+
} ),
137149
has_entries( {
138150
'key': 'Settings',
139151
'value': '{}',
@@ -174,6 +186,10 @@ def test_DebugInfo_ExtraConf_NotReturningFlags( self, app ):
174186
'key': 'Project Directory',
175187
'value': PathToTestFile( 'extra_conf' ),
176188
} ),
189+
has_entries( {
190+
'key': 'Open Workspaces',
191+
'value': has_items()
192+
} ),
177193
has_entries( {
178194
'key': 'Settings',
179195
'value': '{}',
@@ -216,6 +232,10 @@ def test_DebugInfo_ExtraConf_Global( self, app ):
216232
'key': 'Project Directory',
217233
'value': PathToTestFile(),
218234
} ),
235+
has_entries( {
236+
'key': 'Open Workspaces',
237+
'value': has_items()
238+
} ),
219239
has_entries( {
220240
'key': 'Settings',
221241
'value': '{}',
@@ -259,6 +279,10 @@ def test_DebugInfo_ExtraConf_LocalOverGlobal( self, app ):
259279
'key': 'Project Directory',
260280
'value': PathToTestFile( 'extra_conf' ),
261281
} ),
282+
has_entries( {
283+
'key': 'Open Workspaces',
284+
'value': has_items()
285+
} ),
262286
has_entries( {
263287
'key': 'Settings',
264288
'value': '{}',
@@ -308,6 +332,10 @@ def test_DebugInfo_ExtraConf_Database( self, app ):
308332
'key': 'Project Directory',
309333
'value': tmp_dir,
310334
} ),
335+
has_entries( {
336+
'key': 'Open Workspaces',
337+
'value': has_items()
338+
} ),
311339
has_entries( {
312340
'key': 'Settings',
313341
'value': '{}',
@@ -365,6 +393,10 @@ def Settings( **kwargs ):
365393
'key': 'Project Directory',
366394
'value': tmp_dir,
367395
} ),
396+
has_entries( {
397+
'key': 'Open Workspaces',
398+
'value': has_items()
399+
} ),
368400
has_entries( {
369401
'key': 'Settings',
370402
'value': '{}',
@@ -419,6 +451,10 @@ def test_DebugInfo_ExtraConf_UseDatabaseOverGlobal( self, app ):
419451
'key': 'Project Directory',
420452
'value': tmp_dir,
421453
} ),
454+
has_entries( {
455+
'key': 'Open Workspaces',
456+
'value': has_items()
457+
} ),
422458
has_entries( {
423459
'key': 'Settings',
424460
'value': '{}',
@@ -459,6 +495,10 @@ def test_DebugInfo_ExtraConf_MacIncludeFlags( self, app ):
459495
'key': 'Project Directory',
460496
'value': PathToTestFile( 'extra_conf' ),
461497
} ),
498+
has_entries( {
499+
'key': 'Open Workspaces',
500+
'value': has_items()
501+
} ),
462502
has_entries( {
463503
'key': 'Settings',
464504
'value': '{}',

ycmd/tests/go/debug_info_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
contains_exactly,
2020
has_entries,
2121
has_entry,
22+
has_items,
2223
instance_of,
2324
is_not,
2425
empty )
@@ -60,6 +61,10 @@ def test_DebugInfo( self, app ):
6061
'key': 'Project Directory',
6162
'value': PathToTestFile(),
6263
} ),
64+
has_entries( {
65+
'key': 'Open Workspaces',
66+
'value': has_items()
67+
} ),
6368
has_entries( {
6469
'key': 'Settings',
6570
'value': is_json_string_matching( has_entries( {
@@ -102,6 +107,10 @@ def test_DebugInfo_ProjectDirectory( self, app ):
102107
'key': 'Project Directory',
103108
'value': PathToTestFile(),
104109
} ),
110+
has_entries( {
111+
'key': 'Open Workspaces',
112+
'value': has_items()
113+
} ),
105114
has_entries( {
106115
'key': 'Settings',
107116
'value': is_json_string_matching( has_entries( {

ycmd/tests/java/debug_info_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ def test_DebugInfo( self, app ):
103103
'key': 'Project Directory',
104104
'value': PathToTestFile( 'simple_eclipse_project' )
105105
} ),
106+
has_entries( {
107+
'key': 'Open Workspaces',
108+
'value': has_items()
109+
} ),
106110
has_entries( {
107111
'key': 'Settings',
108112
'value': json.dumps(
@@ -159,6 +163,10 @@ def test_DebugInfo_ExtraConf_SettingsValid( self, app ):
159163
'value': PathToTestFile( 'extra_confs',
160164
'simple_extra_conf_project' )
161165
} ),
166+
has_entries( {
167+
'key': 'Open Workspaces',
168+
'value': has_items()
169+
} ),
162170
has_entries( {
163171
'key': 'Settings',
164172
'value': json.dumps(

ycmd/tests/language_server/generic_completer_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ def test_GenericLSPCompleter_DebugInfo_TCP( self, app ):
208208
'key': 'Project Directory',
209209
'value': PathToTestFile( 'generic_server' ),
210210
} ),
211+
has_entries( {
212+
'key': 'Open Workspaces',
213+
'value': has_items(),
214+
} ),
211215
has_entries( {
212216
'key': 'Settings',
213217
'value': '{}'
@@ -256,6 +260,10 @@ def test_GenericLSPCompleter_DebugInfo_TCP_GeneratePort( self, app ):
256260
'key': 'Project Directory',
257261
'value': PathToTestFile( 'generic_server' ),
258262
} ),
263+
has_entries( {
264+
'key': 'Open Workspaces',
265+
'value': has_items(),
266+
} ),
259267
has_entries( {
260268
'key': 'Settings',
261269
'value': '{}'
@@ -309,6 +317,10 @@ def test_GenericLSPCompleter_ConnectTimeout( self, app ):
309317
'key': 'Project Directory',
310318
'value': None,
311319
} ),
320+
has_entries( {
321+
'key': 'Open Workspaces',
322+
'value': has_items(),
323+
} ),
312324
has_entries( {
313325
'key': 'Settings',
314326
'value': '{}'
@@ -510,6 +522,10 @@ def test_GenericLSPCompleter_DebugInfo_CustomRoot( self, app, *args ):
510522
'key': 'Project Directory',
511523
'value': PathToTestFile( 'generic_server', 'foo' ),
512524
} ),
525+
has_entries( {
526+
'key': 'Open Workspaces',
527+
'value': has_items(),
528+
} ),
513529
has_entries( {
514530
'key': 'Settings',
515531
'value': '{}'

ycmd/tests/rust/debug_info_test.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with ycmd. If not, see <http://www.gnu.org/licenses/>.
1717

18-
from hamcrest import ( assert_that, contains_exactly, has_entries, has_entry,
19-
instance_of, none )
18+
from hamcrest import ( assert_that,
19+
contains_exactly,
20+
has_entries,
21+
has_entry,
22+
has_items,
23+
instance_of,
24+
none )
2025
from unittest.mock import patch
2126
from unittest import TestCase
2227
from ycmd.tests.rust import setUpModule, tearDownModule # noqa
@@ -52,6 +57,10 @@ def test_DebugInfo_RlsVersion( self, app ):
5257
'key': 'Project Directory',
5358
'value': instance_of( str )
5459
} ),
60+
has_entries( {
61+
'key': 'Open Workspaces',
62+
'value': has_items()
63+
} ),
5564
has_entries( {
5665
'key': 'Settings',
5766
'value': '{}'
@@ -103,6 +112,10 @@ def test_DebugInfo_NoRlsVersion( self, app, *args ):
103112
'key': 'Project Directory',
104113
'value': instance_of( str )
105114
} ),
115+
has_entries( {
116+
'key': 'Open Workspaces',
117+
'value': has_items()
118+
} ),
106119
has_entries( {
107120
'key': 'Settings',
108121
'value': '{}'

0 commit comments

Comments
 (0)