Skip to content

Commit

Permalink
add renv external documentation link to project wizard (#2790)
Browse files Browse the repository at this point in the history
* allow `ExternalLink` to include `props.children`

Keyboard support for pressing Space or Enter when the `ExternalLink` is focused seems to be missing.

* add external link to renv documentation

* align renv external link icon with checkbox text
  • Loading branch information
sharon-wang authored Apr 18, 2024
1 parent 25fff84 commit 19bc50f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/vs/base/browser/ui/ExternalLink/ExternalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ export function ExternalLink(props: ExternalLinkProps) {
e.preventDefault();
openerService.open(href);
}}
/>;
>
{props.children}
</a>
;
}
2 changes: 2 additions & 0 deletions src/vs/workbench/browser/actions/positronActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ILanguageRuntimeService } from 'vs/workbench/services/languageRuntime/c
import { IRuntimeSessionService } from 'vs/workbench/services/runtimeSession/common/runtimeSessionService';
import { IRuntimeStartupService } from 'vs/workbench/services/runtimeStartup/common/runtimeStartupService';
import { ILogService } from 'vs/platform/log/common/log';
import { IOpenerService } from 'vs/platform/opener/common/opener';

/**
* The PositronNewProjectAction.
Expand Down Expand Up @@ -78,6 +79,7 @@ export class PositronNewProjectAction extends Action2 {
accessor.get(ILanguageRuntimeService),
accessor.get(IWorkbenchLayoutService),
accessor.get(ILogService),
accessor.get(IOpenerService),
accessor.get(IPathService),
accessor.get(IRuntimeSessionService),
accessor.get(IRuntimeStartupService),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
*--------------------------------------------------------------------------------------------*/

.positron-modal-dialog-box
.wizard-step
.renv-configuration {
display: flex;
flex-direction: row;
column-gap: 6px;
}

.positron-modal-dialog-box
.wizard-step
.renv-configuration
.renv-docs-external-link {
display: flex;
align-items: center;
}

.positron-modal-dialog-box
.wizard-step
.renv-configuration
.codicon-link-external {
color: var(--vscode-textLink-foreground);
cursor: pointer;
font-size: 14px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
*--------------------------------------------------------------------------------------------*/

// CSS.
import 'vs/css!./rConfigurationStep';

// React.
import * as React from 'react';
import { PropsWithChildren, useEffect, useState } from 'react'; // eslint-disable-line no-duplicate-imports
Expand All @@ -20,6 +23,7 @@ import { getRInterpreterEntries } from 'vs/workbench/browser/positronNewProjectW
import { InterpreterEntry } from 'vs/workbench/browser/positronNewProjectWizard/components/steps/pythonInterpreterEntry';
import { LanguageIds } from 'vs/workbench/browser/positronNewProjectWizard/interfaces/newProjectWizardEnums';
import { getSelectedInterpreter } from 'vs/workbench/browser/positronNewProjectWizard/utilities/interpreterDropDownUtils';
import { ExternalLink } from 'vs/base/browser/ui/ExternalLink/ExternalLink';

/**
* The RConfigurationStep component is specific to R projects in the new project wizard.
Expand Down Expand Up @@ -167,13 +171,23 @@ export const RConfigurationStep = (props: PropsWithChildren<NewProjectWizardStep
'Additional Configuration'
))()}
>
<Checkbox
label={(() => localize(
'rConfigurationStep.additionalConfigSubStep.useRenv.label',
'Use `renv` to create a reproducible environment'
))()}
onChanged={checked => setProjectConfig({ ...projectConfig, useRenv: checked })}
/>
<div className='renv-configuration'>
<Checkbox
label={(() => localize(
'rConfigurationStep.additionalConfigSubStep.useRenv.label',
'Use `renv` to create a reproducible environment'
))()}
onChanged={checked => setProjectConfig({ ...projectConfig, useRenv: checked })}
/>
<ExternalLink
className='renv-docs-external-link'
openerService={newProjectWizardState.openerService}
href='https://rstudio.github.io/renv/articles/renv.html'
title='https://rstudio.github.io/renv/articles/renv.html'
>
<div className='codicon codicon-link-external' />
</ExternalLink>
</div>
</PositronWizardSubStep>
</PositronWizardStep>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { IPathService } from 'vs/workbench/services/path/common/pathService';
import { IFileService } from 'vs/platform/files/common/files';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { ILogService } from 'vs/platform/log/common/log';
import { IOpenerService } from 'vs/platform/opener/common/opener';

/**
* Shows the NewProjectModalDialog.
Expand All @@ -32,6 +33,7 @@ export const showNewProjectModalDialog = async (
languageRuntimeService: ILanguageRuntimeService,
layoutService: IWorkbenchLayoutService,
logService: ILogService,
openerService: IOpenerService,
pathService: IPathService,
runtimeSessionService: IRuntimeSessionService,
runtimeStartupService: IRuntimeStartupService,
Expand All @@ -53,6 +55,7 @@ export const showNewProjectModalDialog = async (
languageRuntimeService,
layoutService,
logService,
openerService,
pathService,
runtimeSessionService,
runtimeStartupService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { EnvironmentSetupType, NewProjectType, NewProjectWizardStep, PythonEnvir
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ILogService } from 'vs/platform/log/common/log';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IPathService } from 'vs/workbench/services/path/common/pathService';
import { IFileService } from 'vs/platform/files/common/files';

Expand All @@ -25,6 +26,7 @@ interface NewProjectWizardServices {
languageRuntimeService: ILanguageRuntimeService;
layoutService: IWorkbenchLayoutService;
logService: ILogService;
openerService: IOpenerService;
pathService: IPathService;
runtimeSessionService: IRuntimeSessionService;
runtimeStartupService: IRuntimeStartupService;
Expand Down

0 comments on commit 19bc50f

Please sign in to comment.