fix(vscode): resolve HANA connection from config in subfolders#182
Merged
Conversation
The extension resolver only inspected the workspace root, so CAP projects that keep their connection config in a subfolder (e.g. cap/) showed "HANA: Not Connected" even though .cdsrc-private.json / default-env.json existed one level down. - Add discovery.ts: bounded recursive scan for directories containing .cdsrc-private.json, default-env.json, or a CAP package.json (skips node_modules/.git/build dirs; shallowest-first) - Refactor resolver to resolveConnectionInDir(dir) so it resolves any directory and uses it as cwd for cds env / cf service-key - extension.ts: honor new hana-cli.projectPath setting, else auto-scan, prompting via QuickPick when multiple candidates are found - Add hana-cli.projectPath configuration contribution + README docs Also enhance `hana-cli vscode status` to compare the installed extension version against the packaged .vsix and suggest updating (install now uses --force to upgrade in place). Tests: discovery.test.ts (6) + vscodeVersion.Test.js (10), all green.
jung-thomas
added a commit
that referenced
this pull request
Jul 14, 2026
…183) Two related artifact-inspector bugs in the VS Code extension: 1. Clicking an .hdbtable/.hdbview/etc. opened the inspector but left the object-name input empty. The extension posted an `openArtifact` message that no Vue component consumed. Fix: pass the name as a route query param the views already read (e.g. /inspect-table?table=NAME), matching how the browser UI navigates. Covers all artifact kinds. 2. Type-ahead suggestions never appeared in webview inputs. useSuggestions fetched with relative URLs, which resolve against the vscode-webview:// origin instead of the http://localhost:<port> server. Fix: prefix fetches with getAdapter().getApiBaseUrl(), matching useHanaApi. Also cut release 4.202607.1 (via scripts/prepare-release.js) documenting these fixes plus the unreleased subfolder connection-resolution work and `vscode status` update-check from PR #182. Tests: new useSuggestions vitest (TDD red->green); full vue suite 51/51. Co-authored-by: Thomas Jung <12159356+jung-thomas@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The VS Code extension's connection resolver only inspected the workspace root. CAP projects that keep their connection config in a subfolder (e.g.
cap/) showed "HANA: Not Connected" even though.cdsrc-private.json/default-env.jsonexisted one level down. Thecwdpassed tocds env/cf service-keywas also the root, so binding resolution would fail there too.Reproduced with the
cloud-cap-hana-swapiproject (config lives incap/).Fix
discovery.ts(new) — pure, bounded recursive scan (default depth 3) for directories containing.cdsrc-private.json,default-env.json, or a CAPpackage.json. Skipsnode_modules/.git/build dirs; returns candidates shallowest-first.resolver.ts— refactored toresolveConnectionInDir(dir)so it resolves any directory and uses that dir as thecwdforcds env/cf service-key.resolveConnection(workspaceFolder)kept as a thin wrapper.extension.ts— newautoResolveConnection(): honors ahana-cli.projectPathsetting if set, otherwise scans, uses the single candidate directly, or shows a QuickPick when several exist.package.json— adds thehana-cli.projectPathconfiguration contribution.Bonus:
hana-cli vscode statusEnhanced to compare the installed extension version against the packaged
.vsixand suggest updating when behind.installnow uses--forceso it upgrades in place (no uninstall needed).Testing
vscode-extension/test/suite/discovery.test.ts— 6 tests (subfolder detection, shallowest-first ordering, ignore rules, depth limit). ✅tests/vscodeVersion.Test.js— 10 tests forcompareVersions/parseVsixVersion/parseInstalledVersion. ✅tsconfigcompiles clean (strict).cloud-cap-hana-swapi: discovery findscap/andcds env ... --resolve-bindingsresolves credentials from that cwd → status bar shows connected.vscode statusverified in both branches (up-to-date and update-available).Notes
CHANGELOG.json/CHANGELOG.mdintentionally untouched — this repo manages the changelog at release time viascripts/prepare-release.js, not per-PR.