Commit graph

429 commits

Author SHA1 Message Date
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
Kristiyan Kostadinov
18a675081f fix(compiler): more permissive parsing of @ characters (#62644)
When we introduced blocks, we made a deliberate decision to treat the `@` character as a reserved character in case we need to use it for other syntax in the future. This meant that some common cases, like writing out an email address in the template, can be broken.

After some recent discussions we decided to relax the requirement and only treat `@` as a reserve character if it's followed by a character sequence that matches a known block.

PR Close #62644
2025-07-15 13:24:47 -07:00
ivanwonder
d64dd27a02 feat(language-service): support to report the deprecated API in the template (#62054)
In the Typescript Language Service, these diagnostics are reported as suggestion diagnostics.
This will report the deprecated `Component`, `Directive`, etc.

Fixes https://github.com/angular/angular/issues/59343

PR Close #62054
2025-07-14 15:44:24 -07:00
Jessica Janiuk
d7b94e0072 refactor(core): rename all animations package symbols (#62399)
Renames all animations package references with a "legacy" prefix for later easy cleanup.

PR Close #62399
2025-07-01 13:45:45 +00:00
anastasiaanisimova
402eaa1c85 docs: fix deferrable views doc links (#62293)
PR Close #62293
2025-06-26 14:34:44 +00:00
Jannik Lassahn
b489f9fa8f refactor(language-service): add methods for decoding classifications to public api (#62251)
Add methods for decoding classifications to public api for use in the
language server

PR Close #62251
2025-06-25 09:46:53 +00:00
Jannik Lassahn
20c1f991e6 feat(language-service): add semantic tokens for templates (#60260)
Adds support for `getEncodedSemanticClassifications` to the language service.
The service now classifies components in a template as the `class` type.

PR Close #60260
2025-06-24 16:27:46 +00:00
ivanwonder
ac1d400306 refactor(language-service): resolve module specifier for a directive exported by multiple different files (#62100)
When providing the code action for the directive that is exported by multiple modules
in different files, the directive must save all the TS completion entry data
for every module to compute the module specifier.

When providing a completion item, because the LS only supports displaying one directive
at a time, the first one will be picked.

PR Close #62100
2025-06-23 14:16:30 +02:00
ivanwonder
5d2e85920e feat(language-service): support to fix missing required inputs diagnostic (#50911)
Support to add the missing required inputs into the element and append
after the last attribute of the element.

But it skips the structural directive shorthand attribute. For example,
`<a *ngFor=""></a>`, its shorthand is `<ng-template ngFor>`, the `valueSpan`
of the `ngFor` is empty, and the info is lost, so it can't use to insert
the missing attribute after it.

PR Close #50911
2025-06-19 10:13:26 +02:00
Joey Perrott
557ac51c32 build: migrate to using new jasmine_test (#62131)
Migrate additional targets to jasmine_test

PR Close #62131
2025-06-19 10:06:27 +02:00
ivanwonder
cf55d1bdd4 feat(language-service): Support importing the external module's export about the angular metadata. (#61122)
This works for the code actions and completion. When the ls wants to complete
all importable angular metadata in the template, the ls will invoke the function
`ls.getCompletionsAtPosition` and filter the item about the angular. When the
developer selects an item, the ls will get the module specifier from the code action
return by the `ls.getCompletionEntryDetails`.

PR Close #61122
2025-06-04 14:11:20 -04:00
Kristiyan Kostadinov
eb43e9242d refactor(compiler): account for new assignment AST (#61682)
Reworks the places that were depending on `PropertyWrite` and `KeyedWrite` to account for the new AST structure.

PR Close #61682
2025-06-03 11:08:50 -04:00
Joey Perrott
b37fd9753f build: migrate language service to use rules_js (#61568)
Migrate language service to build using ts_project

PR Close #61568
2025-05-21 17:05:14 +00:00
Kristiyan Kostadinov
7fa3203ee7 refactor(compiler): account for pipes without names (#61328)
Updates the compiler logic to account for pipe definitions that may not have names.

PR Close #61328
2025-05-19 08:24:06 +00:00
Paul Gschwendtner
4a3d39cd5a refactor: ensure tsurge migrations have clear ownership of files (#61421)
Currently there can be cases, exlusively in 3P, where multiple tsconfig
projects have overlap of source files. This is the default setup of new
CLI applications as well.

When this is the case, Tsurge will treat each tsconfig as an isolated
compilation unit (given the concepts and mental model to support
scalable batching). This is wrong though, and the same `.ts` source file
can appear in two migration invocations; resulting in duplicate
replacements or analysis (depending on the migration).

We've worked around this problem in the past by deduplicating
replacements, or migrating to an ID-based approach with natural
deduplication. This worked, but it's just working around the root cause.

This commit attempts to fix the root cause by adjusting Tsurge to ensure
that no source file ever appears in two compilation units. This is
naively achieved by not adding a source file to a migration unit, if it
was part of a previous one. This is expected to be fine given the nature
of Tsurge migrations that are built to operate on isolated pieces
anyway— so it shouldn't be problematic if e.g. `app.component.ts` ends
up being part of the test tsconfig compilation unit (we avoid this order
though by visiting build targets first).

PR Close #61421
2025-05-16 15:56:44 +00:00
Kristiyan Kostadinov
3aef3e64cd refactor(language-service): rename all references to selectorless directives (#61307)
Follow-up to #61240 that adds renaming support for selectorless components/directives both from the template and from the TypeScript source.

PR Close #61307
2025-05-14 11:06:22 +02:00
Kristiyan Kostadinov
eae1083a54 refactor(compiler): indicate in AST if node is self-closing (#61307)
Follow-up from https://github.com/angular/angular/pull/61240#discussion_r2084445328. Adds a `isSelfClosing` property on element-like AST nodes so consumers can easily determine if it's self-closing, rather than having to look at the spans. This is useful for migrations and in the language service.

PR Close #61307
2025-05-14 11:06:22 +02:00
Kristiyan Kostadinov
fa27b76339 refactor(language-service): initial reference and rename implementation for selectorless (#61240)
Adds an initial implementation for finding references and renaming to selectorless components/directives.

Finding references should work everywhere, whereas renaming only currently works when initiated from the template.

PR Close #61240
2025-05-12 15:31:45 -07:00
Kristiyan Kostadinov
f074c30616 refactor(language-service): support quick info selectorless symbols (#61240)
Updates the language service to produce quick info for selectorless components and directives.

PR Close #61240
2025-05-12 15:31:45 -07:00
Kristiyan Kostadinov
cec512fdfd refactor(language-service): support definitions for selectorless (#61240)
Updates the language service to handle producing definition information for selectorless components and directives.

PR Close #61240
2025-05-12 15:31:45 -07:00
Kristiyan Kostadinov
c69dda61c2 refactor(language-service): set up template targets for selectorless (#61240)
Adds the logic to resolve the template targets for the selectorless component and directive nodes. This is a prerequisite for other functionality.

PR Close #61240
2025-05-12 15:31:45 -07:00
Kristiyan Kostadinov
bb863ee0db refactor(compiler): consolidate combined recursive visitors (#61158)
We have several cases where we need a visitor that traverses both the template and expression ASTs fully. Currently we're re-implementing the visitor each time which means that we need to update multiple visitors every time something changes.

These changes add a single base class that we can reuse to simplify such cases in the future.

PR Close #61158
2025-05-08 07:11:36 +02:00
Kristiyan Kostadinov
bc9a067ef4 refactor(compiler-cli): add flag to enable selectorless (#60977)
Adds a private flag that we can use to enable selectorless as it's being developed.

PR Close #60977
2025-04-24 13:02:39 -07:00
Kristiyan Kostadinov
92c4123a74 refactor(compiler): integrate new AST nodes into visitors (#60724)
Updates the various visitors to add placeholders for the new AST nodes.

PR Close #60724
2025-04-04 11:28:47 -07:00
Andrew Scott
b9cf414790 fix(language-service): Ensure dollar signs are escaped in completions (#60597)
Dollar signs need to be escaped so they are not replaced during snippet
expansion: https://code.visualstudio.com/docs/editing/userdefinedsnippets#_how-do-i-have-a-snippet-place-a-variable-in-the-pasted-script

fixes https://github.com/angular/vscode-ng-language-service/issues/2139

PR Close #60597
2025-04-03 10:45:56 -07:00
Andrew Scott
a22b13f990 fix(language-service): Do not provide element completions in end tag (#60616)
Element completions should not be provided when the position is in the
end tag or between the start and end tags.

fixes https://github.com/angular/vscode-ng-language-service/issues/2157

PR Close #60616
2025-04-03 10:36:32 -07:00
Andrew Scott
ea62a4f317 fix(language-service): Update adapter to log instead of throw errors (#60651)
This prevents errors from being thrown from the adapters. Throwing errors
in the language service causes the extension to crash. Repeated errors
will permanently break the extension.

fixes https://github.com/angular/vscode-ng-language-service/issues/2166

PR Close #60651
2025-03-31 21:36:34 +00:00
Andrew Kushnir
88ae6517a2 refactor(language-service): convert scripts within packages/language-service to relative imports (#60540)
This commit updates scripts within `packages/language-service` to relative imports as a prep work to the upcoming infra updates.

PR Close #60540
2025-03-26 20:40:01 -07:00
Kristiyan Kostadinov
1dba2a89b0 refactor(language-service): enable host binding features (#60433)
Reworks the language service to enable features like quick info and definitions inside host bindings.

**Note:** for the full range of language service features to work, the changes from https://github.com/angular/vscode-ng-language-service/pull/2155 have to be released.

PR Close #60433
2025-03-18 18:15:58 +01:00
Kristiyan Kostadinov
b8f2a50c68 refactor(compiler-cli): track host binding information (#60267)
Sets up the infrastructure to track the host bindings of directives for type checking purposes.

PR Close #60267
2025-03-17 14:28:40 +01:00
Kristiyan Kostadinov
1b91de3231 refactor(language-service): rename internal symbols to accommodate type checking outside a template (#60191)
Currently the language service has some template-specific terminology around type checking, because that's the only place where we had TCB support. These changes make it more generic to accommodate future functionality.

PR Close #60191
2025-03-06 10:39:31 -08:00
Kristiyan Kostadinov
afea8a9d0c refactor(compiler-cli): rework resource handling to allow directives (#60191)
Currently only components can have resources, because they're the only symbol kinds being type checked. Since we want to add directives to it, these changes rework the resource handling to accommodate them.

PR Close #60191
2025-03-06 10:39:31 -08:00
Kristiyan Kostadinov
44a8de20d5 refactor(compiler-cli): rework source manager to accommodate directives (#60191)
Currently the `TemplateSourceManager` is set up to specifically cater to component templates. These changes make it more generic so we can reuse it for directives.

PR Close #60191
2025-03-06 10:39:31 -08:00
Andrew Scott
d5e91e04ff fix(language-service): Forward the tags for quick info from the type definition (#59524)
Prior to this commit, the tags from the type definition were dropped.
Tags may include, but are not limited to, deprecation information from
the jsdoc.

PR Close #59524
2025-03-04 17:37:22 +00:00
Andrew Scott
b9306719df fix(language-service): provide correct rename info for elements (#60088)
This commit ensures we do not block element rename if it is supported by
other rename providers.

fixes https://github.com/angular/vscode-ng-language-service/issues/2077

PR Close #60088
2025-02-25 14:10:53 -05:00
hawkgs
0513fbc9fc docs: set syntax highlighting of code examples MD code blocks (#59026)
Set the syntax highlighting based on the code examples' language.

PR Close #59026
2024-12-04 17:30:28 +01:00
Charles Lyding
67a4a7b27e refactor(language-service): reuse code fixes map for has fix check (#58759)
The error codes that have fixes are present in a Map instance and
can be directly leveraged to determine if an error code can be fixed.
This avoids multiple levels of iteration that would otherwise be needed.

PR Close #58759
2024-11-20 08:10:15 -08:00
Kristiyan Kostadinov
dcd27d7921 fix(language-service): add fix for individual unused imports (#58719)
Fixes that `getCodeActions` wasn't implemented for the unused imports fixer which meant that it wouldn't show up in the most common cases.

PR Close #58719
2024-11-19 12:19:14 -08:00
Kristiyan Kostadinov
f5b2b58b3b fix(language-service): allow fixes to run without template info (#58719)
Currently the code fixes won't run if the template information can't be resolved on the diagnostic node. This is incorrect for diagnostics that are reported within `.ts` files. These changes make the `templateInfo` nullable and leave the early exit up to the individual fixes.

PR Close #58719
2024-11-19 12:19:14 -08:00
Charles Lyding
9b309c129a refactor(language-service): suppress inline TCB required diagnostic for syncs (#58619)
The NG8900 diagnostic is a non-actionable error code that does not affect
the build result of a component.

PR Close #58619
2024-11-13 18:36:08 +00:00
Kristiyan Kostadinov
086cb2c40e fix(compiler-cli): report individual diagnostics for unused imports (#58589)
Initially the unused imports check was implemented so that it reports one diagnostic per component with the individual unused imports being highlighted through the `relatedInformation`. This works fine when reporting errors to the command line, but vscode appears to only show `relatedInformation` when the user hovers over a diagnostic which is a sub-par experience.

These changes switch to reporting a diagnostic for each unused import instead.

PR Close #58589
2024-11-11 15:31:00 +00:00
Kristiyan Kostadinov
3061c67539 refactor(language-service): update code fix for unused imports (#58468)
Since the unused imports diagnostic setup has changed, we need to update the code fix to account for it.

PR Close #58468
2024-11-01 14:33:56 +00:00
Alan Agius
7de7c52769 build: remove usages of useDefineForClassFields: false (#58297)
When setting `"useDefineForClassFields": false`, static fields are compiled within a block that relies on the `this` context. This output makes it more difficult for bundlers to treeshake and eliminate unused code.

PR Close #58297
2024-10-28 12:26:05 -07:00
Paul Gschwendtner
dd686edfe9 refactor(migrations): update migrations to combine analysis data in parallel (#58280)
This is necessary given the previous Tsurge refactorings. It should
speed up migrations in the merge phase signficiantly and reduce memory
pressure. In 1P, we already have workers from analyze phase anyway— so
those can be re-used for parallel metadata merging.

PR Close #58280
2024-10-25 18:47:41 +00:00
Matthieu Riegler
8af71c05b2 refactor(language-service): support standalone by default (#58238)
`isStandaloneDecorator()` returns `false` only when the component is explicitly not standalone

PR Close #58238
2024-10-24 12:44:13 -07:00
Andrew Kushnir
1215927e5b Revert "refactor(migrations): update migrations to combine analysis data in parallel (#58280)" (#58313)
This reverts commit 8735543d06.

PR Close #58313
2024-10-22 12:27:53 -07:00
Paul Gschwendtner
8735543d06 refactor(migrations): update migrations to combine analysis data in parallel (#58280)
This is necessary given the previous Tsurge refactorings. It should
speed up migrations in the merge phase signficiantly and reduce memory
pressure. In 1P, we already have workers from analyze phase anyway— so
those can be re-used for parallel metadata merging.

PR Close #58280
2024-10-22 11:29:16 -07:00
Paul Gschwendtner
c1432f939b refactor(language-service): improve name of input full class refactoring action (#58263)
Prefixing the full class refactoring actions with `Full class` makes
them less confusing along with the individual field actions.

PR Close #58263
2024-10-18 14:34:47 +00:00
Paul Gschwendtner
6342befff8 feat(language-service): support migrating full classes to signal queries (#58263)
Adds a similar code action as for inputs, where users can migrate full
classes to signal queries.

PR Close #58263
2024-10-18 14:34:47 +00:00