Skip to content

Commit adce5d8

Browse files
authored
Merge pull request #1714 from bstaletic/clangd-touch-up
Minor clangd completer fixes
2 parents e755af6 + c102680 commit adce5d8

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ycmd/completers/cpp/clangd_completer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ def GetCustomSubcommands( self ):
313313

314314

315315
def GoToAlternateFile( self, request_data ):
316+
if not self.ServerIsReady():
317+
raise RuntimeError( 'Server is initializing. Please wait.' )
318+
316319
request_id = self.GetConnection().NextRequestId()
317320
uri = lsp.FilePathToUri( request_data[ 'filepath' ] )
318321
request = lsp.BuildRequest( request_id,

ycmd/completers/language_server/language_server_completer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,6 +2843,9 @@ def ResolveFixit( self, request_data ):
28432843

28442844

28452845
def ExecuteCommand( self, request_data, args ):
2846+
if not self.ServerIsReady():
2847+
raise RuntimeError( 'Server is initializing. Please wait.' )
2848+
28462849
if not args:
28472850
raise ValueError( 'Must specify a command to execute' )
28482851

ycmd/tests/clangd/subcommands_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ def test_Subcommands_DefinedSubcommands( self, app ):
606606
@SharedYcmd
607607
def test_Subcommands_ServerNotInitialized( self, app ):
608608
for cmd in [
609+
'ExecuteCommand',
609610
'FixIt',
610611
'Format',
611612
'GetDoc',
@@ -617,10 +618,14 @@ def test_Subcommands_ServerNotInitialized( self, app ):
617618
'GoToCallers',
618619
'GoToDeclaration',
619620
'GoToDefinition',
620-
'GoToInclude',
621+
'GoToDocumentOutline',
622+
'GoToImprecise',
621623
'GoToImplementation',
624+
'GoToInclude',
622625
'GoToReferences',
626+
'GoToType',
623627
'RefactorRename',
628+
'GoToAlternateFile',
624629
]:
625630
with self.subTest( cmd = cmd ):
626631
completer = handlers._server_state.GetFiletypeCompleter( [ 'cpp' ] )

0 commit comments

Comments
 (0)