Repository navigation
Conversation
This was referenced Dec 3, 2026
atscott
force-pushed
the
ls-extract-shared-core
branch
from
December 3, 2026 21:42
7111285 to
e7d0b72
Compare
…le private entry point Extract pure synchronous template AST and TCB leaf helpers into two fine-grained Bazel targets under `packages/language-service/src/shared/` so both the Classic TypeScript language service and the NGP language service can consume them without pulling in monolithic `NgCompiler`/`ts.LanguageService` infrastructure: - `//packages/language-service/src/shared:ast` (depends only on `//packages/compiler`, zero `typescript` or `compiler-cli` dependencies): - `template_utils.ts`: pure template AST, span, and selector matching utilities (`isWithin`, `toAttributeCssSelector`, `makeElementSelector`, `getDirectiveMatchesForElementTag`, generic `getDirectiveMatchesForAttribute`, `getTextSpanOfNode`, `isBoundEventWithSyntheticHandler`, `isDollarEvent`, `selectorAttributes`). - `template_target.ts`: `getTargetAtPosition` and `TemplateTarget` context types split out from TCB lookup. - `quick_info_built_ins.ts`: built-in block/trigger/helper hover metadata and span resolution (`$any`, `$safeNavigationMigration`, `ng-template`, control-flow and `@defer` built-ins). - `completion_utils.ts`: pure attribute and block completion helpers (`getStructuralAttributes`, all 13 block keywords, `buildBlockSnippet`, `CompletionNodeContext`, `nodeContextFromTarget`, `stripBindingSugar`, `shouldIncludeAttributeCompletion`). - `rename_utils.ts`: `getRenameTextAndSpanAtPosition`. - `outlining_spans.ts`, `linked_editing_range.ts`, `smart_selection.ts`, `document_symbols.ts`: pure `TmplAstNode[]` visitors decoupled from `NgCompiler` and TypeScript enums. - `//packages/language-service/src/shared:tcb` (depends on `:ast`, `//packages/compiler`, `typescript`, and `//packages/compiler-cli/private`): - `tcb_target.ts`: `getTcbNodesOfTemplateAtPosition`. - `tcb_utils.ts`: `findTightestNode`, `getParentClassDeclaration`, and `unwrapTcbSpanTarget`. - `signature_help.ts`: `resolveSignatureHelpTarget`. Repoint `//packages/language-service:private` (`private.ts`) to depend exclusively on `src/shared:ast` and `src/shared:tcb` instead of monolithic `//packages/language-service/src`, preserving all existing exports while exposing the new shared helpers. Keep all Classic `src/*.ts` public return types and `utils`/`template_target` re-exports unchanged, and add pure unit tests under `packages/language-service/test/shared/`.
atscott
force-pushed
the
ls-extract-shared-core
branch
from
December 4, 2026 21:36
e7d0b72 to
e37c38d
Compare
atscott
marked this pull request as ready for review
December 4, 2026 21:49
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.
#72328 is now merged; this PR is standalone on
main.@angular/language-service/privatepreviously pulled in the entirepackages/language-service/srctarget along withNgCompilerandts.LanguageService, which made it impractical for the NGP language service (or other consumers) to reuse pure template AST and TCB leaf helpers without dragging in the classic compiler infrastructure.This splits the pure synchronous template AST and TCB helpers into two smaller Bazel targets under
packages/language-service/src/shared/and repoints@angular/language-service/privateto them://packages/language-service/src/shared:astdepends only on//packages/compiler(notypescriptorcompiler-clidependency) and holds template span/selector utilities,getTargetAtPositionandTemplateTargetcontext resolution, built-in quick info metadata ($any,$safeNavigationMigration,ng-template, control-flow and@deferbuilt-ins), attribute and 13-keyword control-flow block completion helpers, rename span extraction, and pureTmplAstNode[]visitors for outlining spans, linked editing ranges, smart selection, and document symbols.//packages/language-service/src/shared:tcbdepends on:ast,//packages/compiler,typescript, and//packages/compiler-cli/privateand holdsgetTcbNodesOfTemplateAtPosition,findTightestNode,getParentClassDeclaration,unwrapTcbSpanTarget, andresolveSignatureHelpTarget.//packages/language-service:privatenow depends only onsrc/shared:astandsrc/shared:tcb, keeping all existing exports while exposing the shared helpers. The classicpackages/language-service/src/*.tsmodules delegate to these shared helpers without changing their public return types or re-exports, and pure unit tests are added underpackages/language-service/test/shared/.