Skip to content

Commit

Permalink
Fix allComponents registration API typo (microsoft#141)
Browse files Browse the repository at this point in the history
Description of changes

Fixes a typo in most sample extensions that incorrectly stated how to register all toolkit components at once.
  • Loading branch information
hawkticehurst authored Apr 4, 2023
1 parent 7dfe1c2 commit f478efc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 43 deletions.
44 changes: 3 additions & 41 deletions default/component-gallery/src/webview/main.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,14 @@
import {
allComponents,
provideVSCodeDesignSystem,
Checkbox,
DataGrid,
vsCodeBadge,
vsCodeButton,
vsCodeCheckbox,
vsCodeDataGrid,
vsCodeDataGridCell,
vsCodeDataGridRow,
vsCodeDivider,
vsCodeDropdown,
vsCodeLink,
vsCodeOption,
vsCodePanels,
vsCodePanelTab,
vsCodePanelView,
vsCodeProgressRing,
vsCodeRadio,
vsCodeRadioGroup,
vsCodeTag,
vsCodeTextArea,
vsCodeTextField,
} from "@vscode/webview-ui-toolkit";

// In order to use the Webview UI Toolkit web components they
// In order to use all the Webview UI Toolkit web components they
// must be registered with the browser (i.e. webview) using the
// syntax below.
provideVSCodeDesignSystem().register(
vsCodeBadge(),
vsCodeButton(),
vsCodeCheckbox(),
vsCodeDataGrid(),
vsCodeDataGridCell(),
vsCodeDataGridRow(),
vsCodeDivider(),
vsCodeDropdown(),
vsCodeLink(),
vsCodeOption(),
vsCodePanels(),
vsCodePanelTab(),
vsCodePanelView(),
vsCodeProgressRing(),
vsCodeRadio(),
vsCodeRadioGroup(),
vsCodeTag(),
vsCodeTextArea(),
vsCodeTextField()
);
provideVSCodeDesignSystem().register(allComponents);

// Just like a regular webpage we need to wait for the webview
// DOM to load before we can reference any of the HTML elements
Expand Down
5 changes: 5 additions & 0 deletions default/hello-world-webpack/src/webview/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { provideVSCodeDesignSystem, vsCodeButton, Button } from "@vscode/webview
// vsCodeButton(),
// vsCodeCheckbox()
// );
//
// Finally, if you would like to register all of the toolkit
// components at once, there's a handy convenience function:
//
// provideVSCodeDesignSystem().register(allComponents);
//
provideVSCodeDesignSystem().register(vsCodeButton());

Expand Down
5 changes: 5 additions & 0 deletions default/hello-world/src/webview/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import { provideVSCodeDesignSystem, vsCodeButton, Button } from "@vscode/webview
// vsCodeCheckbox()
// );
//
// Finally, if you would like to register all of the toolkit
// components at once, there's a handy convenience function:
//
// provideVSCodeDesignSystem().register(allComponents);
//
provideVSCodeDesignSystem().register(vsCodeButton());

// Get access to the VS Code API from within the webview context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ provideVSCodeDesignSystem().register(vsCodeButton());
// vsCodeButton(),
// vsCodeCheckbox()
// );
//
// Finally, if you would like to register all of the toolkit
// components at once, there's a handy convenience function:
//
// provideVSCodeDesignSystem().register(allComponents);

@Component({
selector: "app-root",
Expand Down
2 changes: 1 addition & 1 deletion frameworks/hello-world-solidjs/webview-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ provideVSCodeDesignSystem().register(vsCodeButton());
// Finally, if you would like to register all of the toolkit
// components at once, there's a handy convenience function:
//
// provideVSCodeDesignSystem().register(allComponents.register());
// provideVSCodeDesignSystem().register(allComponents);

const App: Component = () => {
function handleHowdyClick() {
Expand Down
2 changes: 1 addition & 1 deletion frameworks/hello-world-vue/webview-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ provideVSCodeDesignSystem().register(vsCodeButton());
// Finally, if you would like to register all of the toolkit
// components at once, there's a handy convenience function:
//
// provideVSCodeDesignSystem().register(allComponents.register());
// provideVSCodeDesignSystem().register(allComponents);
function handleHowdyClick() {
vscode.postMessage({
Expand Down

0 comments on commit f478efc

Please sign in to comment.