[VS Code extension 1.0.2] "c is not a constructor" on things.addItems, plus didOpen/didChange TypeErrors — all three fixed by downgrading to 1.0.0

Since installing the openHAB VS Code extension 1.0.2 I see three separate
failures. All three disappear after downgrading to 1.0.0 and reappear after
upgrading again, so they look like one bundling problem in the 1.0.2 build
rather than three unrelated bugs.

Environment

  • openHAB 5.2.0 (official Docker image), conf/ reached from VS Code over a
    UNC path (\…\openhab5.2.0\conf)
  • VS Code on Windows
  • openHAB VS Code extension 1.0.2 (upgraded from 1.0.0 to get hover on .js files)
  1. “Add all items to file” fails for every Thing
    Error running command openhab.command.things.addItems: c is not a
    constructor. This is likely caused by the extension that contributes
    openhab.command.things.addItems.
    Reproduce: Things view → any Thing → add ALL items of that Thing to a
    file. Fails for every Thing, regardless of binding.
    Adding a SINGLE item/channel still works normally. So only the bulk path
    is broken, not item creation as such.

  2. Language server TypeErrors on every openHAB file
    Editing any openHAB file (.items, .things, .rules, .sitemap) throws on
    textDocument/didOpen and textDocument/didChange. Adding a single space is
    enough to trigger it. Editing a .js file does not trigger it.

  3. File watcher errors on the UNC path
    ERR_NETWORK_IO_SUSPENDED / “UNC host not allowed” while watching conf/.

  4. Deprecation notice
    VS Code emits a deprecation notice for this extension on 1.0.2
    (reproducible with Code --trace-deprecation). It is absent on 1.0.0.

What I verified

  • 1.0.2: all four present.
  • 1.0.0: all four gone, including the addItems command, which works normally.

“c is not a constructor” on a minified identifier suggests a dependency that is no longer a constructor after bundling. That the single-item path still works while the bulk path throws would fit a class that is only instantiated when iterating over a Thing’s channels. The deprecation notice appearing in the same version may point at that same dependency.

Note on impact: I upgraded to 1.0.2 specifically for item hover in .js files.
Staying on 1.0.0 to avoid these four issues means giving that up, so right now
there is no version that offers both.

Happy to supply full stack traces or test a build.

Fixed in : https://github.com/HenmusZev/openhab-vscode/tree/v1.0.3

404 - page not found

The requested file could not be found in HenmusZev/openhab-vscode.

Should work now

Thx, works, c is not a constructor error is gone :+1:

Unfortunately the state for yaml configured items are not shown anymore:

(screenshot is from version 1.0.2)

The defaults in 1.0.3 are the same as in 1.0.2, so nothing changes out of the box. Two fixes on top: the ascii-table import that was not constructable under module: Node16 (#386), and the HoverProvider tests that called a method removed during the hover rework.

And the addition you need here: the hover’s document selector is configurable. To switch it on for YAML, add the pattern:

"openhab.hover.filePatterns": ["**/*.sitemap", "**/*.yaml"],

Takes effect without reloading the window.

Oh, right—sorry, I now recall that I also performed this step in the old version manually.

Edit: wow, I just realized you also have completely rewritten the addon description and that yaml addition can now be added through the addon config. Great work :+1:
Sad it will not get added to the main branch :sweat_smile: