Skip to content

Commit 8c27f29

Browse files
h9jianggopherbot
authored andcommitted
extension/src: remove unused input gopls config parameter
Change-Id: I640dc6a999a4ed58ef740edf4cb67b22a8b94f85 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/713201 Reviewed-by: Madeline Kalil <[email protected]> Auto-Submit: Hongxiang Jiang <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent ddae161 commit 8c27f29

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

extension/src/commands/getConfiguredGoTools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as vscode from 'vscode';
77
import path from 'path';
88

99
import { CommandFactory } from '.';
10-
import { getGoConfig, getGoplsConfig } from '../config';
10+
import { getGoConfig } from '../config';
1111
import { inspectGoToolVersion } from '../goInstallTools';
1212
import { getConfiguredTools } from '../goTools';
1313
import { getBinPath, getCurrentGoPath, getGoEnv, getGoVersion, getToolsGopath } from '../util';
@@ -40,7 +40,7 @@ export const getConfiguredGoTools: CommandFactory = () => {
4040
buf.push('\n## Tools\n');
4141
try {
4242
const goVersion = await getGoVersion();
43-
const allTools = getConfiguredTools(getGoConfig(), getGoplsConfig());
43+
const allTools = getConfiguredTools(getGoConfig());
4444
const goVersionTooOld = goVersion?.lt('1.18') || false;
4545

4646
buf.push(`\tgo:\t${goVersion?.binaryPath}: ${goVersion?.version}`);

extension/src/goExplorer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import vscode = require('vscode');
66
import vscodeUri = require('vscode-uri');
77
import os = require('os');
88
import path = require('path');
9-
import { getGoConfig, getGoplsConfig } from './config';
9+
import { getGoConfig } from './config';
1010
import { getBinPath } from './util';
1111
import { getConfiguredTools } from './goTools';
1212
import { inspectGoToolVersion } from './goInstallTools';
@@ -159,7 +159,7 @@ export class GoExplorerProvider implements vscode.TreeDataProvider<vscode.TreeIt
159159
}
160160

161161
private async toolTreeItems() {
162-
const allTools = getConfiguredTools(getGoConfig(), getGoplsConfig());
162+
const allTools = getConfiguredTools(getGoConfig());
163163
const toolsInfo = await Promise.all(allTools.map((tool) => this.toolDetailCache.get(tool.name)));
164164
const items = [];
165165
for (const t of toolsInfo) {

extension/src/goInstallTools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const defaultToolsManager: IToolsManager = {
7171

7272
export async function installAllTools(updateExistingToolsOnly = false) {
7373
const goVersion = await getGoVersion();
74-
let allTools = getConfiguredTools(getGoConfig(), getGoplsConfig());
74+
let allTools = getConfiguredTools(getGoConfig());
7575

7676
// exclude tools replaced by alternateTools.
7777
const alternateTools: { [key: string]: string } = getGoConfig().get('alternateTools') ?? {};
@@ -701,7 +701,7 @@ async function updateImportantToolsStatus(tm: IToolsManager = defaultToolsManage
701701
* If matcher is provided, only the tools that match the filter will be checked.
702702
*/
703703
function getMissingTools(matcher?: (value: Tool) => boolean): Promise<Tool[]> {
704-
let keys = getConfiguredTools(getGoConfig(), getGoplsConfig());
704+
let keys = getConfiguredTools(getGoConfig());
705705
if (matcher) {
706706
keys = keys.filter(matcher);
707707
}
@@ -883,7 +883,7 @@ export async function suggestUpdates() {
883883
return;
884884
}
885885

886-
const allTools = getConfiguredTools(getGoConfig(), getGoplsConfig());
886+
const allTools = getConfiguredTools(getGoConfig());
887887
const toolsToUpdate = await listOutdatedTools(configuredGoVersion, allTools);
888888
if (toolsToUpdate.length === 0) {
889889
return;

extension/src/goTools.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ export function hasModSuffix(tool: Tool): boolean {
111111
return tool.name.endsWith('-gomod');
112112
}
113113

114-
export function getConfiguredTools(
115-
goConfig: vscode.WorkspaceConfiguration,
116-
goplsConfig: vscode.WorkspaceConfiguration
117-
): Tool[] {
114+
export function getConfiguredTools(goConfig: vscode.WorkspaceConfiguration): Tool[] {
118115
// If language server is enabled, don't suggest tools that are replaced by gopls.
119116
// TODO(github.com/golang/vscode-go/issues/388): decide what to do when
120117
// the go version is no longer supported by gopls while the legacy tools are

extension/test/integration/goExplorer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import assert from 'assert';
77
import path from 'path';
88
import { TreeItem, Uri, window, workspace } from 'vscode';
9-
import { getGoConfig, getGoplsConfig } from '../../src/config';
9+
import { getGoConfig } from '../../src/config';
1010

1111
import { GoExplorerProvider } from '../../src/goExplorer';
1212
import { getConfiguredTools } from '../../src/goTools';
@@ -68,7 +68,7 @@ suite('GoExplorerProvider', () => {
6868
});
6969

7070
test('tools tree items', async () => {
71-
const allTools = getConfiguredTools(getGoConfig(), getGoplsConfig());
71+
const allTools = getConfiguredTools(getGoConfig());
7272
const expectTools = allTools.map((t) => t.name);
7373
const [, tools] = await explorer.getChildren()!;
7474
const items = (await explorer.getChildren(tools)) as TreeItem[];

extension/test/integration/install.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import vscode = require('vscode');
2929
import { allToolsInformation } from '../../src/goToolsInformation';
3030
import * as goInstallTools from '../../src/goInstallTools';
3131
import * as utilModule from '../../src/util';
32-
import { getGoConfig, getGoplsConfig } from '../../src/config';
32+
import { getGoConfig } from '../../src/config';
3333
import { MockWorkspaceConfiguration } from './mocks/configuration';
3434

3535
interface installationTestCase {
@@ -361,8 +361,7 @@ suite('getConfiguredTools', () => {
361361
new MockWorkspaceConfiguration(
362362
getGoConfig(),
363363
new Map<string, any>([['useLanguageServer', true]])
364-
),
365-
new MockWorkspaceConfiguration(getGoplsConfig())
364+
)
366365
);
367366
const got = configured.map((tool) => tool.name) ?? [];
368367
assert(got.includes('gopls'), `omitted 'gopls': ${JSON.stringify(got)}`);
@@ -373,8 +372,7 @@ suite('getConfiguredTools', () => {
373372
new MockWorkspaceConfiguration(
374373
getGoConfig(),
375374
new Map<string, any>([['useLanguageServer', false]])
376-
),
377-
new MockWorkspaceConfiguration(getGoplsConfig())
375+
)
378376
);
379377
const got = configured.map((tool) => tool.name) ?? [];
380378
assert(!got.includes('gopls'), `suggested 'gopls': ${JSON.stringify(got)}`);

0 commit comments

Comments
 (0)