From 76afb8ed539189924001882dc6d040777dbb54e5 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 21 Mar 2019 16:06:46 -0600 Subject: [PATCH 1/3] Fix compile errors. --- src/client/activation/languageServer/analysisOptions.ts | 9 +++++++-- .../activation/languageServer/languageClientFactory.ts | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) 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); } } From b794c70f85ffbe9ccd41c9d66d85ead146156a8f Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 21 Mar 2019 16:10:17 -0600 Subject: [PATCH 2/3] Fix a CI task label. --- build/ci/templates/test_phases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci/templates/test_phases.yml b/build/ci/templates/test_phases.yml index 0a701831fe0e..5e8b3e01bdd1 100644 --- a/build/ci/templates/test_phases.yml +++ b/build/ci/templates/test_phases.yml @@ -110,7 +110,7 @@ steps: npx tsc -p ./ 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) From 2eecf433fc0409b23e1944d9d0ca29cc65bb28f2 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 21 Mar 2019 16:16:53 -0600 Subject: [PATCH 3/3] Fix the CI task. --- build/ci/templates/test_phases.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build/ci/templates/test_phases.yml b/build/ci/templates/test_phases.yml index 5e8b3e01bdd1..f3e8b4791c01 100644 --- a/build/ci/templates/test_phases.yml +++ b/build/ci/templates/test_phases.yml @@ -102,12 +102,19 @@ 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: 'code hygiene'