Skip to content

Commit

Permalink
Upgrade gopls to version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Staletic committed Apr 17, 2020
1 parent 754dbd6 commit f666d38
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
11 changes: 6 additions & 5 deletions build.py
Expand Up @@ -840,12 +840,13 @@ def GetCsCompleterDataForPlatform():


def EnableGoCompleter( args ):
go = FindExecutableOrDie( 'go', 'go is required to build gocode.' )
go = FindExecutableOrDie( 'go', 'go is required to build gopls.' )

go_dir = p.join( DIR_OF_THIS_SCRIPT, 'third_party', 'go' )
os.chdir( p.join(
go_dir, 'src', 'golang.org', 'x', 'tools', 'gopls' ) )
CheckCall( [ go, 'build' ],
new_env = os.environ.copy()
new_env[ 'GO111MODULE' ] = 'on'
new_env[ 'GOPATH' ] = p.join( DIR_OF_THIS_SCRIPT, 'third_party', 'go' )
CheckCall( [ go, 'get', 'golang.org/x/tools/gopls@v0.4.0' ],
env = new_env,
quiet = args.quiet,
status_message = 'Building gopls for go completion' )

Expand Down
1 change: 0 additions & 1 deletion third_party/go/src/golang.org/x/tools
Submodule tools deleted from 23e62d
11 changes: 5 additions & 6 deletions ycmd/completers/go/go_completer.py
Expand Up @@ -30,11 +30,7 @@
'..',
'third_party',
'go',
'src',
'golang.org',
'x',
'tools',
'gopls',
'bin',
utils.ExecutableName( 'gopls' ) ) )


Expand All @@ -51,6 +47,7 @@ def ShouldEnableGoCompleter( user_options ):
class GoCompleter( language_server_completer.LanguageServerCompleter ):
def __init__( self, user_options ):
super().__init__( user_options )
self._user_supplied_gopls_args = user_options[ 'gopls_args' ]
self._gopls_path = utils.FindExecutableWithFallback(
user_options[ 'gopls_binary_path' ],
PATH_TO_GOPLS )
Expand All @@ -69,7 +66,9 @@ def GetProjectRootFiles( self ):


def GetCommandLine( self ):
cmdline = [ self._gopls_path, '-logfile', self._stderr_file ]
cmdline = [ self._gopls_path ] + self._user_supplied_gopls_args + [
'-logfile',
self._stderr_file ]
if utils.LOGGER.isEnabledFor( logging.DEBUG ):
cmdline.append( '-rpc.trace' )
return cmdline
Expand Down
1 change: 1 addition & 0 deletions ycmd/default_settings.json
Expand Up @@ -36,6 +36,7 @@
"clangd_uses_ycmd_caching": 1,
"disable_signature_help": 0,
"gopls_binary_path": "",
"gopls_args": [],
"rls_binary_path": "",
"rustc_binary_path": "",
"tsserver_binary_path": "",
Expand Down

0 comments on commit f666d38

Please sign in to comment.