From cd1ad4b43d5b6eb1e9604aae7458b520d78c27f5 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Sun, 20 Oct 2019 16:08:45 -0400 Subject: [PATCH] Use getGoConfig() utility (#2818) --- .vscode/launch.json | 1 + .vscode/settings.json | 2 +- src/goBuild.ts | 4 ++-- src/goCheck.ts | 4 ---- src/goCover.ts | 9 ++++----- src/goDebugConfiguration.ts | 4 ++-- src/goDeclaration.ts | 6 +++--- src/goExtraInfo.ts | 3 ++- src/goFormat.ts | 4 ++-- src/goGenerateTests.ts | 8 ++++---- src/goImplementations.ts | 4 ++-- src/goInstall.ts | 4 ++-- src/goInstallTools.ts | 8 ++++---- src/goLanguageServer.ts | 6 +++--- src/goLint.ts | 4 ++-- src/goLiveErrors.ts | 4 ++-- src/goMain.ts | 28 ++++++++++++++-------------- src/goModifytags.ts | 6 +++--- src/goModules.ts | 6 +++--- src/goOutline.ts | 4 ++-- src/goPlayground.ts | 4 ++-- src/goReferences.ts | 4 ++-- src/goReferencesCodelens.ts | 4 ++-- src/goRename.ts | 4 ++-- src/goRunTestCodelens.ts | 4 ++-- src/goSignature.ts | 5 ++--- src/goSuggest.ts | 6 +++--- src/goSymbol.ts | 6 +++--- src/goTypeDefinition.ts | 4 ++-- src/goVet.ts | 4 ++-- src/util.ts | 25 +++++++++++++++---------- test/integration/index.ts | 2 -- 32 files changed, 95 insertions(+), 96 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index d98016aede..481c0d9444 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -40,6 +40,7 @@ "runtimeExecutable": "${execPath}", // the workspace path should be GOPATH "args": [ + "--disable-extensions", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test/integration/index", "--timeout", diff --git a/.vscode/settings.json b/.vscode/settings.json index 90c81adbf4..a82d2ff2d3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,5 @@ "out/": true }, "editor.insertSpaces": false, - "typescript.tsdk": "node_modules\\typescript\\lib" + "typescript.tsdk": "node_modules\\typescript\\lib", } \ No newline at end of file diff --git a/src/goBuild.ts b/src/goBuild.ts index 083faca1c6..222837b088 100644 --- a/src/goBuild.ts +++ b/src/goBuild.ts @@ -11,7 +11,7 @@ import { getNonVendorPackages } from './goPackages'; import { getCurrentGoWorkspaceFromGOPATH } from './goPath'; import { diagnosticsStatusBarItem, outputChannel } from './goStatus'; import { getTestFlags } from './testUtils'; -import { getCurrentGoPath, getModuleCache, getTempFilePath, getToolsEnvVars, getWorkspaceFolderPath, handleDiagnosticErrors, ICheckResult, runTool } from './util'; +import { getCurrentGoPath, getGoConfig, getModuleCache, getTempFilePath, getToolsEnvVars, getWorkspaceFolderPath, handleDiagnosticErrors, ICheckResult, runTool } from './util'; /** * Builds current package or workspace. */ @@ -29,7 +29,7 @@ export function buildCode(buildWorkspace?: boolean) { } const documentUri = editor ? editor.document.uri : null; - const goConfig = vscode.workspace.getConfiguration('go', documentUri); + const goConfig = getGoConfig(documentUri); outputChannel.clear(); // Ensures stale output from build on save is cleared diagnosticsStatusBarItem.show(); diff --git a/src/goCheck.ts b/src/goCheck.ts index b3a9b9765b..8acd71caa9 100644 --- a/src/goCheck.ts +++ b/src/goCheck.ts @@ -35,10 +35,6 @@ export function notifyIfGeneratedFile(this: void, e: vscode.TextDocumentChangeEv if (e.document.isUntitled || e.document.languageId !== 'go') { return; } - - const documentUri = e ? e.document.uri : null; - const goConfig = vscode.workspace.getConfiguration('go', documentUri); - if ((ctx.globalState.get('ignoreGeneratedCodeWarning') !== true) && e.document.lineAt(0).text.match(/^\/\/ Code generated .* DO NOT EDIT\.$/)) { vscode.window.showWarningMessage('This file seems to be generated. DO NOT EDIT.', neverAgain).then(result => { if (result === neverAgain) { diff --git a/src/goCover.ts b/src/goCover.ts index 1ad24cc5ae..9e1b22015b 100644 --- a/src/goCover.ts +++ b/src/goCover.ts @@ -11,7 +11,7 @@ import fs = require('fs'); import rl = require('readline'); import { isModSupported } from './goModules'; import { getTestFlags, goTest, showTestOutput, TestConfig } from './testUtils'; -import { getTempFilePath } from './util'; +import { getGoConfig, getTempFilePath } from './util'; let gutterSvgs: { [key: string]: string }; let decorators: { @@ -51,9 +51,8 @@ export function initCoverageDecorators(ctx: vscode.ExtensionContext) { verticalyellow: ctx.asAbsolutePath('images/gutter-vertyellow.svg') }; - const editor = vscode.window.activeTextEditor; // Update the coverageDecorator in User config, if they are using the old style. - const goConfig = vscode.workspace.getConfiguration('go', editor ? editor.document.uri : null); + const goConfig = getGoConfig(); const inspectResult = goConfig.inspect('coverageDecorator'); if (typeof inspectResult.globalValue === 'string') { goConfig.update('coverageDecorator', { type: inspectResult.globalValue }, vscode.ConfigurationTarget.Global); @@ -239,7 +238,7 @@ export function applyCodeCoverage(editor: vscode.TextEditor) { return; } - const cfg = vscode.workspace.getConfiguration('go', editor.document.uri); + const cfg = getGoConfig(editor.document.uri); const coverageOptions = cfg['coverageOptions']; for (const filename in coverageFiles) { if (editor.document.uri.fsPath.endsWith(filename)) { @@ -293,7 +292,7 @@ export function toggleCoverageCurrentPackage() { return; } - const goConfig = vscode.workspace.getConfiguration('go', editor.document.uri); + const goConfig = getGoConfig(); const cwd = path.dirname(editor.document.uri.fsPath); const testFlags = getTestFlags(goConfig); diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index e76aaa6957..f0ce8df6c3 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -9,7 +9,7 @@ import vscode = require('vscode'); import path = require('path'); import { promptForMissingTool } from './goInstallTools'; import { getFromGlobalState, updateGlobalState } from './stateUtils'; -import { getBinPath, getCurrentGoPath, getToolsEnvVars, sendTelemetryEvent } from './util'; +import { getBinPath, getCurrentGoPath, getGoConfig, getToolsEnvVars, sendTelemetryEvent } from './util'; export class GoDebugConfigurationProvider implements vscode.DebugConfigurationProvider { @@ -69,7 +69,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr debugConfiguration['env']['GOPATH'] = gopath; } - const goConfig = vscode.workspace.getConfiguration('go', folder ? folder.uri : null); + const goConfig = getGoConfig(folder && folder.uri); const goToolsEnvVars = getToolsEnvVars(); Object.keys(goToolsEnvVars).forEach(key => { if (!debugConfiguration['env'].hasOwnProperty(key)) { diff --git a/src/goDeclaration.ts b/src/goDeclaration.ts index 9f0e9d11af..2c698b2776 100644 --- a/src/goDeclaration.ts +++ b/src/goDeclaration.ts @@ -10,7 +10,7 @@ import cp = require('child_process'); import path = require('path'); import { promptForMissingTool, promptForUpdatingTool } from './goInstallTools'; import { getModFolderPath, promptToUpdateToolForModules } from './goModules'; -import { byteOffsetAt, getBinPath, getFileArchive, getModuleCache, getToolsEnvVars, getWorkspaceFolderPath, goKeywords, isPositionInString, killProcess, runGodoc } from './util'; +import { byteOffsetAt, getBinPath, getFileArchive, getGoConfig, getModuleCache, getToolsEnvVars, getWorkspaceFolderPath, goKeywords, isPositionInString, killProcess, runGodoc } from './util'; const missingToolMsg = 'Missing tool: '; @@ -55,7 +55,7 @@ export function definitionLocation(document: vscode.TextDocument, position: vsco position = adjustedPos[2]; if (!goConfig) { - goConfig = vscode.workspace.getConfiguration('go', document.uri); + goConfig = getGoConfig(document.uri); } const toolForDocs = goConfig['docsTool'] || 'godoc'; return getModFolderPath(document.uri).then(modFolderPath => { @@ -189,7 +189,7 @@ function definitionLocation_gogetdoc(input: GoDefinitionInput, token: vscode.Can return new Promise((resolve, reject) => { const gogetdocFlagsWithoutTags = ['-u', '-json', '-modified', '-pos', input.document.fileName + ':#' + offset.toString()]; - const buildTags = vscode.workspace.getConfiguration('go', input.document.uri)['buildTags']; + const buildTags = getGoConfig(input.document.uri)['buildTags']; const gogetdocFlags = (buildTags && useTags) ? [...gogetdocFlagsWithoutTags, '-tags', buildTags] : gogetdocFlagsWithoutTags; p = cp.execFile(gogetdoc, gogetdocFlags, { env, cwd: input.cwd }, (err, stdout, stderr) => { try { diff --git a/src/goExtraInfo.ts b/src/goExtraInfo.ts index 8829e47006..4ba2ab5a52 100644 --- a/src/goExtraInfo.ts +++ b/src/goExtraInfo.ts @@ -8,6 +8,7 @@ import vscode = require('vscode'); import { CancellationToken, Hover, HoverProvider, Position, TextDocument, WorkspaceConfiguration } from 'vscode'; import { definitionLocation } from './goDeclaration'; +import { getGoConfig } from './util'; export class GoHoverProvider implements HoverProvider { private goConfig: WorkspaceConfiguration = null; @@ -18,7 +19,7 @@ export class GoHoverProvider implements HoverProvider { public provideHover(document: TextDocument, position: Position, token: CancellationToken): Thenable { if (!this.goConfig) { - this.goConfig = vscode.workspace.getConfiguration('go', document.uri); + this.goConfig = getGoConfig(document.uri); } let goConfig = this.goConfig; diff --git a/src/goFormat.ts b/src/goFormat.ts index 7e1df1661a..ca0f618cfb 100644 --- a/src/goFormat.ts +++ b/src/goFormat.ts @@ -9,7 +9,7 @@ import vscode = require('vscode'); import cp = require('child_process'); import path = require('path'); import { promptForMissingTool, promptForUpdatingTool } from './goInstallTools'; -import { getBinPath, getToolsEnvVars, killTree, sendTelemetryEvent } from './util'; +import { getBinPath, getGoConfig, getToolsEnvVars, killTree, sendTelemetryEvent } from './util'; export class GoDocumentFormattingEditProvider implements vscode.DocumentFormattingEditProvider { @@ -19,7 +19,7 @@ export class GoDocumentFormattingEditProvider implements vscode.DocumentFormatti } const filename = document.fileName; - const goConfig = vscode.workspace.getConfiguration('go', document.uri); + const goConfig = getGoConfig(document.uri); const formatTool = goConfig['formatTool'] || 'goreturns'; const formatFlags = goConfig['formatFlags'].slice() || []; diff --git a/src/goGenerateTests.ts b/src/goGenerateTests.ts index 9bc5079324..f51641aa8a 100644 --- a/src/goGenerateTests.ts +++ b/src/goGenerateTests.ts @@ -12,7 +12,7 @@ import vscode = require('vscode'); import { promptForMissingTool } from './goInstallTools'; import { GoDocumentSymbolProvider } from './goOutline'; import { outputChannel } from './goStatus'; -import { getBinPath, getToolsEnvVars } from './util'; +import { getBinPath, getGoConfig, getToolsEnvVars } from './util'; const generatedWord = 'Generated '; @@ -71,7 +71,7 @@ export function generateTestCurrentPackage(): Promise { return; } return generateTests({ dir: path.dirname(editor.document.uri.fsPath) }, - vscode.workspace.getConfiguration('go', editor.document.uri)); + getGoConfig(editor.document.uri)); } export function generateTestCurrentFile(): Promise { @@ -80,7 +80,7 @@ export function generateTestCurrentFile(): Promise { return; } return generateTests({ dir: editor.document.uri.fsPath }, - vscode.workspace.getConfiguration('go', editor.document.uri)); + getGoConfig(editor.document.uri)); } export async function generateTestCurrentFunction(): Promise { @@ -101,7 +101,7 @@ export async function generateTestCurrentFunction(): Promise { if (funcName.includes('.')) { funcName = funcName.split('.')[1]; } - return generateTests({ dir: editor.document.uri.fsPath, func: funcName }, vscode.workspace.getConfiguration('go', editor.document.uri)); + return generateTests({ dir: editor.document.uri.fsPath, func: funcName }, getGoConfig(editor.document.uri)); } /** diff --git a/src/goImplementations.ts b/src/goImplementations.ts index fa36da8c10..f731bfe04f 100644 --- a/src/goImplementations.ts +++ b/src/goImplementations.ts @@ -10,7 +10,7 @@ import cp = require('child_process'); import path = require('path'); import { promptForMissingTool } from './goInstallTools'; import { envPath } from './goPath'; -import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getToolsEnvVars, getWorkspaceFolderPath, killTree } from './util'; +import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getGoConfig, getToolsEnvVars, getWorkspaceFolderPath, killTree } from './util'; interface GoListOutput { Dir: string; @@ -62,7 +62,7 @@ export class GoImplementationProvider implements vscode.ImplementationProvider { const cwd = path.dirname(filename); const offset = byteOffsetAt(document, position); const goGuru = getBinPath('guru'); - const buildTags = vscode.workspace.getConfiguration('go', document.uri)['buildTags']; + const buildTags = getGoConfig(document.uri)['buildTags']; const args = buildTags ? ['-tags', buildTags] : []; if (listOutput.Root && listOutput.ImportPath) { args.push('-scope', `${listOutput.ImportPath}/...`); diff --git a/src/goInstall.ts b/src/goInstall.ts index f5ae343622..6c6bfc3f69 100644 --- a/src/goInstall.ts +++ b/src/goInstall.ts @@ -8,7 +8,7 @@ import vscode = require('vscode'); import { isModSupported } from './goModules'; import { envPath, getCurrentGoWorkspaceFromGOPATH } from './goPath'; import { outputChannel } from './goStatus'; -import { getBinPath, getCurrentGoPath, getModuleCache, getToolsEnvVars } from './util'; +import { getBinPath, getCurrentGoPath, getGoConfig, getModuleCache, getToolsEnvVars } from './util'; import cp = require('child_process'); export async function installCurrentPackage(): Promise { @@ -37,7 +37,7 @@ export async function installCurrentPackage(): Promise { return; } - const goConfig = vscode.workspace.getConfiguration('go', editor.document.uri); + const goConfig = getGoConfig(); const buildFlags = goConfig['buildFlags'] || []; const args = ['install', ...buildFlags]; diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index 073abd3a06..93938b6779 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -13,7 +13,7 @@ import { getLanguageServerToolPath } from './goLanguageServer'; import { envPath, getToolFromToolPath } from './goPath'; import { hideGoStatus, outputChannel, showGoStatus } from './goStatus'; import { containsString, containsTool, getConfiguredTools, getImportPath, getTool, hasModSuffix, isGocode, isWildcard, Tool } from './goTools'; -import { getBinPath, getCurrentGoPath, getGoVersion, getTempFilePath, getToolsGopath, GoVersion, resolvePath } from './util'; +import { getBinPath, getCurrentGoPath, getGoConfig, getGoVersion, getTempFilePath, getToolsGopath, GoVersion, resolvePath } from './util'; // declinedUpdates tracks the tools that the user has declined to update. const declinedUpdates: Tool[] = []; @@ -68,7 +68,7 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise { - const goroot = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null)['goroot']; + const goroot = getGoConfig()['goroot']; if (goroot) { process.env['GOROOT'] = resolvePath(goroot); } @@ -384,7 +384,7 @@ export async function offerToInstallTools() { vscode.window.showInformationMessage('Reload VS Code window to enable the use of Go language server'); }); } else if (selected === disableLabel) { - const goConfig = vscode.workspace.getConfiguration('go'); + const goConfig = getGoConfig(); const inspectLanguageServerSetting = goConfig.inspect('useLanguageServer'); if (inspectLanguageServerSetting.globalValue === true) { goConfig.update('useLanguageServer', false, vscode.ConfigurationTarget.Global); diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts index 956a51a02c..d51c41f076 100644 --- a/src/goLanguageServer.ts +++ b/src/goLanguageServer.ts @@ -31,7 +31,7 @@ import { GoCompletionItemProvider } from './goSuggest'; import { GoWorkspaceSymbolProvider } from './goSymbol'; import { getTool, Tool } from './goTools'; import { GoTypeDefinitionProvider } from './goTypeDefinition'; -import { getBinPath, getCurrentGoPath, getToolsEnvVars } from './util'; +import { getBinPath, getCurrentGoPath, getGoConfig, getToolsEnvVars } from './util'; interface LanguageServerConfig { enabled: boolean; @@ -288,7 +288,7 @@ function watchLanguageServerConfiguration(e: vscode.ConfigurationChangeEvent) { } export function parseLanguageServerConfig(): LanguageServerConfig { - const goConfig = vscode.workspace.getConfiguration('go'); + const goConfig = getGoConfig(); const config = { enabled: goConfig['useLanguageServer'], @@ -323,7 +323,7 @@ export function parseLanguageServerConfig(): LanguageServerConfig { */ export function getLanguageServerToolPath(): string { // If language server is not enabled, return - const goConfig = vscode.workspace.getConfiguration('go'); + const goConfig = getGoConfig(); if (!goConfig['useLanguageServer']) { return; } diff --git a/src/goLint.ts b/src/goLint.ts index ea0b659e5c..0b0f5244b5 100644 --- a/src/goLint.ts +++ b/src/goLint.ts @@ -7,7 +7,7 @@ import path = require('path'); import vscode = require('vscode'); import { lintDiagnosticCollection } from './goMain'; import { diagnosticsStatusBarItem, outputChannel } from './goStatus'; -import { getToolsEnvVars, getToolsGopath, getWorkspaceFolderPath, handleDiagnosticErrors, ICheckResult, resolvePath, runTool } from './util'; +import { getGoConfig, getToolsEnvVars, getToolsGopath, getWorkspaceFolderPath, handleDiagnosticErrors, ICheckResult, resolvePath, runTool } from './util'; /** * Runs linter on the current file, package or workspace. */ @@ -23,7 +23,7 @@ export function lintCode(scope?: string) { } const documentUri = editor ? editor.document.uri : null; - const goConfig = vscode.workspace.getConfiguration('go', documentUri); + const goConfig = getGoConfig(documentUri); outputChannel.clear(); // Ensures stale output from lint on save is cleared diagnosticsStatusBarItem.show(); diff --git a/src/goLiveErrors.ts b/src/goLiveErrors.ts index dfb2de2faf..3909c0a14f 100644 --- a/src/goLiveErrors.ts +++ b/src/goLiveErrors.ts @@ -26,7 +26,7 @@ export function goLiveErrorsEnabled() { if (goConfig === null || goConfig === undefined || !goConfig.enabled) { return false; } - const files = vscode.workspace.getConfiguration('files'); + const files = vscode.workspace.getConfiguration('files', null); const autoSave = files['autoSave']; const autoSaveDelay = files['autoSaveDelay']; if (autoSave !== null && autoSave !== undefined && @@ -55,7 +55,7 @@ export function parseLiveFile(e: vscode.TextDocumentChangeEvent) { runner = setTimeout(() => { processFile(e); runner = null; - }, vscode.workspace.getConfiguration('go', e.document.uri)['liveErrors']['delay']); + }, getGoConfig(e.document.uri)['liveErrors']['delay']); } // processFile does the actual work once the timeout has fired diff --git a/src/goMain.ts b/src/goMain.ts index f47cf708b7..aca2da2100 100644 --- a/src/goMain.ts +++ b/src/goMain.ts @@ -34,7 +34,7 @@ import { testAtCursor, testCurrentFile, testCurrentPackage, testPrevious, testWo import { vetCode } from './goVet'; import { setGlobalState } from './stateUtils'; import { cancelRunningTests, showTestOutput } from './testUtils'; -import { cleanupTempDir, disposeTelemetryReporter, getBinPath, getCurrentGoPath, getExtensionCommands, getGoVersion, getToolsEnvVars, getToolsGopath, getWorkspaceFolderPath, handleDiagnosticErrors, isGoPathSet, sendTelemetryEvent } from './util'; +import { cleanupTempDir, disposeTelemetryReporter, getBinPath, getGoConfig, getCurrentGoPath, getExtensionCommands, getGoVersion, getToolsEnvVars, getToolsGopath, getWorkspaceFolderPath, handleDiagnosticErrors, isGoPathSet, sendTelemetryEvent } from './util'; export let buildDiagnosticCollection: vscode.DiagnosticCollection; export let lintDiagnosticCollection: vscode.DiagnosticCollection; @@ -90,7 +90,7 @@ export function activate(ctx: vscode.ExtensionContext): void { await registerLanguageFeatures(ctx); if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.languageId === 'go' && isGoPathSet()) { - runBuilds(vscode.window.activeTextEditor.document, vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor.document.uri)); + runBuilds(vscode.window.activeTextEditor.document, getGoConfig()); } }); @@ -124,7 +124,7 @@ export function activate(ctx: vscode.ExtensionContext): void { ctx.subscriptions.push(vscode.commands.registerCommand('go.gopath', () => { const gopath = getCurrentGoPath(); let msg = `${gopath} is the current GOPATH.`; - const wasInfered = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null)['inferGopath']; + const wasInfered = getGoConfig()['inferGopath']; const root = getWorkspaceFolderPath(vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.uri); // not only if it was configured, but if it was successful. @@ -160,46 +160,46 @@ export function activate(ctx: vscode.ExtensionContext): void { })); ctx.subscriptions.push(vscode.commands.registerCommand('go.test.cursor', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); testAtCursor(goConfig, 'test', args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.debug.cursor', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); testAtCursor(goConfig, 'debug', args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.benchmark.cursor', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); testAtCursor(goConfig, 'benchmark', args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.test.package', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); const isBenchmark = false; testCurrentPackage(goConfig, isBenchmark, args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.benchmark.package', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); const isBenchmark = true; testCurrentPackage(goConfig, isBenchmark, args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.test.file', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); const isBenchmark = false; testCurrentFile(goConfig, isBenchmark, args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.benchmark.file', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); const isBenchmark = true; testCurrentFile(goConfig, isBenchmark, args); })); ctx.subscriptions.push(vscode.commands.registerCommand('go.test.workspace', (args) => { - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); testWorkspace(goConfig, args); })); @@ -244,7 +244,7 @@ export function activate(ctx: vscode.ExtensionContext): void { if (!e.affectsConfiguration('go')) { return; } - const updatedGoConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const updatedGoConfig = getGoConfig(); sendTelemetryEventForConfig(updatedGoConfig); updateGoPathGoRootFromConfig(); @@ -358,7 +358,7 @@ export function activate(ctx: vscode.ExtensionContext): void { wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, }); - sendTelemetryEventForConfig(vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null)); + sendTelemetryEventForConfig(getGoConfig()); } export function deactivate() { @@ -393,7 +393,7 @@ function addOnSaveTextDocumentListeners(ctx: vscode.ExtensionContext) { vscode.window.showWarningMessage('A debug session is currently active. Changes to your Go files may result in unexpected behaviour.'); } if (vscode.window.visibleTextEditors.some(e => e.document.fileName === document.fileName)) { - runBuilds(document, vscode.workspace.getConfiguration('go', document.uri)); + runBuilds(document, getGoConfig(document.uri)); } }, null, ctx.subscriptions); diff --git a/src/goModifytags.ts b/src/goModifytags.ts index cde55a6d6c..0b34dab090 100644 --- a/src/goModifytags.ts +++ b/src/goModifytags.ts @@ -7,7 +7,7 @@ import vscode = require('vscode'); import { promptForMissingTool } from './goInstallTools'; -import { byteOffsetAt, getBinPath, getFileArchive, getToolsEnvVars } from './util'; +import { byteOffsetAt, getBinPath, getGoConfig, getFileArchive, getToolsEnvVars } from './util'; import cp = require('child_process'); // Interface for the output from gomodifytags @@ -31,7 +31,7 @@ export function addTags(commandArgs: GoTagsConfig) { return; } - getTagsAndOptions(vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor.document.uri)['addTags'], commandArgs).then(([tags, options, transformValue]) => { + getTagsAndOptions(getGoConfig()['addTags'], commandArgs).then(([tags, options, transformValue]) => { if (!tags && !options) { return; } @@ -58,7 +58,7 @@ export function removeTags(commandArgs: GoTagsConfig) { return; } - getTagsAndOptions(vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor.document.uri)['removeTags'], commandArgs).then(([tags, options]) => { + getTagsAndOptions(getGoConfig()['removeTags'], commandArgs).then(([tags, options]) => { if (!tags && !options) { args.push('--clear-tags'); args.push('--clear-options'); diff --git a/src/goModules.ts b/src/goModules.ts index 4427ea94e1..e4afbe9bcd 100644 --- a/src/goModules.ts +++ b/src/goModules.ts @@ -7,7 +7,7 @@ import { installTools } from './goInstallTools'; import { envPath, fixDriveCasingInWindows } from './goPath'; import { getTool } from './goTools'; import { getFromGlobalState, updateGlobalState } from './stateUtils'; -import { getBinPath, getGoVersion, getModuleCache, getToolsEnvVars, sendTelemetryEvent } from './util'; +import { getBinPath, getGoConfig, getGoVersion, getModuleCache, getToolsEnvVars, sendTelemetryEvent } from './util'; import path = require('path'); import cp = require('child_process'); import vscode = require('vscode'); @@ -61,7 +61,7 @@ export async function getModFolderPath(fileuri: vscode.Uri): Promise { if (goModEnvResult) { logModuleUsage(); goModEnvResult = path.dirname(goModEnvResult); - const goConfig = vscode.workspace.getConfiguration('go', fileuri); + const goConfig = getGoConfig(fileuri); let promptFormatTool = goConfig['formatTool'] === 'goreturns'; if (goConfig['inferGopath'] === true) { @@ -118,7 +118,7 @@ export async function promptToUpdateToolForModules(tool: string, promptMsg: stri case 'Update': choseToUpdate = true; if (!goConfig) { - goConfig = vscode.workspace.getConfiguration('go'); + goConfig = getGoConfig(); } if (tool === 'switchFormatToolToGoimports') { goConfig.update('formatTool', 'goimports', vscode.ConfigurationTarget.Global); diff --git a/src/goOutline.ts b/src/goOutline.ts index 2bfe834809..65e3abc125 100644 --- a/src/goOutline.ts +++ b/src/goOutline.ts @@ -8,7 +8,7 @@ import vscode = require('vscode'); import cp = require('child_process'); import { promptForMissingTool, promptForUpdatingTool } from './goInstallTools'; -import { getBinPath, getFileArchive, getToolsEnvVars, killProcess, makeMemoizedByteOffsetConverter } from './util'; +import { getBinPath, getGoConfig, getFileArchive, getToolsEnvVars, killProcess, makeMemoizedByteOffsetConverter } from './util'; // Keep in sync with https://github.com/ramya-rao-a/go-outline export interface GoOutlineRange { @@ -170,7 +170,7 @@ export class GoDocumentSymbolProvider implements vscode.DocumentSymbolProvider { public provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): Thenable { if (typeof this.includeImports !== 'boolean') { - const gotoSymbolConfig = vscode.workspace.getConfiguration('go', document.uri)['gotoSymbol']; + const gotoSymbolConfig = getGoConfig(document.uri)['gotoSymbol']; this.includeImports = gotoSymbolConfig ? gotoSymbolConfig['includeImports'] : false; } const options: GoOutlineOptions = { diff --git a/src/goPlayground.ts b/src/goPlayground.ts index 5e2a151910..04ca12c437 100644 --- a/src/goPlayground.ts +++ b/src/goPlayground.ts @@ -8,7 +8,7 @@ import { execFile } from 'child_process'; import * as path from 'path'; import { promptForMissingTool } from './goInstallTools'; import { outputChannel } from './goStatus'; -import { getBinPath } from './util'; +import { getBinPath, getGoConfig } from './util'; const TOOL_CMD_NAME = 'goplay'; @@ -32,7 +32,7 @@ export const playgroundCommand = () => { const code = selection.isEmpty ? editor.document.getText() : editor.document.getText(selection); - goPlay(code, vscode.workspace.getConfiguration('go', editor.document.uri).get('playground')).then(result => { + goPlay(code, getGoConfig(editor.document.uri).get('playground')).then(result => { outputChannel.append(result); }, (e: string) => { if (e) { diff --git a/src/goReferences.ts b/src/goReferences.ts index 21ca8ffe8d..6e8ffd781c 100644 --- a/src/goReferences.ts +++ b/src/goReferences.ts @@ -9,7 +9,7 @@ import vscode = require('vscode'); import cp = require('child_process'); import path = require('path'); import { promptForMissingTool } from './goInstallTools'; -import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getFileArchive, getToolsEnvVars, killTree } from './util'; +import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getGoConfig, getFileArchive, getToolsEnvVars, killTree } from './util'; export class GoReferenceProvider implements vscode.ReferenceProvider { @@ -35,7 +35,7 @@ export class GoReferenceProvider implements vscode.ReferenceProvider { const cwd = path.dirname(filename); const offset = byteOffsetAt(document, wordRange.start); const env = getToolsEnvVars(); - const buildTags = vscode.workspace.getConfiguration('go', document.uri)['buildTags']; + const buildTags = getGoConfig(document.uri)['buildTags']; const args = buildTags ? ['-tags', buildTags] : []; args.push('-modified', 'referrers', `${filename}:#${offset.toString()}`); diff --git a/src/goReferencesCodelens.ts b/src/goReferencesCodelens.ts index 466c92ac2a..68f1989168 100644 --- a/src/goReferencesCodelens.ts +++ b/src/goReferencesCodelens.ts @@ -11,7 +11,7 @@ import { CancellationToken, CodeLens, Range, TextDocument } from 'vscode'; import { GoBaseCodeLensProvider } from './goBaseCodelens'; import { GoDocumentSymbolProvider } from './goOutline'; import { GoReferenceProvider } from './goReferences'; -import { getBinPath } from './util'; +import { getBinPath, getGoConfig } from './util'; const methodRegex = /^func\s+\(\s*\w+\s+\*?\w+\s*\)\s+/; @@ -29,7 +29,7 @@ export class GoReferencesCodeLensProvider extends GoBaseCodeLensProvider { if (!this.enabled) { return []; } - const codeLensConfig: { [key: string]: any } = vscode.workspace.getConfiguration('go', document.uri).get('enableCodeLens'); + const codeLensConfig: { [key: string]: any } = getGoConfig(document.uri).get('enableCodeLens'); const codelensEnabled = codeLensConfig ? codeLensConfig['references'] : false; if (!codelensEnabled) { return Promise.resolve([]); diff --git a/src/goRename.ts b/src/goRename.ts index 9d0129803d..af6e1fec69 100644 --- a/src/goRename.ts +++ b/src/goRename.ts @@ -10,7 +10,7 @@ import cp = require('child_process'); import { Edit, FilePatch, getEditsFromUnifiedDiffStr, isDiffToolAvailable } from './diffUtils'; import { promptForMissingTool } from './goInstallTools'; import { outputChannel } from './goStatus'; -import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getToolsEnvVars, killProcess } from './util'; +import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getGoConfig, getToolsEnvVars, killProcess } from './util'; export class GoRenameProvider implements vscode.RenameProvider { @@ -28,7 +28,7 @@ export class GoRenameProvider implements vscode.RenameProvider { const offset = byteOffsetAt(document, pos); const env = getToolsEnvVars(); const gorename = getBinPath('gorename'); - const buildTags = vscode.workspace.getConfiguration('go', document.uri)['buildTags'] ; + const buildTags = getGoConfig(document.uri)['buildTags'] ; const gorenameArgs = ['-offset', filename + ':#' + offset, '-to', newName]; if (buildTags) { gorenameArgs.push('-tags', buildTags); diff --git a/src/goRunTestCodelens.ts b/src/goRunTestCodelens.ts index 5968635219..2af80ce350 100644 --- a/src/goRunTestCodelens.ts +++ b/src/goRunTestCodelens.ts @@ -11,7 +11,7 @@ import { CancellationToken, CodeLens, Command, TextDocument } from 'vscode'; import { GoBaseCodeLensProvider } from './goBaseCodelens'; import { GoDocumentSymbolProvider } from './goOutline'; import { getBenchmarkFunctions, getTestFlags, getTestFunctionDebugArgs, getTestFunctions } from './testUtils'; -import { getCurrentGoPath } from './util'; +import { getCurrentGoPath, getGoConfig } from './util'; export class GoRunTestCodeLensProvider extends GoBaseCodeLensProvider { private readonly benchmarkRegex = /^Benchmark.+/; @@ -29,7 +29,7 @@ export class GoRunTestCodeLensProvider extends GoBaseCodeLensProvider { if (!this.enabled) { return []; } - const config = vscode.workspace.getConfiguration('go', document.uri); + const config = getGoConfig(document.uri); const codeLensConfig: { [key: string]: any } = config.get('enableCodeLens'); const codelensEnabled = codeLensConfig ? codeLensConfig['runtest'] : false; if (!codelensEnabled || !document.fileName.endsWith('_test.go')) { diff --git a/src/goSignature.ts b/src/goSignature.ts index 05b66618aa..928bd4ea14 100755 --- a/src/goSignature.ts +++ b/src/goSignature.ts @@ -5,10 +5,9 @@ 'use strict'; -import vscode = require('vscode'); import { CancellationToken, ParameterInformation, Position, SignatureHelp, SignatureHelpProvider, SignatureInformation, TextDocument, WorkspaceConfiguration } from 'vscode'; import { definitionLocation } from './goDeclaration'; -import { getParametersAndReturnType, isPositionInComment, isPositionInString } from './util'; +import { getGoConfig, getParametersAndReturnType, isPositionInComment, isPositionInString } from './util'; export class GoSignatureHelpProvider implements SignatureHelpProvider { @@ -16,7 +15,7 @@ export class GoSignatureHelpProvider implements SignatureHelpProvider { } public async provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken): Promise { - let goConfig = this.goConfig || vscode.workspace.getConfiguration('go', document.uri); + let goConfig = this.goConfig || getGoConfig(document.uri); const theCall = this.walkBackwardsToBeginningOfCall(document, position); if (theCall == null) { diff --git a/src/goSuggest.ts b/src/goSuggest.ts index 20bddb8bd2..df4bfda594 100644 --- a/src/goSuggest.ts +++ b/src/goSuggest.ts @@ -13,7 +13,7 @@ import { promptForMissingTool, promptForUpdatingTool } from './goInstallTools'; import { isModSupported } from './goModules'; import { getImportablePackages } from './goPackages'; import { getCurrentGoWorkspaceFromGOPATH } from './goPath'; -import { byteOffsetAt, getBinPath, getCurrentGoPath, getParametersAndReturnType, getToolsEnvVars, goBuiltinTypes, goKeywords, guessPackageNameFromFile, isPositionInComment, isPositionInString, parseFilePrelude, runGodoc } from './util'; +import { byteOffsetAt, getBinPath, getCurrentGoPath, getGoConfig, getParametersAndReturnType, getToolsEnvVars, goBuiltinTypes, goKeywords, guessPackageNameFromFile, isPositionInComment, isPositionInString, parseFilePrelude, runGodoc } from './util'; function vscodeKindFromGoCodeClass(kind: string, type: string): vscode.CompletionItemKind { switch (kind) { @@ -73,7 +73,7 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider, } public provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Thenable { - return this.provideCompletionItemsInternal(document, position, token, vscode.workspace.getConfiguration('go', document.uri)).then(result => { + return this.provideCompletionItemsInternal(document, position, token, getGoConfig(document.uri)).then(result => { if (!result) { return new vscode.CompletionList([], false); } @@ -582,7 +582,7 @@ export async function getCompletionsWithoutGoCode(document: vscode.TextDocument, } const lineText = document.lineAt(position.line).text; - const config = vscode.workspace.getConfiguration('go', document.uri); + const config = getGoConfig(document.uri); const autocompleteUnimportedPackages = config['autocompleteUnimportedPackages'] === true && !lineText.match(/^(\s)*(import|package)(\s)+/); const commentCompletion = getCommentCompletion(document, position); diff --git a/src/goSymbol.ts b/src/goSymbol.ts index b53b3df746..62288c7a33 100644 --- a/src/goSymbol.ts +++ b/src/goSymbol.ts @@ -8,7 +8,7 @@ import vscode = require('vscode'); import cp = require('child_process'); import { promptForMissingTool, promptForUpdatingTool } from './goInstallTools'; -import { getBinPath, getToolsEnvVars, getWorkspaceFolderPath, killProcess } from './util'; +import { getBinPath, getGoConfig, getToolsEnvVars, getWorkspaceFolderPath, killProcess } from './util'; // Keep in sync with github.com/acroca/go-symbols' interface GoSymbolDeclaration { @@ -49,7 +49,7 @@ export class GoWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider }); }; const root = getWorkspaceFolderPath(vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.uri); - const goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const goConfig = getGoConfig(); if (!root && !goConfig.gotoSymbol.includeGoroot) { vscode.window.showInformationMessage('No workspace is open to find symbols.'); @@ -66,7 +66,7 @@ export class GoWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider export function getWorkspaceSymbols(workspacePath: string, query: string, token: vscode.CancellationToken, goConfig?: vscode.WorkspaceConfiguration, ignoreFolderFeatureOn: boolean = true): Thenable { if (!goConfig) { - goConfig = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + goConfig = getGoConfig(); } const gotoSymbolConfig = goConfig['gotoSymbol']; const calls: Promise[] = []; diff --git a/src/goTypeDefinition.ts b/src/goTypeDefinition.ts index d23c503ae6..c3c89ba530 100644 --- a/src/goTypeDefinition.ts +++ b/src/goTypeDefinition.ts @@ -10,7 +10,7 @@ import cp = require('child_process'); import path = require('path'); import { adjustWordPosition, definitionLocation, parseMissingError } from './goDeclaration'; import { promptForMissingTool } from './goInstallTools'; -import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getFileArchive, getToolsEnvVars, goBuiltinTypes, killTree } from './util'; +import { byteOffsetAt, canonicalizeGOPATHPrefix, getBinPath, getGoConfig, getFileArchive, getToolsEnvVars, goBuiltinTypes, killTree } from './util'; interface GuruDescribeOutput { desc: string; @@ -49,7 +49,7 @@ export class GoTypeDefinitionProvider implements vscode.TypeDefinitionProvider { const filename = canonicalizeGOPATHPrefix(document.fileName); const offset = byteOffsetAt(document, position); const env = getToolsEnvVars(); - const buildTags = vscode.workspace.getConfiguration('go', document.uri)['buildTags']; + const buildTags = getGoConfig(document.uri)['buildTags']; const args = buildTags ? ['-tags', buildTags] : []; args.push('-json', '-modified', 'describe', `${filename}:#${offset.toString()}`); diff --git a/src/goVet.ts b/src/goVet.ts index 054493efce..76e6ca8238 100644 --- a/src/goVet.ts +++ b/src/goVet.ts @@ -7,7 +7,7 @@ import path = require('path'); import vscode = require('vscode'); import { vetDiagnosticCollection } from './goMain'; import { diagnosticsStatusBarItem, outputChannel } from './goStatus'; -import { getGoVersion, getToolsEnvVars, getWorkspaceFolderPath, handleDiagnosticErrors, ICheckResult, resolvePath, runTool } from './util'; +import { getGoConfig, getGoVersion, getToolsEnvVars, getWorkspaceFolderPath, handleDiagnosticErrors, ICheckResult, resolvePath, runTool } from './util'; /** * Runs go vet in the current package or workspace. @@ -24,7 +24,7 @@ export function vetCode(vetWorkspace?: boolean) { } const documentUri = editor ? editor.document.uri : null; - const goConfig = vscode.workspace.getConfiguration('go', documentUri); + const goConfig = getGoConfig(documentUri); outputChannel.clear(); // Ensures stale output from vet on save is cleared diagnosticsStatusBarItem.show(); diff --git a/src/util.ts b/src/util.ts index 3d91f0e2cb..5afc6c72de 100644 --- a/src/util.ts +++ b/src/util.ts @@ -79,7 +79,7 @@ export class GoVersion { constructor(version: string) { const matchesRelease = /go version go(\d.\d+).*/.exec(version); - const matchesDevel = /go version devel \+(.\d+).*/.exec(version); + const matchesDevel = /go version devel \+(.[a-zA-Z0-9]+).*/.exec(version); if (matchesRelease) { this.sv = semver.coerce(matchesRelease[0]); } else if (matchesDevel) { @@ -125,8 +125,15 @@ let vendorSupport: boolean = null; let telemtryReporter: TelemetryReporter; let toolsGopath: string; -export function getGoConfig(): vscode.WorkspaceConfiguration { - return vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); +export function getGoConfig(uri?: vscode.Uri): vscode.WorkspaceConfiguration { + if (!uri) { + if (vscode.window.activeTextEditor) { + uri = vscode.window.activeTextEditor.document.uri; + } else { + uri = null; + } + } + return vscode.workspace.getConfiguration('go', uri); } export function byteOffsetAt(document: vscode.TextDocument, position: vscode.Position): number { @@ -373,13 +380,11 @@ export function getToolsGopath(useCache: boolean = true): string { if (!useCache || !toolsGopath) { toolsGopath = resolveToolsGopath(); } - return toolsGopath; } function resolveToolsGopath(): string { - - let toolsGopathForWorkspace = substituteEnv(vscode.workspace.getConfiguration('go')['toolsGopath'] || ''); + let toolsGopathForWorkspace = substituteEnv(getGoConfig()['toolsGopath'] || ''); // In case of single root if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length <= 1) { @@ -396,7 +401,7 @@ function resolveToolsGopath(): string { // If any of the folders in multi root have toolsGopath set, use it. for (let i = 0; i < vscode.workspace.workspaceFolders.length; i++) { - let toolsGopath = vscode.workspace.getConfiguration('go', vscode.workspace.workspaceFolders[i].uri).inspect('toolsGopath').workspaceFolderValue; + let toolsGopath = getGoConfig(vscode.workspace.workspaceFolders[i].uri).inspect('toolsGopath').workspaceFolderValue; toolsGopath = resolvePath(toolsGopath, vscode.workspace.workspaceFolders[i].uri.fsPath); if (toolsGopath) { return toolsGopath; @@ -405,7 +410,7 @@ function resolveToolsGopath(): string { } export function getBinPath(tool: string): string { - const alternateTools: { [key: string]: string } = vscode.workspace.getConfiguration('go', null).get('alternateTools'); + const alternateTools: { [key: string]: string } = getGoConfig().get('alternateTools'); const alternateToolPath: string = alternateTools[tool]; return getBinPathWithPreferredGopath( @@ -421,7 +426,7 @@ export function getFileArchive(document: vscode.TextDocument): string { } export function getToolsEnvVars(): any { - const config = vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null); + const config = getGoConfig(); const toolsEnvVars = config['toolsEnvVars']; const gopath = getCurrentGoPath(); @@ -445,7 +450,7 @@ export function getCurrentGoPath(workspaceUri?: vscode.Uri): string { const activeEditorUri = vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.uri; const currentFilePath = fixDriveCasingInWindows(activeEditorUri && activeEditorUri.fsPath); const currentRoot = (workspaceUri && workspaceUri.fsPath) || getWorkspaceFolderPath(activeEditorUri); - const config = vscode.workspace.getConfiguration('go', workspaceUri || activeEditorUri); + const config = getGoConfig(workspaceUri || activeEditorUri); // Infer the GOPATH from the current root or the path of the file opened in current editor // Last resort: Check for the common case where GOPATH itself is opened directly in VS Code diff --git a/test/integration/index.ts b/test/integration/index.ts index c66511bd87..dea0a24a94 100644 --- a/test/integration/index.ts +++ b/test/integration/index.ts @@ -5,7 +5,6 @@ import * as path from 'path'; import * as Mocha from 'mocha'; import * as glob from 'glob'; - export function run(): Promise { // Create the mocha test const mocha = new Mocha({ @@ -17,7 +16,6 @@ export function run(): Promise { return new Promise((c, e) => { glob('integration/**.test.js', { cwd: testsRoot }, (err, files) => { - console.log(files); if (err) { return e(err); }