Skip to content

Commit

Permalink
Add workspace directories to debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
bstaletic committed Jan 27, 2024
1 parent 99807ef commit 9ee0241
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ycmd/completers/language_server/language_server_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2948,6 +2948,8 @@ def ServerStateDescription():
ServerStateDescription() ),
responses.DebugInfoItem( 'Project Directory',
self._project_directory ),
responses.DebugInfoItem( 'Open Workspaces',
self._server_workspace_dirs ),
responses.DebugInfoItem(
'Settings',
json.dumps( self._settings.get( 'ls', {} ),
Expand Down
40 changes: 40 additions & 0 deletions ycmd/tests/clangd/debug_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def test_DebugInfo_NotInitialized( self, app ):
'key': 'Project Directory',
'value': None,
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -95,6 +99,10 @@ def test_DebugInfo_Initialized( self, app ):
'key': 'Project Directory',
'value': PathToTestFile(),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -134,6 +142,10 @@ def test_DebugInfo_ExtraConf_ReturningFlags( self, app ):
'key': 'Project Directory',
'value': PathToTestFile( 'extra_conf' ),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -174,6 +186,10 @@ def test_DebugInfo_ExtraConf_NotReturningFlags( self, app ):
'key': 'Project Directory',
'value': PathToTestFile( 'extra_conf' ),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -216,6 +232,10 @@ def test_DebugInfo_ExtraConf_Global( self, app ):
'key': 'Project Directory',
'value': PathToTestFile(),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -259,6 +279,10 @@ def test_DebugInfo_ExtraConf_LocalOverGlobal( self, app ):
'key': 'Project Directory',
'value': PathToTestFile( 'extra_conf' ),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -308,6 +332,10 @@ def test_DebugInfo_ExtraConf_Database( self, app ):
'key': 'Project Directory',
'value': tmp_dir,
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -365,6 +393,10 @@ def Settings( **kwargs ):
'key': 'Project Directory',
'value': tmp_dir,
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -419,6 +451,10 @@ def test_DebugInfo_ExtraConf_UseDatabaseOverGlobal( self, app ):
'key': 'Project Directory',
'value': tmp_dir,
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down Expand Up @@ -459,6 +495,10 @@ def test_DebugInfo_ExtraConf_MacIncludeFlags( self, app ):
'key': 'Project Directory',
'value': PathToTestFile( 'extra_conf' ),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}',
Expand Down
9 changes: 9 additions & 0 deletions ycmd/tests/go/debug_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
contains_exactly,
has_entries,
has_entry,
has_items,
instance_of,
is_not,
empty )
Expand Down Expand Up @@ -60,6 +61,10 @@ def test_DebugInfo( self, app ):
'key': 'Project Directory',
'value': PathToTestFile(),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': is_json_string_matching( has_entries( {
Expand Down Expand Up @@ -102,6 +107,10 @@ def test_DebugInfo_ProjectDirectory( self, app ):
'key': 'Project Directory',
'value': PathToTestFile(),
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': is_json_string_matching( has_entries( {
Expand Down
8 changes: 8 additions & 0 deletions ycmd/tests/java/debug_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def test_DebugInfo( self, app ):
'key': 'Project Directory',
'value': PathToTestFile( 'simple_eclipse_project' )
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': json.dumps(
Expand Down Expand Up @@ -159,6 +163,10 @@ def test_DebugInfo_ExtraConf_SettingsValid( self, app ):
'value': PathToTestFile( 'extra_confs',
'simple_extra_conf_project' )
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': json.dumps(
Expand Down
17 changes: 15 additions & 2 deletions ycmd/tests/rust/debug_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with ycmd. If not, see <http://www.gnu.org/licenses/>.

from hamcrest import ( assert_that, contains_exactly, has_entries, has_entry,
instance_of, none )
from hamcrest import ( assert_that,
contains_exactly,
has_entries,
has_entry,
has_items,
instance_of,
none )
from unittest.mock import patch
from unittest import TestCase
from ycmd.tests.rust import setUpModule, tearDownModule # noqa
Expand Down Expand Up @@ -52,6 +57,10 @@ def test_DebugInfo_RlsVersion( self, app ):
'key': 'Project Directory',
'value': instance_of( str )
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}'
Expand Down Expand Up @@ -103,6 +112,10 @@ def test_DebugInfo_NoRlsVersion( self, app, *args ):
'key': 'Project Directory',
'value': instance_of( str )
} ),
has_entries( {
'key': 'Open Workspaces',
'value': has_items()
} ),
has_entries( {
'key': 'Settings',
'value': '{}'
Expand Down

0 comments on commit 9ee0241

Please sign in to comment.