Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Except from `test`, `debug` and `datascience` features of [vscode-python](https:
- `python.autoComplete.showAdvancedMembers`:Controls appearance of methods with double underscores in the completion list., default: `true`
- `python.autoComplete.typeshedPaths`:Specifies paths to local typeshed repository clone(s) for the Python language server., default: `[]`
- `python.autoUpdateLanguageServer`:Automatically update the language server., default: `true`
- `python.languageServerPath`:If not empty, use the provided language server binary instead of the one that's been downloaded., default: `""`
- `python.disableInstallationCheck`:Whether to check if Python is installed (also warn when using the macOS-installed Python)., default: `false`
- `python.envFile`:Absolute path to a file containing environment variable definitions., default: `"${workspaceFolder}/.env"`
- `python.trace.server`:Trace level of tsserver, default: `"off"`
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@
"description": "Automatically update the language server.",
"scope": "application"
},
"python.languageServerPath": {
"type": "string",
"description": "Overrides the auto-installed Python Language server binary path.",
"default": "",
"scope": "resource"
},
"python.disableInstallationCheck": {
"type": "boolean",
"default": false,
Expand Down
6 changes: 5 additions & 1 deletion src/activation/languageServer/languageClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ export class BaseLanguageClientFactory implements ILanguageClientFactory {
@injectable()
export class DownloadedLanguageClientFactory implements ILanguageClientFactory {
constructor(@inject(IPlatformData) private readonly platformData: IPlatformData,
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
@inject(ILanguageServerFolderService) private readonly languageServerFolderService: ILanguageServerFolderService,
@inject(IExtensionContext) private readonly context: IExtensionContext) { }

public async createLanguageClient(_resource: Resource, clientOptions: LanguageClientOptions, env?: NodeJS.ProcessEnv): Promise<LanguageClient> {
let serverModule = this.configurationService.getSettings().languageServerPath;
const languageServerFolder = await this.languageServerFolderService.getLanguageServerFolderName()
const serverModule = path.join(this.context.storagePath, languageServerFolder, this.platformData.engineExecutableName)
if(serverModule === "") {
serverModule = path.join(this.context.storagePath, languageServerFolder, this.platformData.engineExecutableName)
}
const serverOptions: Executable = {
command: serverModule,
args: [],
Expand Down
3 changes: 3 additions & 0 deletions src/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class PythonSettings implements IPythonSettings {
public globalModuleInstallation = false
public analysis!: IAnalysisSettings
public autoUpdateLanguageServer = true
public languageServerPath = ""
public datascience!: IDataScienceSettings

protected readonly changed = new Emitter<void>()
Expand Down Expand Up @@ -147,6 +148,8 @@ export class PythonSettings implements IPythonSettings {
this.downloadLanguageServer = systemVariables.resolveAny(pythonSettings.get<boolean>('downloadLanguageServer', true))!
this.jediEnabled = systemVariables.resolveAny(pythonSettings.get<boolean>('jediEnabled', true))!
this.autoUpdateLanguageServer = systemVariables.resolveAny(pythonSettings.get<boolean>('autoUpdateLanguageServer', true))!
this.languageServerPath = systemVariables.resolveAny(pythonSettings.get<string>('languageServerPath', ''))!

if (this.jediEnabled) {
// tslint:disable-next-line:no-backbone-get-set-outside-model no-non-null-assertion
this.jediPath = systemVariables.resolveAny(pythonSettings.get<string>('jediPath'))!
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export interface IPythonSettings {
readonly globalModuleInstallation: boolean
readonly analysis: IAnalysisSettings
readonly autoUpdateLanguageServer: boolean
readonly languageServerPath: string
readonly datascience: IDataScienceSettings
readonly onDidChange: Event<void>
}
Expand Down