33
44import { inject , injectable } from 'inversify' ;
55import * as path from 'path' ;
6- import { CancellationToken , CompletionContext , OutputChannel , Position ,
7- TextDocument , Uri } from 'vscode' ;
8- import { Disposable , LanguageClient , LanguageClientOptions ,
9- ProvideCompletionItemsSignature , ServerOptions } from 'vscode-languageclient' ;
6+ import {
7+ CancellationToken , CompletionContext , OutputChannel , Position ,
8+ TextDocument , Uri
9+ } from 'vscode' ;
10+ import {
11+ Disposable , LanguageClient , LanguageClientOptions ,
12+ ProvideCompletionItemsSignature , ServerOptions
13+ } from 'vscode-languageclient' ;
1014import { IApplicationShell , ICommandManager , IWorkspaceService } from '../common/application/types' ;
1115import { PythonSettings } from '../common/configSettings' ;
1216import { isTestExecution , STANDARD_OUTPUT_CHANNEL } from '../common/constants' ;
1317import { createDeferred , Deferred } from '../common/helpers' ;
1418import { IFileSystem , IPlatformService } from '../common/platform/types' ;
1519import { StopWatch } from '../common/stopWatch' ;
16- import { BANNER_NAME_LS_SURVEY , IConfigurationService , IExtensionContext , ILogger ,
17- IOutputChannel , IPythonExtensionBanner , IPythonSettings } from '../common/types' ;
20+ import {
21+ BANNER_NAME_LS_SURVEY , IConfigurationService , IExtensionContext , ILogger ,
22+ IOutputChannel , IPythonExtensionBanner , IPythonSettings
23+ } from '../common/types' ;
1824import { IServiceContainer } from '../ioc/types' ;
1925import {
2026 PYTHON_LANGUAGE_SERVER_DOWNLOADED ,
@@ -91,6 +97,10 @@ export class LanguageServerExtensionActivator implements IExtensionActivator {
9197 }
9298
9399 public async activate ( ) : Promise < boolean > {
100+ if ( ! this . checkSupportedPlatform ( ) ) {
101+ return false ;
102+ }
103+
94104 this . sw . reset ( ) ;
95105 const clientOptions = await this . getAnalysisOptions ( ) ;
96106 if ( ! clientOptions ) {
@@ -115,6 +125,15 @@ export class LanguageServerExtensionActivator implements IExtensionActivator {
115125 ( this . configuration . getSettings ( ) as PythonSettings ) . removeListener ( 'change' , this . onSettingsChanged . bind ( this ) ) ;
116126 }
117127
128+ private checkSupportedPlatform ( ) : boolean {
129+ const platform = this . services . get < IPlatformService > ( IPlatformService ) ;
130+ if ( platform . isMac && platform . versionMajor === 10 && platform . versionMinor < 12 ) {
131+ this . services . get < ILogger > ( ILogger ) . logError ( 'Unsupported MacOS' ) ;
132+ this . appShell . showErrorMessage ( 'Microsoft Python Language Server does not support MacOS older than 10.12.' ) ;
133+ return false ;
134+ }
135+ return true ;
136+ }
118137 private async startLanguageServer ( clientOptions : LanguageClientOptions ) : Promise < boolean > {
119138 // Determine if we are running MSIL/Universal via dotnet or self-contained app.
120139
0 commit comments