@@ -62,6 +62,7 @@ import { URI } from 'vscode-uri';
62
62
import { IVulncheckTerminal , VulncheckReport , VulncheckTerminal , writeVulns } from '../goVulncheck' ;
63
63
import { createHash } from 'crypto' ;
64
64
import { GoExtensionContext } from '../context' ;
65
+ import { GoDocumentSelector } from '../goMode' ;
65
66
66
67
export interface LanguageServerConfig {
67
68
serverName : string ;
@@ -397,15 +398,6 @@ export async function buildLanguageClient(
397
398
await getLocalGoplsVersion ( cfg ) ; // populate and cache cfg.version
398
399
const goplsWorkspaceConfig = await adjustGoplsWorkspaceConfiguration ( cfg , getGoplsConfig ( ) , 'gopls' , undefined ) ;
399
400
400
- const documentSelector = [
401
- // gopls handles only file URIs.
402
- { language : 'go' , scheme : 'file' } ,
403
- { language : 'go.mod' , scheme : 'file' } ,
404
- { language : 'go.sum' , scheme : 'file' } ,
405
- { language : 'go.work' , scheme : 'file' } ,
406
- { language : 'gotmpl' , scheme : 'file' }
407
- ] ;
408
-
409
401
// when initialization is failed after the connection is established,
410
402
// we want to handle the connection close error case specially. Capture the error
411
403
// in initializationFailedHandler and handle it in the connectionCloseHandler.
@@ -425,7 +417,7 @@ export async function buildLanguageClient(
425
417
} as ServerOptions ,
426
418
{
427
419
initializationOptions : goplsWorkspaceConfig ,
428
- documentSelector,
420
+ documentSelector : GoDocumentSelector ,
429
421
uriConverters : {
430
422
// Apply file:/// scheme to all file paths.
431
423
code2Protocol : ( uri : vscode . Uri ) : string =>
0 commit comments