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.hideInterpreterName`:Hide Python interpreter name in status bar., default: `false`
- `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.hideInterpreterName": {
"type": "boolean",
"default": false,
"description": "Hide interpreter name in status bar.",
"scope": "application"
},
"python.disableInstallationCheck": {
"type": "boolean",
"default": false,
Expand Down
2 changes: 2 additions & 0 deletions src/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class PythonSettings implements IPythonSettings {
public analysis!: IAnalysisSettings
public autoUpdateLanguageServer = true
public datascience!: IDataScienceSettings
public hideInterpreterName = false

protected readonly changed = new Emitter<void>()
private workspaceRoot: Uri
Expand Down Expand Up @@ -147,6 +148,7 @@ 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.hideInterpreterName = systemVariables.resolveAny(pythonSettings.get<boolean>('hideInterpreterName', false))!
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 hideInterpreterName: boolean
readonly datascience: IDataScienceSettings
readonly onDidChange: Event<void>
}
Expand Down
10 changes: 9 additions & 1 deletion src/interpreter/display/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IDisposableRegistry, Resource } from '../../common/types'
import { IServiceContainer } from '../../ioc/types'
import { IInterpreterAutoSelectionService } from '../autoSelection/types'
import { IInterpreterDisplay, IInterpreterHelper, IInterpreterService, PythonInterpreter } from '../contracts'
import { IConfigurationService } from '../../common/types'
import { emptyFn } from '../../common/function'

// tslint:disable-next-line:completed-docs
Expand All @@ -16,13 +17,15 @@ export class InterpreterDisplay implements IInterpreterDisplay {
private readonly interpreterService: IInterpreterService
private currentlySelectedInterpreterPath?: string
private currentlySelectedWorkspaceFolder: Resource
private readonly configService: IConfigurationService
private readonly autoSelection: IInterpreterAutoSelectionService

constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) {
this.helper = serviceContainer.get<IInterpreterHelper>(IInterpreterHelper)
this.workspaceService = serviceContainer.get<IWorkspaceService>(IWorkspaceService)
this.interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService)
this.autoSelection = serviceContainer.get<IInterpreterAutoSelectionService>(IInterpreterAutoSelectionService)
this.configService = serviceContainer.get<IConfigurationService>(IConfigurationService)

const application = serviceContainer.get<IApplicationShell>(IApplicationShell)
const disposableRegistry = serviceContainer.get<Disposable[]>(IDisposableRegistry)
Expand Down Expand Up @@ -62,11 +65,16 @@ export class InterpreterDisplay implements IInterpreterDisplay {
}
}
private async updateDisplay(workspaceFolder?: Uri): Promise<void> {
const hideInterpreterName = this.configService.getSettings().hideInterpreterName
await this.autoSelection.autoSelectInterpreter(workspaceFolder)
const interpreter = await this.interpreterService.getActiveInterpreter(workspaceFolder)
this.currentlySelectedWorkspaceFolder = workspaceFolder
if (interpreter) {
this.statusBar.text = interpreter.displayName!
if (hideInterpreterName) {
this.statusBar.text = ''
} else {
this.statusBar.text = interpreter.displayName!
}
this.currentlySelectedInterpreterPath = interpreter.path
} else {
this.statusBar.text = 'No Python Interpreter'
Expand Down