Skip to content

Commit

Permalink
Merge pull request #1714 from bstaletic/clangd-touch-up
Browse files Browse the repository at this point in the history
Minor clangd completer fixes
  • Loading branch information
mergify[bot] authored Oct 6, 2023
2 parents e755af6 + c102680 commit adce5d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ycmd/completers/cpp/clangd_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ def GetCustomSubcommands( self ):


def GoToAlternateFile( self, request_data ):
if not self.ServerIsReady():
raise RuntimeError( 'Server is initializing. Please wait.' )

request_id = self.GetConnection().NextRequestId()
uri = lsp.FilePathToUri( request_data[ 'filepath' ] )
request = lsp.BuildRequest( request_id,
Expand Down
3 changes: 3 additions & 0 deletions ycmd/completers/language_server/language_server_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2843,6 +2843,9 @@ def ResolveFixit( self, request_data ):


def ExecuteCommand( self, request_data, args ):
if not self.ServerIsReady():
raise RuntimeError( 'Server is initializing. Please wait.' )

if not args:
raise ValueError( 'Must specify a command to execute' )

Expand Down
7 changes: 6 additions & 1 deletion ycmd/tests/clangd/subcommands_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ def test_Subcommands_DefinedSubcommands( self, app ):
@SharedYcmd
def test_Subcommands_ServerNotInitialized( self, app ):
for cmd in [
'ExecuteCommand',
'FixIt',
'Format',
'GetDoc',
Expand All @@ -617,10 +618,14 @@ def test_Subcommands_ServerNotInitialized( self, app ):
'GoToCallers',
'GoToDeclaration',
'GoToDefinition',
'GoToInclude',
'GoToDocumentOutline',
'GoToImprecise',
'GoToImplementation',
'GoToInclude',
'GoToReferences',
'GoToType',
'RefactorRename',
'GoToAlternateFile',
]:
with self.subTest( cmd = cmd ):
completer = handlers._server_state.GetFiletypeCompleter( [ 'cpp' ] )
Expand Down

0 comments on commit adce5d8

Please sign in to comment.