@@ -215,19 +215,19 @@ export interface BuildLanguageClientOption extends LanguageServerConfig {
215
215
// used in building a new LanguageClient instance. Options specified
216
216
// in LanguageServerConfig
217
217
function buildLanguageClientOption ( cfg : LanguageServerConfig ) : BuildLanguageClientOption {
218
- // Reuse the same output channel for each instance of the server.
219
- if ( cfg . enabled ) {
220
- if ( ! serverOutputChannel ) {
221
- serverOutputChannel = vscode . window . createOutputChannel ( cfg . serverName + ' (server)' ) ;
222
- }
223
- if ( ! serverTraceChannel ) {
224
- serverTraceChannel = vscode . window . createOutputChannel ( cfg . serverName ) ;
225
- }
218
+ // Reuse the same output channel for each instance of the server.
219
+ if ( cfg . enabled ) {
220
+ if ( ! serverOutputChannel ) {
221
+ serverOutputChannel = vscode . window . createOutputChannel ( cfg . serverName + ' (server)' ) ;
222
+ }
223
+ if ( ! serverTraceChannel ) {
224
+ serverTraceChannel = vscode . window . createOutputChannel ( cfg . serverName ) ;
226
225
}
227
- return Object . assign ( {
228
- outputChannel : serverOutputChannel ,
229
- traceOutputChannel : serverTraceChannel
230
- } , cfg ) ;
226
+ }
227
+ return Object . assign ( {
228
+ outputChannel : serverOutputChannel ,
229
+ traceOutputChannel : serverTraceChannel
230
+ } , cfg ) ;
231
231
}
232
232
233
233
// buildLanguageClient returns a language client built using the given language server config.
@@ -1128,6 +1128,17 @@ async function suggestGoplsIssueReport(msg: string, reason: errorKind) {
1128
1128
return ;
1129
1129
}
1130
1130
1131
+ // The user may have an outdated version of gopls, in which case we should
1132
+ // just prompt them to update, not file an issue.
1133
+ const tool = getTool ( 'gopls' ) ;
1134
+ if ( tool ) {
1135
+ const versionToUpdate = await shouldUpdateLanguageServer ( tool , latestConfig ) ;
1136
+ if ( versionToUpdate ) {
1137
+ promptForUpdatingTool ( tool . name , versionToUpdate , true ) ;
1138
+ return ;
1139
+ }
1140
+ }
1141
+
1131
1142
// Show the user the output channel content to alert them to the issue.
1132
1143
serverOutputChannel . show ( ) ;
1133
1144
@@ -1165,8 +1176,8 @@ You will be asked to provide additional information and logs, so PLEASE READ THE
1165
1176
errKind = 'initialization' ;
1166
1177
break ;
1167
1178
}
1179
+ // Get the user's version in case the update prompt above failed.
1168
1180
const usersGoplsVersion = await getLocalGoplsVersion ( latestConfig ) ;
1169
- // TODO(hakim): If gopls version is too old, ask users to update it.
1170
1181
const settings = latestConfig . flags . join ( ' ' ) ;
1171
1182
const title = `gopls: automated issue report (${ errKind } )` ;
1172
1183
const sanitizedLog = collectGoplsLog ( ) ;
@@ -1258,7 +1269,7 @@ export function showServerOutputChannel() {
1258
1269
}
1259
1270
found = doc ;
1260
1271
// .log, as some decoration is better than none
1261
- vscode . workspace . openTextDocument ( { language : 'log' , content : contents } ) ;
1272
+ vscode . workspace . openTextDocument ( { language : 'log' , content : contents } ) ;
1262
1273
}
1263
1274
}
1264
1275
if ( found === undefined ) {
0 commit comments