Skip to content

Commit

Permalink
Minor format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asimgunes committed Nov 8, 2023
1 parent 01558fb commit 049b5cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
30 changes: 14 additions & 16 deletions docs/extending-svd-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<api.PeripheralOptions[]> {
// 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<api.SVDViewerAPI>('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());
}
...
}
```

Expand Down
8 changes: 4 additions & 4 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export interface SVDViewerAPI {
}

export interface IPeripheralsProvider {
getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise<PeripheralOptions[]>;
getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise<PeripheralOptions[]>;
}

export interface IGetPeripheralsArguments {
gapThreshold: number;
gapThreshold: number;
}

export interface PeripheralOptions {
Expand Down Expand Up @@ -61,11 +61,11 @@ export interface FieldOptions {
}

export interface IGetPeripheralsArguments {
gapThreshold: number;
gapThreshold: number;
}

export interface IPeripheralsProvider {
getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise<PeripheralOptions[]>;
getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise<PeripheralOptions[]>;
}

export enum AccessType {
Expand Down

0 comments on commit 049b5cd

Please sign in to comment.