Skip to content

IDE2 throws error when remote sketchbook tree is active and clicking in the settings.json file #1594

Open
@kittaakos

Description

@kittaakos

Describe the problem

See title.

Error:

sketchbook-widget-contribution.ts:246 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'revealFile')
    at SketchbookWidgetContribution.selectWidgetFileNode (sketchbook-widget-contribution.ts:246)

The problem should be solved here.

async selectWidgetFileNode(widget: Widget | undefined): Promise<void> {
if (Navigatable.is(widget)) {
const resourceUri = widget.getResourceUri();
if (resourceUri) {
const treeWidget = (await this.widget).getTreeWidget();
const { model } = treeWidget;
const node = await model.revealFile(resourceUri);
if (SelectableTreeNode.is(node)) {
model.selectNode(node);
}
}
}
}
protected onCurrentWidgetChangedHandler(): void {
this.selectWidgetFileNode(this.shell.currentWidget);
}

To reproduce

Open the cloud sketchbook tree and the settings.jon file and edit the settings.json file. IDE2 tries to blindly reveal the corresponding node in the sketchbook tree, but it's not there.

Expected behavior

No error.

Arduino IDE version

#1581, but I think it's the same from the main

Operating system

macOS

Operating system version

12.5.1

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: cloudRelated to Arduino Cloud and cloud sketchestopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions