Skip to content

Commit f478efc

Browse files
Fix allComponents registration API typo (microsoft#141)
Description of changes Fixes a typo in most sample extensions that incorrectly stated how to register all toolkit components at once.
1 parent 7dfe1c2 commit f478efc

File tree

6 files changed

+20
-43
lines changed

6 files changed

+20
-43
lines changed

default/component-gallery/src/webview/main.ts

+3-41
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,14 @@
11
import {
2+
allComponents,
23
provideVSCodeDesignSystem,
34
Checkbox,
45
DataGrid,
5-
vsCodeBadge,
6-
vsCodeButton,
7-
vsCodeCheckbox,
8-
vsCodeDataGrid,
9-
vsCodeDataGridCell,
10-
vsCodeDataGridRow,
11-
vsCodeDivider,
12-
vsCodeDropdown,
13-
vsCodeLink,
14-
vsCodeOption,
15-
vsCodePanels,
16-
vsCodePanelTab,
17-
vsCodePanelView,
18-
vsCodeProgressRing,
19-
vsCodeRadio,
20-
vsCodeRadioGroup,
21-
vsCodeTag,
22-
vsCodeTextArea,
23-
vsCodeTextField,
246
} from "@vscode/webview-ui-toolkit";
257

26-
// In order to use the Webview UI Toolkit web components they
8+
// In order to use all the Webview UI Toolkit web components they
279
// must be registered with the browser (i.e. webview) using the
2810
// syntax below.
29-
provideVSCodeDesignSystem().register(
30-
vsCodeBadge(),
31-
vsCodeButton(),
32-
vsCodeCheckbox(),
33-
vsCodeDataGrid(),
34-
vsCodeDataGridCell(),
35-
vsCodeDataGridRow(),
36-
vsCodeDivider(),
37-
vsCodeDropdown(),
38-
vsCodeLink(),
39-
vsCodeOption(),
40-
vsCodePanels(),
41-
vsCodePanelTab(),
42-
vsCodePanelView(),
43-
vsCodeProgressRing(),
44-
vsCodeRadio(),
45-
vsCodeRadioGroup(),
46-
vsCodeTag(),
47-
vsCodeTextArea(),
48-
vsCodeTextField()
49-
);
11+
provideVSCodeDesignSystem().register(allComponents);
5012

5113
// Just like a regular webpage we need to wait for the webview
5214
// DOM to load before we can reference any of the HTML elements

default/hello-world-webpack/src/webview/main.ts

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { provideVSCodeDesignSystem, vsCodeButton, Button } from "@vscode/webview
1212
// vsCodeButton(),
1313
// vsCodeCheckbox()
1414
// );
15+
//
16+
// Finally, if you would like to register all of the toolkit
17+
// components at once, there's a handy convenience function:
18+
//
19+
// provideVSCodeDesignSystem().register(allComponents);
1520
//
1621
provideVSCodeDesignSystem().register(vsCodeButton());
1722

default/hello-world/src/webview/main.ts

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import { provideVSCodeDesignSystem, vsCodeButton, Button } from "@vscode/webview
1313
// vsCodeCheckbox()
1414
// );
1515
//
16+
// Finally, if you would like to register all of the toolkit
17+
// components at once, there's a handy convenience function:
18+
//
19+
// provideVSCodeDesignSystem().register(allComponents);
20+
//
1621
provideVSCodeDesignSystem().register(vsCodeButton());
1722

1823
// Get access to the VS Code API from within the webview context

frameworks/hello-world-angular/webview-ui/src/app/app.component.ts

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ provideVSCodeDesignSystem().register(vsCodeButton());
1515
// vsCodeButton(),
1616
// vsCodeCheckbox()
1717
// );
18+
//
19+
// Finally, if you would like to register all of the toolkit
20+
// components at once, there's a handy convenience function:
21+
//
22+
// provideVSCodeDesignSystem().register(allComponents);
1823

1924
@Component({
2025
selector: "app-root",

frameworks/hello-world-solidjs/webview-ui/src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ provideVSCodeDesignSystem().register(vsCodeButton());
2020
// Finally, if you would like to register all of the toolkit
2121
// components at once, there's a handy convenience function:
2222
//
23-
// provideVSCodeDesignSystem().register(allComponents.register());
23+
// provideVSCodeDesignSystem().register(allComponents);
2424

2525
const App: Component = () => {
2626
function handleHowdyClick() {

frameworks/hello-world-vue/webview-ui/src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ provideVSCodeDesignSystem().register(vsCodeButton());
1919
// Finally, if you would like to register all of the toolkit
2020
// components at once, there's a handy convenience function:
2121
//
22-
// provideVSCodeDesignSystem().register(allComponents.register());
22+
// provideVSCodeDesignSystem().register(allComponents);
2323
2424
function handleHowdyClick() {
2525
vscode.postMessage({

0 commit comments

Comments
 (0)