eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.05k stars 2.5k forks source link

Cannot read properties of null (reading 'label') in TreeViewExtImpl.getTreeItemLabel #13001

Closed Lythenas closed 1 year ago

Lythenas commented 1 year ago

Bug Description:

The "SonarLint Issues Location" view thing (not sure what to call it, it is in the file explorer at the bottom, expandable) is not working. When trying to expand it, it throws the following error:

2023-10-16T10:44:49.509Z root ERROR Failed to fetch children for 'SonarLint.IssueLocations' TypeError: Cannot read properties of null (reading 'label')
    at TreeViewExtImpl.getTreeItemLabel (/home/theia/node_modules/@theia/plugin-ext/lib/plugin/tree/tree-views.js:261:40)
    at TreeViewExtImpl.getItemLabel (/home/theia/node_modules/@theia/plugin-ext/lib/plugin/tree/tree-views.js:269:28)
    at /home/theia/node_modules/@theia/plugin-ext/lib/plugin/tree/tree-views.js:315:36
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)

Steps to Reproduce:

  1. Install the SonarLint plugin: https://open-vsx.org/extension/SonarSource/sonarlint-vscode (last tested on version 3.13)
  2. Expand the "SonarLint Issues Location" view in the file explorer
  3. Nothing shows up in the expanded view
  4. See above error in the browser console and log

Additional Information

msujew commented 1 year ago

@Lythenas Can you test whether this affects the latest version of Theia (preferably using the current master branch)? The version you're using is fairly old.

Lythenas commented 1 year ago

I just tried it on gitpod (first time using that). And I see the same error:

2023-10-22T12:43:23.887Z root ERROR Failed to fetch children for 'SonarLint.IssueLocations' TypeError: Cannot read properties of null (reading 'label')
    at TreeViewExtImpl.getTreeItemLabel (/workspace/theia/examples/browser/lib/backend/plugin-host.js:19131:40)
    at TreeViewExtImpl.getItemLabel (/workspace/theia/examples/browser/lib/backend/plugin-host.js:19139:28)
    at /workspace/theia/examples/browser/lib/backend/plugin-host.js:19198:36
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
msujew commented 1 year ago

I see. Seems like vscode is a bit lax in what it accepts as return values from data tree providers. Extensions aren't actually allowed to return null or undefined, but seems like the SonarLint extension does anyway, see here. I've submitted a fix for this in https://github.com/eclipse-theia/theia/pull/13018.

Lythenas commented 1 year ago

Thanks for the quick response, that fixes the issue.

I think the sonarlint plugin might have more issues. On gitpod the webviews were not working, but they worked before on my local setup. But I will open new issues if I run into anything.

msujew commented 1 year ago

On gitpod the webviews were not working

That's because webviews are served on subdomains which aren't routed correctly to Gitpod - that behavior is expected. Theia webviews need special reverse proxying.