diff --git a/docs/extending-svd-viewer.md b/docs/extending-svd-viewer.md index e323be5..1902dbd 100644 --- a/docs/extending-svd-viewer.md +++ b/docs/extending-svd-viewer.md @@ -27,33 +27,31 @@ You can find the example command implementation below: ```js import { ExtensionContext } from 'vscode'; -import { - api -} from "svd-viewer"; +import { api } from "svd-viewer"; class MyExtensionProvider implements api.IPeripheralsProvider { public async getPeripherals (data: string, options: api.IGetPeripheralsArguments): Promise { // Load your peripherals data - const peripherals: api.PeripheralOptions[] = ... - return peripherals; + const peripherals: api.PeripheralOptions[] = ... + return peripherals; } } export async function activate(context: ExtensionContext) { - ... - // Get the eclipse-cdt.svd-viewer extension + ... + // Get the eclipse-cdt.svd-viewer extension const svdViewerExtension = extensions.getExtension('eclipse-cdt.svd-viewer'); - // Check if the eclipse-cdt.svd-viewer extension is installed - if (svdViewerExtension) { - const svdViewerAPI = await svdViewerExtension.activate(); - - // Invoke registerPeripheralsProvider method in eclipse-cdt.svd-viewer extension api - // Register 'MyExtensionProvider' for files *.myext - svdViewerAPI.registerPeripheralsProvider('myext', new MyExtensionProvider()); - } - ... + // Check if the eclipse-cdt.svd-viewer extension is installed + if (svdViewerExtension) { + const svdViewerAPI = await svdViewerExtension.activate(); + + // Invoke registerPeripheralsProvider method in eclipse-cdt.svd-viewer extension api + // Register 'MyExtensionProvider' for files *.myext + svdViewerAPI.registerPeripheralsProvider('myext', new MyExtensionProvider()); + } + ... } ``` diff --git a/src/api.ts b/src/api.ts index 6a27859..990da85 100644 --- a/src/api.ts +++ b/src/api.ts @@ -8,11 +8,11 @@ export interface SVDViewerAPI { } export interface IPeripheralsProvider { - getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise; + getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise; } export interface IGetPeripheralsArguments { - gapThreshold: number; + gapThreshold: number; } export interface PeripheralOptions { @@ -61,11 +61,11 @@ export interface FieldOptions { } export interface IGetPeripheralsArguments { - gapThreshold: number; + gapThreshold: number; } export interface IPeripheralsProvider { - getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise; + getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise; } export enum AccessType {