diff --git a/build/ci/templates/test_phases.yml b/build/ci/templates/test_phases.yml index 0a701831fe0e..f3e8b4791c01 100644 --- a/build/ci/templates/test_phases.yml +++ b/build/ci/templates/test_phases.yml @@ -102,15 +102,22 @@ steps: inputs: targets: 'prePublishNonBundle' - # Run the `hygiene` gulp task to ensure that the added code adheres to the - # code standards we are trying to maintain. + # Make sure the project compiles (with strict checks enabled). # Example command line (windows pwsh): - # > gulp hygiene + # > npx tsc -p ./ - bash: | npx tsc -p ./ + displayName: 'make sure project compiles' + condition: and(succeeded(), contains(variables['TestsToRun'], 'runHygiene')) + + # Run tslint on the project source to ensure that the added code adheres + # to the # code standards we are trying to maintain. + # Example command line (windows pwsh): + # > npx tslint ./src/**/*.ts{,x} + - bash: | npx tslint ./src/**/*.ts{,x} #npx gulp hygiene - displayName: 'gulp code hygiene' + displayName: 'code hygiene' condition: and(succeeded(), contains(variables['TestsToRun'], 'runHygiene')) # Enable test coverage reporting for all subsequent tests (typescript-based) diff --git a/src/client/activation/languageServer/analysisOptions.ts b/src/client/activation/languageServer/analysisOptions.ts index 40a0c1dddf10..551666405572 100644 --- a/src/client/activation/languageServer/analysisOptions.ts +++ b/src/client/activation/languageServer/analysisOptions.ts @@ -61,6 +61,11 @@ export class LanguageServerAnalysisOptions implements ILanguageServerAnalysisOpt const properties: Record = {}; const interpreterInfo = await this.interpreterService.getActiveInterpreter(this.resource); + if (!interpreterInfo) { + // tslint:disable-next-line:no-suspicious-comment + // TODO: How do we handle this? It is pretty unlikely... + throw Error('did not find an active interpreter'); + } // tslint:disable-next-line:no-string-literal properties['InterpreterPath'] = interpreterInfo.path; @@ -87,8 +92,8 @@ export class LanguageServerAnalysisOptions implements ILanguageServerAnalysisOpt properties['DatabasePath'] = path.join(this.context.extensionPath, this.languageServerFolder); const vars = await this.envVarsProvider.getEnvironmentVariables(); - this.envPythonPath = vars.PYTHONPATH; - if (this.envPythonPath && this.envPythonPath.length > 0) { + this.envPythonPath = vars.PYTHONPATH || ''; + if (this.envPythonPath !== '') { const paths = this.envPythonPath.split(this.pathUtils.delimiter).filter(item => item.trim().length > 0); searchPaths.push(...paths); } diff --git a/src/client/activation/languageServer/languageClientFactory.ts b/src/client/activation/languageServer/languageClientFactory.ts index c7aee1d44c0f..522c8fb58dcc 100644 --- a/src/client/activation/languageServer/languageClientFactory.ts +++ b/src/client/activation/languageServer/languageClientFactory.ts @@ -33,8 +33,10 @@ export class BaseLanguageClientFactory implements ILanguageClientFactory { private async getEnvVars(resource: Resource): Promise { const envVars = await this.environmentActivationService.getActivatedEnvironmentVariables(resource); - const hasEnvVars = envVars && Object.keys(envVars).length > 0; - return hasEnvVars ? envVars : this.envVarsProvider.getEnvironmentVariables(resource); + if (envVars && Object.keys(envVars).length > 0) { + return envVars; + } + return this.envVarsProvider.getEnvironmentVariables(resource); } }