Commit 86604fc
committed
feat(json): JSON code intelligence - schema LSP, npm hints, vuln squigglies, dep hover
New integrated extension src/extensionsIntegrated/JSONSupport with
WebStorm-class intelligence for JSON files, on the existing multi-server
LSP framework:
1. JSON language server (desktop): vscode-json-language-server (from
vscode-langservers-extracted, resolved via src-node/node_modules/.bin)
with lazy start on the first JSON file and repoint-not-restart on project
switch. Curated schemastore.org associations (package.json, ts/jsconfig,
eslintrc, babelrc, prettierrc, composer, manifests, ...) are pushed via
workspace/didChangeConfiguration after every server up-transition; the
server downloads the schemas itself. Serves all json docs as jsonc
(comment-tolerant, matching real-world tsconfig/.eslintrc), yields
Phoenix pref files to PrefsCodeHints via the new documentFilter, and
opts into completionSnippetSupport (the server refuses to offer
completion without snippet support; insertHint already expands snippets
through TabstopManager).
2. npm package intelligence in package.json (all builds):
- Name completion in dependency keys: registry search in relevance
order, typed-query emphasis via the standard .matched-hint style,
descriptions in the reusable side docs popup (showHintDocPopup /
hideHintDocPopup now exported from DefaultProviders) instead of
widening the rows. Explicit Ctrl-Space searches the whole token under
the cursor and skips the typing debounce.
- Version completion in values: the package's real version list newest
first with ^latest/~latest range shortcuts; typed prefixes filter the
FULL list (a 5.x prefix surfaces the 5.x train even when the newest 50
are 7.x) and fall back to newest when nothing matches. Name insertion
chains straight into version mode.
- Dependency hover (QuickView): registry summary - name, latest version,
license, description - with Open homepage and a View docs link pinned
bottom-right that opens the npm page anchored at the DECLARED version
("^5.4.11" -> /v/5.4.11, where npm renders that version's README).
3. Vulnerability squigglies: each declared range is resolved to the
version npm would install (semver.maxSatisfying over the real version
list) and checked against npm's bulk security-advisory endpoint (the
npm-audit data source). Severity-mapped (critical/high error, moderate
warning, low info), whole-entry underlines, capped and deduped per dep.
The endpoint has no CORS headers (verified), so desktop goes straight to
the new ph-npm-intel node helper - no doomed browser POST spamming the
console; browser builds try fetch and degrade quietly. scanFileAsync
never blocks on the network: cached results return immediately and a
single-flighted, dep-hash-gated background refresh requestRun()s on
change.
Framework hardening along the way:
- src-node/lsp-client.js answers server-initiated requests (spec-shaped
null results for workspace/configuration & friends, -32601 otherwise)
so no server can hang awaiting a reply the browser never sends.
- LanguageClient.sendCustomNotification; per-server documentFilter and
completionSnippetSupport (per-config client capabilities); _notify now
logs AND propagates failures so DocumentSync's lost-notification
resync hardening actually engages.
- Hover typography: the shared .lsp-hover-quickview family (JSON schema
hover, JS/TS hover, hint docs popup) moves to the 13px+ readability
baseline; popup headings lose their asymmetric browser margins.
Tests: unit:JSONSupport npm intelligence 18/18 (dep-range scanner,
severity mapping/dedup, registry client with injected fetcher incl.
caching + bulk body, hint context detection, full-list version filter +
fallback, npm page URLs); integration:JSON LSP 3/3 (server syntax
diagnostics, inline-schema validation with no network, advisory
squigglies with fake fetcher); regressions integration:TypeScript LSP
20/20 and LegacyInteg:CodeHintManager 13/13.1 parent d1a823f commit 86604fc
24 files changed
Lines changed: 2359 additions & 21 deletions
File tree
- docs/API-Reference
- language
- widgets
- src-node
- src
- extensionsIntegrated
- JSONSupport
- languageTools
- nls/root
- styles
- test
- spec
- JSONSupport-test-files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
145 | 150 | | |
146 | | - | |
| 151 | + | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
151 | 193 | | |
152 | 194 | | |
153 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
0 commit comments