Skip to content

Commit

Permalink
Fixed no processors bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thegecko committed Mar 24, 2023
1 parent ea4b740 commit ac90262
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 61 deletions.
3 changes: 3 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"name": "Desktop Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
]
Expand Down
9 changes: 3 additions & 6 deletions src/svd-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { SvdRegistry } from './svd-registry';
import { parsePackString, pdscFromPack, fileFromPack, Pack } from './cmsis-pack/pack-utils';
import { PDSC, Device, DeviceVariant, getDevices, getSvdPath, getProcessors } from './cmsis-pack/pdsc';
import { readFromUrl } from './utils';
import { getSelection } from './vscode-utils';

export class SvdResolver {
public constructor(protected registry: SvdRegistry) {
Expand Down Expand Up @@ -90,8 +89,7 @@ export class SvdResolver {
packDevice = devices[0];
} else {
// Ask user which device to use
const items = [...deviceMap.keys()].map(label => ({ label }));
const selected = await getSelection('Select a device', items, deviceName);
const selected = await vscode.window.showQuickPick([...deviceMap.keys()], { title: 'Select a device', placeHolder: deviceName });
if (!selected) {
return;
}
Expand All @@ -115,10 +113,9 @@ export class SvdResolver {
// Keep existing processor name
} else if (!processorName && processors.length == 1) {
processorName = processors[0];
} else {
} else if (processors.length > 1) {
// Ask user which processor to use
const items = processors.map(label => ({ label }));
const selected = await getSelection('Select a processor', items, processorName);
const selected = await vscode.window.showQuickPick(processors, { title: 'Select a processor', placeHolder: processorName });
if (!selected) {
return;
}
Expand Down
10 changes: 9 additions & 1 deletion src/views/peripheral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { AddrRange } from '../addrranges';
import { DebugTracker } from '../debug-tracker';
import { SvdResolver } from '../svd-resolver';
import { readFromUrl } from '../utils';
import { uriExists } from '../vscode-utils';

const STATE_FILENAME = '.svd-viewer.json';

Expand All @@ -40,6 +39,15 @@ const pathToUri = (path: string): vscode.Uri => {
}
};

const uriExists = async (uri: vscode.Uri): Promise<boolean> => {
try {
await vscode.workspace.fs.stat(uri);
return true;
} catch {
return false;
}
};

export class PeripheralTreeForSession extends PeripheralBaseNode {
public myTreeItem: vscode.TreeItem;
private peripherials: PeripheralNode[] = [];
Expand Down
54 changes: 0 additions & 54 deletions src/vscode-utils.ts

This file was deleted.

0 comments on commit ac90262

Please sign in to comment.