fix(editor): Pi kinds end in digits — test the full board id before stripping the instance suffix
'raspberry-pi-3' minus the numeric suffix is 'raspberry-pi', which matches no kind, so freshly added Pis regressed to a sketch.ino group.
This commit is contained in:
parent
248d8b5e97
commit
cdf4aad4ae
|
|
@ -387,11 +387,14 @@ export const useEditorStore = create<EditorState>((set, get) => ({
|
||||||
// Determine default file by group name convention or language mode.
|
// Determine default file by group name convention or language mode.
|
||||||
// All QEMU-Linux boards (Pi Zero/1/2/3/4/5 plus overlay piFamily
|
// All QEMU-Linux boards (Pi Zero/1/2/3/4/5 plus overlay piFamily
|
||||||
// kinds like the UNIHIKER) default to script.py. Group ids follow
|
// kinds like the UNIHIKER) default to script.py. Group ids follow
|
||||||
// `group-<boardId>` and the first board of a kind uses the kind as
|
// `group-<boardId>`; the first board of a kind uses the kind as its
|
||||||
// its id ('-N' suffix for later instances), so strip both and ask
|
// id, later instances append '-N'. Test the FULL id first — kinds
|
||||||
// isPiBoardKind — the same predicate every other Pi code path uses.
|
// themselves end in digits ('raspberry-pi-3'), so stripping the
|
||||||
const boardIdPart = groupId.replace(/^group-/, '').replace(/-\d+$/, '');
|
// numeric suffix unconditionally would mangle them ('raspberry-pi'
|
||||||
const isPi = isPiBoardKind(boardIdPart);
|
// matched nothing and Pis regressed to sketch.ino).
|
||||||
|
const boardIdPart = groupId.replace(/^group-/, '');
|
||||||
|
const isPi =
|
||||||
|
isPiBoardKind(boardIdPart) || isPiBoardKind(boardIdPart.replace(/-\d+$/, ''));
|
||||||
const isMicroPython = languageMode === 'micropython';
|
const isMicroPython = languageMode === 'micropython';
|
||||||
const mainId = `${groupId}-main`;
|
const mainId = `${groupId}-main`;
|
||||||
let fileName: string;
|
let fileName: string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue