Skip to content

perf: what the first request in a workspace costs - #89

Open
ewanharris wants to merge 11 commits into
mainfrom
feat/first-request-cost
Open

ewanharris wants to merge 11 commits into
mainfrom
feat/first-request-cost

Conversation

@ewanharris

@ewanharris ewanharris commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Three changes to what the first request in a workspace costs, plus the stylesheet gap that
prompted the investigation. Each is its own commit.

The first request

AcquiredTypes.locate asked npm for the published version list before install ever looked at
the cache, so every registered project paid a npm view @types/titanium versions --json spawn to
establish a version already sitting on disk. The delay is user-visible because
ServiceLocator.routeOf awaits refresh(), which awaits openServices, so a completion blocks
on type resolution rather than returning early — and openServices warms every project in the
workspace, including ones the user is not editing.

Measured against ~/Documents/titanium-workspace (an Alloy project beside a classic one, both on
SDK 13.2.0.GA, with @types/titanium 13.3.0 already in ~/.titanium/types), first
textDocument/completion in app/styles/index.tss:

first completion second, third
before, three runs 1741ms / 1218ms / 1211ms 3-10ms
before, with npm absent from PATH 638ms —
after, warm cache, three runs 735ms / 698ms / 755ms 3-11ms
after, first run with no record yet 1447ms —

Reproduced independently in a second checkout: 1790ms before against 731ms after, 2ms on the
second and third either way.

The cache is consulted first, and only when it holds the SDK's own major — nearly every project,
and the case where asking the registry can only turn up a release that adds members to the same
major. An older major is the rarest answer and the one most worth getting right, so it is never
taken from a cache on trust, however recently the registry answered.

Staleness is bounded by a record of when the registry last answered, written beside the cached
versions, and the window is a day. A background refresh after answering was the alternative: it
costs the same spawn, just moved off the critical path, and its result can only be acted on by
rebuilding a language service at an arbitrary moment mid-session. An mtime check on the cache
directory was the other: that records when something was last installed rather than when the
registry was last asked, so a cache that answered correctly months ago would go stale after a
day and re-spawn npm on every cold start from then on. The record also makes the window
machine-wide rather than per project, which is what removes the second spawn in a two-project
workspace.

It is written only when npm actually answered. A failed check establishes nothing about what is
published, and letting it stand in for a real one would pin a machine to its cache on the strength
of a failure. The cost is that an offline machine still pays the spawn, which npm fails fast
enough for.

The three ways a version can now be chosen report differently, because answering from a fresh
cache on purpose is not the registry being unreachable and must not be described as it. A cached
answer says when npm was last asked (from the cache; npm was last asked what is published 3 hours ago); only a failed check says it could not be reached.

Types from the installed SDK

A third source, between the project's own copy and npm. The SDK's declarations are generated from
the very SDK being built against, so they describe it exactly rather than trailing it — SDK
13.4.1.GA against types 13.3.0 today. A project that installed @types/titanium itself still
wins, because that is what its build compiles against, and npm stays the fallback for the SDKs
that predate the types being bundled.

Disk only: no spawn, no network, which is what makes it free to put ahead of npm. So the install
locations are a table in core/titanium.ts beside the rest of what it knows about the machine —
the CLI's own locations from util/tisdk.js, with its darwin -> osx mapping for the
mobilesdk host directory — rather than a ti sdk list spawn. The locations the CLI reads from
its own config (sdk.defaultInstallLocation, paths.sdks) are not read for the same reason; a
user who installs SDKs elsewhere falls through to npm.

The declarations are looked for in types/ inside the SDK rather than at its root. The SDK root
already carries titanium_mobile's own package.json, which has no types field, so a lookup
there would fall back to index.d.ts and appear to work while reporting the SDK's version as the
types version. A directory with a manifest of its own gives the report a real version to name.

Nothing ships these yet — the SDK build generates them and packager.js copies only api.jsca
into the zip — so on every machine today this source declines and npm answers. It is covered
against a fixture install location holding all three host directories, so the one fixture answers
on every machine the suite runs on and the host mapping is under test rather than stubbed. The
fixture's SDK that does ship them holds all four files the generator's output needs, since the
hardcoded /// <reference path="base.d.ts" /> is never emitted by it and base.d.ts references
globals.d.ts and console.d.ts in turn. The other two SDKs in the fixture cover falling through
cleanly: one with no types/ at all, and one whose types/ was only partly written.

Selectors at the top level of a stylesheet

Standing on the blank line between two rules and asking for suggestions is the obvious way to
start writing a new one, and it answered nothing. nodeAt finds what holds an offset, and nothing
holds one at the top level — between two rules, above the first, below the last, or in a
stylesheet with nothing in it yet — so styleCompletionsAt returned early. Against the real
stylesheet the blank line between two rules answered null where a partially typed selector on
either side of it answered 77 items; it now answers 77.

Column zero of a selector line, which the original report also named, already answered: a rule's
range.start is its opening quote and contains is inclusive at both ends, so the cursor before
the quote is still in the selector. All three are one position to a user, and all three are
covered.

At the top level there is no "…": {} around the cursor for a name to be accepted into, so each
entry writes the whole rule and replaces nothing but the cursor — a bare word written there is
something Alloy will not parse. The quote is the one the stylesheet already uses, and the snippet
leaves the cursor in the body. A client with no snippet engine gets the same text without the
placeholder, which named already handles.

Saying why a request was answered nothing

onCompletion, onHover and onDefinition all answered null without writing anything when a
file routed nowhere, when the kind and role matched no branch, or when the project had no language
service yet. LSP tracing shows an empty response and never why, so working out that a .tss was
answering nothing because it sat outside app/styles needed a hand-written stdio harness and a
read of the compiled output in node_modules.

Each case now logs one line naming the document and the condition, in words that say what to do
about it:

No answer for …/test-alloy/app/assets/stray.tss: it is a stylesheet outside app/styles, which is
where Alloy reads them from (a widget's under app/widgets/<name>/styles, a theme's under
app/themes/<name>/styles)

No answer for …/test-classic/Resources/app.tss: …/test-classic is a classic project, so a .tss
file there has no Alloy role — stylesheets and views are Alloy's, and a classic project has neither

No answer for …/notes/scratch.tss: it is not inside any of the projects registered under
…/titanium-workspace (…/test-alloy, …/test-classic)

The reason is cached per document path and logged only when it changes. These handlers run on
every keystroke, and an identical line per request would bury everything else in the log, which is
the state this was added to fix rather than one to swap for another. A closed document is
forgotten, so reopening it says why again and nothing grows for the life of the server.

ProjectRegistry.candidates scanning only a workspace root and its immediate children is
deliberate and unchanged, but it is the case most likely to be hit and least likely to be guessed,
so a root with no registered project under it says how far down projects are looked for and what
makes a directory one.

The role is read before the kind, because a file whose role the layout did name is in the right
place by definition. app/i18n/en/strings.xml is a .xml the layout calls a translation, and the
first version of this told its author it was a view in the wrong directory — which would send
someone to move a correct file. A test caught it.

Also

Five acquirers in acquire.test.ts were built without a cacheRoot. NpmAcquirer defaults to
~/.titanium/types, and the new record of the registry check is written by versions(), so
npm test was writing into the home directory of whoever ran it. Every acquirer the suite builds
now gets a root of its own. AGENTS.md already flags this class of bug as one that was fixed once
before.

That same file's setup then got it wrong a second way, which only a Windows runner caught. A test
of a cache root that cannot be written made it so with fs.chmod(root, 0o500); on Windows chmod
only toggles the read-only bit and does not stop a directory being written, so the record was
written after all and both Windows jobs failed — the one failure in 1373. It is now blocked with a
file where the root's parent would be, which no platform can create through, so the catch is
reached the same way everywhere rather than through permission semantics that differ. Twice now
this file's setup has written somewhere it should not have.

Verification

npm run lint is clean. npm test gives 1370 passing, 0 failing, at 99.66% lines, 97.10%
branches, 99.61% functions — core/routing.ts and core/titanium.ts at 100% on all three.

npm run test:e2e was run against the real registry while fixing the end-to-end jobs on this
branch: 29 passing, 0 failing.

Known follow-up

The generated index.d.ts carries a hardcoded /// <reference path="base.d.ts" /> header for
files the generator never emits, so the header's metadata is stale with respect to what ships.
That belongs with the SDK-side packaging change that starts shipping the declarations at all,
not here — this side reads whatever layout lands.

No issue covers this work, so there is nothing for this to close. #87 is adjacent — style
completion offering no properties for a rule that reaches no element — but it is a different
defect and is untouched here.

🤖 Generated with Claude Code

ewanharris and others added 6 commits November 8, 2026 19:39
`AcquiredTypes.locate` asked npm for the published version list before
`install` ever looked at the cache, so every registered project paid a
`npm view @types/titanium versions --json` spawn to establish a version
already sitting on disk. Measured against a two-project workspace on a
warm cache, the first `textDocument/completion` took 1211ms, of which
~570ms was those two spawns: with npm absent from the PATH, so the
listing fails instantly, the same request took 638ms. The delay is
user-visible because `routeOf` awaits `refresh`, which awaits
`openServices`, so the request blocks on type resolution.

The cache is now consulted first, and only when it holds the SDK's own
major — nearly every project, and the case where asking the registry can
only turn up a release that adds members to the same major. An older
major is the rarest answer and the one most worth getting right, so it is
never taken from the cache on trust.

Staleness is bounded by a record of when the registry last answered,
written beside the cached versions, rather than by a background refresh
of the list after answering. A background `npm view` would cost the same
spawn it was meant to avoid, just moved off the critical path, and its
result could only be acted on by rebuilding a language service at an
arbitrary moment mid-session. The record also makes the window
machine-wide rather than per project, which is what removes the second
spawn in a two-project workspace. It is written only when npm actually
answered: a failed check establishes nothing about what is published, and
letting it stand in for a real one would pin a machine to its cache on
the strength of a failure.

The three ways a version can be chosen now report differently, since
answering from a fresh cache on purpose is not the registry being
unreachable and must not be described as it. A cached answer says when
npm was last asked; only a failed check says it could not be reached.

First completion on a warm cache: 1211ms before, 698-755ms after.

Every acquirer the suite builds now gets a cache root of its own.
`versions` writes the record, and `NpmAcquirer` defaults to
`~/.titanium/types`, so the tests that built one without a root had
`npm test` writing into the home directory of whoever ran it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A third source, between the project's own copy and npm. The SDK's
declarations are generated from the very SDK being built against, so they
describe it exactly rather than trailing it the way a DefinitelyTyped
release does — SDK 13.4.1.GA against types 13.3.0 today. A project that
installed `@types/titanium` itself still wins, because that is what its
build compiles against, and npm stays the fallback for the SDKs that
predate the types being bundled.

Disk only: no spawn and no network, which is what makes it free to put
ahead of npm. So the install locations are read from a table rather than
asked of `ti sdk list`, and `core/titanium.ts` carries them beside the
rest of what it knows about the machine — the CLI's own `locations` from
`util/tisdk.js`, with its `darwin -> osx` mapping for the `mobilesdk`
host directory. The locations the CLI reads from its own config
(`sdk.defaultInstallLocation`, `paths.sdks`) are not read, for the same
reason; a user who installs SDKs elsewhere falls through to npm.

The declarations are looked for in `types/` inside the SDK rather than at
its root. The SDK root already carries titanium_mobile's own
`package.json`, which has no `types` field, so a lookup there would fall
back to `index.d.ts` and appear to work while reporting the SDK's version
as the types version. A directory with a manifest of its own gives the
report a real version to name.

`sdkDirectories` answers nothing for anything that is not a version, so a
blank or hand-mangled `sdk-version` cannot be read as a path —
`13.2.0.GA/..` would otherwise name the host directory itself.

Nothing ships these yet: the SDK build generates them and `packager.js`
copies only `api.jsca` into the zip, so on every machine today this
source declines and npm answers. Covered against a fixture install
location rather than the real one, holding all three host directories so
the one fixture answers on every machine the suite runs on and the host
mapping is under test rather than stubbed. The fixture's SDK that does
ship them holds the four files the generator's output needs — the
hardcoded `/// <reference path="base.d.ts" />` is never emitted by it,
and `base.d.ts` references `globals.d.ts` and `console.d.ts` in turn — so
it describes something that could actually type-check. The other two SDKs
in the fixture cover falling through cleanly: one with no `types/` at
all, which is every SDK released so far, and one whose `types/` was only
partly written.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Standing on the blank line between two rules and asking for suggestions
is the obvious way to start writing a new one, and it answered nothing.
`nodeAt` finds what holds an offset, and nothing holds one at the top
level — between two rules, above the first, below the last, or in a
stylesheet with nothing in it yet — so `styleCompletionsAt` returned
early. Measured against a real stylesheet, the blank line between two
rules answered null where a partially typed selector on either side of it
answered 77 items.

A selector is the only thing that can be written there, so that is what
is offered, from the same tags, classes and ids a selector inside a rule
gets. Column zero of a selector line already answered — a rule's range
starts at its opening quote and `contains` is inclusive at both ends —
but all three are one position to a user, and all three are covered.

At the top level there is no `"…": {}` around the cursor for a name to be
accepted into, so each entry writes the whole rule and replaces nothing
but the cursor: a bare word written there is something Alloy will not
parse. The quote is the one the stylesheet already uses, and the snippet
leaves the cursor in the body, where the next thing written goes. A
client with no snippet engine gets the same text without the placeholder,
which `named` already handles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`onCompletion`, `onHover` and `onDefinition` all answered null without
writing anything when a file routed nowhere, when the kind and role
matched no branch, or when the project had no language service yet. LSP
tracing shows an empty response and never why, so working out that a
`.tss` was answering nothing because it sat outside `app/styles` needed a
hand-written stdio harness and a read of the compiled output in
node_modules.

Each case now logs one line naming the document and the condition, in
words that say what to do about it: not inside any folder the editor
opened, not inside any of the projects registered under one (naming the
projects there are), a classic project so a `.tss` has no Alloy role, a
stylesheet or view outside `app/styles` or `app/views` and where else
Alloy reads them from, a translation file, or no language service built
for the project yet.

The reason is cached per document path and logged only when it changes.
These handlers run on every keystroke, and an identical line per request
would bury everything else in the log — which is the state this was added
to fix, not one to swap for another. A closed document is forgotten, so
reopening it says why again and nothing grows for the life of the server.

`ProjectRegistry.candidates` scanning only a workspace root and its
immediate children is deliberate and unchanged, but it is the case most
likely to be hit and least likely to be guessed, so a root with no
registered project under it says how far down projects are looked for and
what makes a directory one.

The role is read before the kind, because a file whose role the layout
did name is in the right place by definition: `app/i18n/en/strings.xml`
is a `.xml` the layout calls a translation, and the first version of this
told its author it was a view in the wrong directory, which would send
someone to move a correct file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
#86 is an open issue — "Report unused TSS rules and offer to comment
them out" — not this pull request. Issues and pull requests share one
sequence and #88 is the highest taken, so these lines name #89, which is
the next number free. It needs checking against the pull request this
actually becomes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 8, 2026 20:40
The offline run asserted "from the cache because the npm registry could
not be reached", and on this branch it no longer says that — the runs
before it leave a record of the registry having answered moments ago, so
the cache answers on its own and npm is never spawned. That is the
saving, and the message says what actually happened instead. All three
End to end jobs failed on #89 for this one assertion.

So the scenario is now two, which is the distinction the change was
careful to keep: one against a cache the registry was just asked about,
which must not spawn npm and must not claim anything about reachability,
and one whose record is back-dated past the staleness window, where the
registry really is asked, really does fail, and the existing message is
right.

The first asserts the absence of the npm-lookup failure line, which is
what a spawn would have logged offline — observable proof from outside
the server that it was never asked. The second also asserts the stale
record was left alone, since a failed lookup must not stand in for a
real check.

The finding this tier exists for is still covered by both: a warm cache
has to work with no registry at all.

Verified against the real registry: 29 passing, 0 failing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The cache-failure test relies on nonportable permissions, and unresolved caching and completion defects can retain stale SDK versions or produce invalid TSS.

6 open issues
What changed in this PR

This PR reduces first-request latency in the Titanium language server, adds SDK-bundled type resolution, and improves stylesheet completion and request diagnostics.

Changes:

  • Prefer recently checked cached types and SDK declarations before querying npm.
  • Offer complete selector rules at the top level of Alloy stylesheets; the unused-selector property completion issue in #87 remains separate.
  • Explain unanswered requests with deduplicated logs, backed by regression tests and cross-platform SDK fixtures.
File Description
src/​test/​server/​service.test.ts Tests request explanations and log deduplication.
src/​test/​fixtures/​titanium-sdk-home/​README.md Documents SDK fixture layouts.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​9.3.2.GA/​package.json Models a Windows SDK without bundled types.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​12.4.0.GA/​types/​package.json Identifies the Windows types package.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​12.4.0.GA/​types/​index.d.ts Supplies Windows SDK API declarations.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​12.4.0.GA/​types/​globals.d.ts Supplies a referenced global declaration.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​12.4.0.GA/​types/​console.d.ts Supplies the referenced console declaration.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​12.4.0.GA/​types/​base.d.ts Connects supporting declarations and the Ti alias.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​win32/​10.1.0.GA/​types/​base.d.ts Models an incomplete Windows types installation.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​9.3.2.GA/​package.json Models a macOS SDK without bundled types.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​12.4.0.GA/​types/​package.json Identifies the macOS types package.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​12.4.0.GA/​types/​index.d.ts Supplies macOS SDK API declarations.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​12.4.0.GA/​types/​globals.d.ts Supplies a referenced global declaration.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​12.4.0.GA/​types/​console.d.ts Supplies the referenced console declaration.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​12.4.0.GA/​types/​base.d.ts Connects supporting declarations and the Ti alias.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​osx/​10.1.0.GA/​types/​base.d.ts Models an incomplete macOS types installation.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​9.3.2.GA/​package.json Models a Linux SDK without bundled types.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​12.4.0.GA/​types/​package.json Identifies the Linux types package.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​12.4.0.GA/​types/​index.d.ts Supplies Linux SDK API declarations.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​12.4.0.GA/​types/​globals.d.ts Supplies a referenced global declaration.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​12.4.0.GA/​types/​console.d.ts Supplies the referenced console declaration.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​12.4.0.GA/​types/​base.d.ts Connects supporting declarations and the Ti alias.
src/​test/​fixtures/​titanium-sdk-home/​mobilesdk/​linux/​10.1.0.GA/​types/​base.d.ts Models an incomplete Linux types installation.
src/​test/​core/​typescript/​types.test.ts Tests cache freshness and type-source precedence.
src/​test/​core/​typescript/​acquire.test.ts Tests registry records and isolates test caches.
src/​test/​core/​titanium.test.ts Tests SDK locations and host mappings.
src/​test/​core/​style.test.ts Tests top-level selector completions and insertions.
src/​test/​core/​routing.test.ts Tests explanations for unsupported document routes.
src/​server/​service.ts Integrates SDK types and deduplicated request explanations.
src/​core/​typescript/​types.ts Adds SDK resolution and cache-first type selection.
src/​core/​typescript/​acquire.ts Persists successful registry-check timestamps.
src/​core/​titanium.ts Defines disk-only SDK lookup locations.
src/​core/​style.ts Generates whole-rule completions at stylesheet top level.
src/​core/​routing.ts Explains missing projects and unsupported file roles.
CHANGELOG.md Records performance, completion, and diagnostic changes.

Review effort: Balanced

Comment thread src/core/style.ts Resolved
Comment thread src/core/style.ts Resolved
Comment thread src/core/style.ts Resolved
Comment thread src/core/typescript/types.ts Resolved
Comment thread src/server/service.ts Resolved
ewanharris and others added 4 commits November 8, 2026 20:53
`should survive a cache root it cannot write to` made the root read-only
with `fs.chmod(root, 0o500)`. On Windows chmod only toggles the read-only
bit and does not stop a directory being written, so the record was
written after all, `checked` answered a timestamp instead of nothing, and
both Windows jobs failed on #89 — the one failure in 1373.

Blocked with a file where the root's parent would be instead. A path
whose ancestor is a file cannot be created on any platform, so the catch
in `record` is reached the same way everywhere rather than through
permission semantics that differ. The read-only home directory it stands
for is still what it is about: the versions are answered before the
record is written, so failing to write it costs the staleness check and
nothing else.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The record was a timestamp alone, and the selection was then made over
what happened to be installed. That pinned a project to its own cache,
which is the failure the record was meant to avoid.

The record is machine-wide while a workspace holds one project per SDK.
So: a 13.x project asks the registry, which answers 12.0.8 and 13.3.0,
installs 13.3.0 and refreshes the record. A 12.x project beside it then
sees a fresh record, selects over its cache, finds only a long-stale
12.0.2, and takes it — although the registry had named 12.0.8 seconds
earlier. Repeating after each expiry, the 12.x project never moves.

So the record now holds the versions as well as the time, and the rule
runs over that recorded list rather than over the cache. Selecting from a
real registry answer is as sound as selecting from a live one, so the
`matched`-only restriction goes with it: an older major can be read off
the record too, and the warning that names what is published is correct
there as well. The only thing given up is a release published inside the
window, which is what a staleness window is.

Skipping the lookup is still not skipping the fetch: a version the record
names and the disk does not have is installed as before.

The two e2e offline scenarios keep their split, with the back-dating now
editing the stored timestamp in place so only the age differs between
them. Found by review on #89.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
All found by review on #89, all in the path added for offering selectors
where no rule holds the cursor.

A comment is the other place no rule holds, and it wanted the opposite
answer. At `// ` the whole-rule entries were offered, and accepting one
commented out its own opening and left the closing brace on a fresh
uncommented line — TSS Alloy will not parse. The parser already knows
exactly where comments are, so it now reports them rather than
discarding them silently as trivia, and `insideComment` is asked
alongside `nodeAt`: the two absences are the same and want opposite
answers. Working it out from the text afterwards would have meant
re-implementing the string handling that keeps `"http://x"` from reading
as a comment.

`quoteOf` parses the whole stylesheet, and it was called once per entry
inside the map — so the 77-item answer did 77 full parses of a document
that previously needed one, growing with both the stylesheet's size and
the project's count of classes and ids. Read once before mapping.

A selector reached the insertion unescaped, and classes and ids come from
a view, so they carry whatever an XML attribute can. An apostrophe ended
the key early in a stylesheet written with single quotes; `amount$1` lost
its `$1` to a snippet tab stop and put the cursor where the name should
have been. The name is now written as a TSS literal, and the snippet form
escapes that literal's own `$`, `}` and backslash, leaving only the
body's `$0` live. The plain form needs no snippet escaping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`scriptFor` answers nothing both for a file that is not a script and for
a project whose service never opened, and the new reason-for-dropping
could not tell them apart: a controller in a project whose `open` threw
was told its role was the problem. A controller is squarely a file this
server answers for, so that sent its author looking at a layout that is
correct.

A script's kind is one the handlers answer for, so reaching the
fall-through with one means the service is what is missing. The message
is the one views and stylesheets already used, now in a single place
since five callers report the same condition and the reason is cached per
document by its text — two spellings would log twice.

Covered by injecting a types source that rejects, which is what leaves a
registered project without a service: `openServices` contains the failure
per project. A project whose types simply do not resolve still gets a
service, which answers less, so that is not the same case.

Found by review on #89.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants