Skip to content

Conversation

@karrtikr
Copy link

@karrtikr karrtikr commented Aug 3, 2021

Closes #16577 closes https://github.com/microsoft/vscode-python-internalbacklog/issues/342

@karthiknadig Please merge this after reviewing as no one else is available to review.

@github-actions github-actions bot requested a review from karthiknadig August 3, 2021 19:34
@karrtikr karrtikr changed the title Use the appropriate API to find out what terminal is being used Use VSCode API appropriately to find out what terminal is being used Aug 3, 2021
): TerminalShellType | undefined {
if (!this.appEnv.shell) {
const shellPath =
terminal?.creationOptions && 'shellPath' in terminal.creationOptions && terminal.creationOptions.shellPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
terminal?.creationOptions && 'shellPath' in terminal.creationOptions && terminal.creationOptions.shellPath
terminal?.creationOptions && terminal.creationOptions.shellPath

Shouldn't that just work? if a field is not defined on an object, it is just returns undefined.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, atleast not for the type check compiler.

shellPath property doesn't exist on type of terminal.creationOptions (which is Readonly<TerminalOptions | ExtensionTerminalOptions>), so we have to narrow down the type first to Readonly<TerminalOptions> using this.

@karrtikr
Copy link
Author

karrtikr commented Aug 3, 2021

@karthiknadig If you find everything okay can you also merge this PR as I mentioned here #16858 (comment)

@karthiknadig karthiknadig merged commit 5070d30 into microsoft:main Aug 3, 2021
@karrtikr karrtikr deleted the vscspai branch August 3, 2021 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the vscode API appropriately to find out what terminal is being used

2 participants