184 Commits

Author SHA1 Message Date
aparziale f2cf65a898 fix(vscode-extension): handle template literals when detecting supported decorator fields
The client decides whether a position in a TypeScript file belongs to a supported `@Component` field (`template`, `styles`, ...) with a lightweight `ts.Scanner` loop before forwarding requests to the language server and the HTML/CSS providers. `ts.Scanner#scan` doesn't handle template substitutions on its own: the `}` closing a `${...}` substitution is reported as a plain `CloseBraceToken` and the rest of the template literal is scanned as the start of a new one, swallowing everything up to the next backtick. As a result, once a template literal with substitutions appears in a file, every position after it is considered to be inside a template string, and TypeScript completions get polluted with HTML completions.

The scanner is now driven the same way the TypeScript parser does it, re-scanning the brace that closes a substitution as a `TemplateMiddle`/`TemplateTail` token.

In addition, the property assignment context previously only ended at a terminator found at the top level of the file, so it leaked from `template:` to every string literal that followed it inside the same decorator and class body. The context now ends at the first terminator found at the nesting depth where it was entered. Two kinds of strings were only recognized thanks to that leak, and only when declared after `template`: inline `styles` and the arguments of `@HostBinding`/`@HostListener` decorators, both of which the language service supports. They are now recognized explicitly, regardless of where they appear.

Fixes #65494
2026-09-11 15:19:01 -07:00
Matthieu Riegler d470afa8b2 refactor(platform-server): ensure error boundaries work with ssr/hydration (#70463)
Added some tests to ensure error boundaries work with SSR and hydration.

PR Close #70463
2026-09-09 15:56:05 +02:00
Alex Rickabaugh f4a5650ed9 feat(language-service): add support for @boundary blocks (#70463)
Add support for the new `@boundary` and `@error` control flow blocks in the Angular Language Service.

This includes:
- Updating outlining spans to handle boundary blocks correctly.
- Adding classification visitor methods for semantic tokens.
- Adding template target visitor methods for navigation and hover support.
- Updating the TextMate grammar to recognize `@boundary` and the `when` clause.

PR Close #70463
2026-09-09 15:56:05 +02:00
SkyZeroZx 69c87301aa fix(vscode-extension): prevent JSDoc link provider injection
Treat link targets as file paths so crafted documentation cannot select arbitrary VS Code resource providers.

Fixes https://github.com/angular/angular/issues/70512
2026-09-02 16:06:55 -07:00
Angular Robot a66fd64cd4 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-09-02 15:52:44 -07:00
aparziale 1d9e445d1a fix(vscode-extension): handle escaped delimiters in inline template and styles highlighting
The TextMate grammars for inline templates and inline styles ended the
string at the first occurrence of the delimiter, so an escaped delimiter
(e.g. \`) terminated the highlighting prematurely and the rest of the
template was no longer highlighted as HTML.

Escape sequences are now consumed before delegating to the HTML/CSS
grammars, so escaped delimiters no longer end the string. Also removes
the stray pipes from the string delimiter character class, which
unintentionally matched a literal '|'.

Fixes #65493
2026-09-01 14:40:44 -07:00
Matthieu Riegler 9cf7b44f7c build: remove explicit strict options
Those options are enabled by default, they don't need to be explicit.
2026-08-31 13:17:00 -07:00
Angular Robot 6f91982c0d build: update dependency vscode-languageserver-textdocument to v1.0.14
See associated pull request for more information.
2026-08-27 10:22:46 -07:00
Angular Robot c2d4070c36 build: update all non-major dependencies
See associated pull request for more information.
2026-08-27 07:59:47 -07:00
Angular Robot 8c26fc74e5 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-08-26 15:37:41 -07:00
Kristiyan Kostadinov c18261f3fd build: enable stableTypeOrdering tsconfig flag
`stableTypeOrdering` was recently enabled in the internal builds. While there aren't any breakages in Angular, these changes enable it so we can catch potential issues earlier.
2026-08-24 10:27:15 -07:00
aparziale 0f0d52e9c1 fix(language-service): honor quote style preference when generating imports
The quick fix and completion auto-import always generated the module specifier with double quotes, ignoring the user's quote preference and the style used in the file.

The generated import now respects the `quotePreference` from the TypeScript user preferences. When the preference is `auto` (or absent), the style is inferred from the first existing import in the file, mirroring TypeScript's own behavior. Files with no imports
keep the previous double-quote default.

Fixes #67108
2026-08-24 10:18:02 -07:00
Shayan 3f8d9d6ea6 fix(language-server): recover project for external templates in solution-style workspaces
In a composite/solution-style workspace (e.g. an Nx monorepo, where an
app's tsconfig.json only contains project references), TypeScript can
never resolve a config file for an HTML file, since HTML files are not
listed in any referenced project. angular/vscode-ng-language-service#2165
worked around this in onDidOpenTextDocument by briefly opening the
sibling TS file so the right project loads when a template is opened
first.

However, getDefaultProjectForScriptInfo - the recovery path used by
getLSAndScriptInfo and onDidChangeTextDocument when a script info has no
configured project - did not receive the same workaround. When an open
template loses its project association (e.g. its component file is
closed and the project graph updates), every subsequent request on the
template fails with "No config file" and returns null indefinitely,
until the user manually reopens the component file.

Apply the same sibling-TS best effort in getDefaultProjectForScriptInfo,
and additionally attach the template's script info to the configured
project of its component when the config lookup still comes back empty
(openClientFile does not repeat the config lookup for already-open
files).

Also skip the sibling lookup when the .ts file does not exist, so
non-component HTML files (e.g. src/index.html) do not trigger an
open/close and config search that cannot succeed.

Fixes #69768
2026-08-17 14:59:02 -07:00
Angular Robot ec678c0f8d build: update dependency ng-packagr to v22.2.0-next.3
See associated pull request for more information.
2026-08-14 09:29:45 -07:00
Jaime Burgos ba13a3ce22 fix(vscode-extension): prevent command URI injection in TSDK approval
VS Code parses notification text for links and permits `command:` URIs. Interpolating the workspace-controlled TSDK path can therefore let a malicious path add a command link to the approval prompt.

Remove the path from the notification instead of attempting to sanitize or escape it. This keeps the prompt static and matches VS Code's TypeScript extension workspace-version approval flow.

Fixes #70176
2026-08-13 13:34:36 -07:00
Andrew Scott 6f848db435 build(vscode-extension): dynamically resolve upstream remote and use token for https pushes
Previously, the release script hardcoded the upstream repository URL as an unauthenticated HTTPS URL (https://github.com/angular/angular.git). Although the script verified that a GITHUB_TOKEN environment variable was present, it only used that token for REST API calls (such as creating the GitHub release) and did not provide it to Git commands. As a result, users who authenticate to GitHub via SSH (and do not have an HTTPS Git credential helper configured) were prompted interactively for GitHub login credentials when pushing the release tag.

This change dynamically resolves the upstream remote name from the user's configured remotes by checking for any remote pointing to angular/angular. When pushing over SSH, Git uses the user's existing SSH credentials. When pushing over HTTPS (or falling back), the script injects GITHUB_TOKEN into the push URL to prevent interactive authentication prompts.
2026-08-13 08:38:53 -07:00
Andrew Scott e53bb2bca7 release: bump VSCode extension version to 22.1.0 (#70171) (#70172)
Co-authored-by: Alon Mishne <3197814+amishne@users.noreply.github.com>
Co-authored-by: Alon Mishne <amishne@users.noreply.github.com>
2026-08-12 16:05:05 -07:00
Angular Robot b63b9032b4 build: update all non-major dependencies
See associated pull request for more information.
2026-07-30 09:59:54 -07:00
Angular Robot 9e5dc74b67 build: update cross-repo angular dependencies
See associated pull request for more information.

Closes #69910 as a pr takeover
2026-07-30 09:41:50 -07:00
Angular Robot 4cf5135743 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-07-09 16:04:43 -07:00
Kam 6edabc64e5 refactor(vscode-extension): remove duplicated getTokenAtPosition in completions handler
The completions handler kept a local copy of getTokenAtPosition plus three stale TODO comments noting the duplication, but the function is already exported from server/src/utils.ts (hover.ts and others import it from there). Drop the local copy, import the canonical one, and remove the now-meaningless comments.
2026-07-07 10:11:02 -07:00
Jessica Janiuk 782157dfd6 docs: release notes for the vscode extension 22.0.1 release 2026-06-11 13:05:06 -07:00
Jessica Janiuk dcc4fe06b9 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-06-11 13:04:18 -07:00
Andrew Scott fbe807ca12 fix(vscode-extension): resolve relative workspace tsdk paths to absolute
Resolve the approved relative workspace tsdk path to an absolute path by checking workspace folders. This ensures the path is correctly resolved on the server side.

Fixes #69276
2026-06-10 11:09:55 -07:00
Angular Robot 7be0647e1f build: update dependency @vscode/test-electron to v3
See associated pull request for more information.
2026-06-10 10:25:20 -07:00
Angular Robot 0a9ff4ea47 build: update all non-major dependencies
See associated pull request for more information.
2026-06-09 11:07:34 -07:00
Andrew Scott ed2420c0f8 fix(vscode-extension): inspect tsdk configurations correctly
Inspect both 'js/ts.tsdk.path' and 'typescript.tsdk' configurations separately, as the inspect method always returns a truthy object.

fixes #69145
2026-06-05 10:43:04 -07:00
Alan Agius 232f250a4c build(vscode-extension): disable make_latest on github release publication
Previously, when releasing the VS Code extension, the draft release
was created with make_latest: 'false', but the PATCH request that
published the draft release omitted this option. As a result, GitHub
automatically designated the published release as the 'latest' release.

This change explicitly passes make_latest: 'false' during the publish
request to prevent it from automatically becoming the latest release.
2026-06-05 10:31:54 -07:00
Angular Robot 8da119857f build: update cross-repo angular dependencies
See associated pull request for more information.
2026-06-04 11:24:00 -07:00
Andrew Scott b9e040f44d docs: release notes for the vscode extension 22.0.0 release 2026-06-03 18:26:51 +02:00
Christian Oliff 76dfb94e03 docs: changelog typo fixes 2026-05-29 11:56:26 +02:00
Kam d808866f89 refactor(language-server): drop duplicate isAngularCore helpers in session
session.ts defined isAngularCore, isExternalAngularCore, and
isInternalAngularCore as byte-identical copies of the already-exported
versions in utils.ts. Only isAngularCore was used locally; the other
two were dead. handlers/template_info.ts already imports the utils
version. Remove the duplicates and import isAngularCore from utils.
2026-05-27 10:52:49 -07:00
Alan Agius 26f4ed5056 fix(dev-infra): draft GitHub release to support immutable releases
Update the release tool to create the GitHub release in a draft state initially and publish it only after the extension asset (.vsix) has been successfully uploaded.

GitHub shifted towards immutable releases. If a release is published instantly upon creation,the assets will not be able to be uploaded.
2026-05-27 10:50:20 -07:00
Alan Agius 861d37e669 build: update minimum supported Node.js versions
Update the minimum supported Node.js versions for v22 and v24. Specifically, the minimum supported version for Node.js v22 is bumped to v22.22.3, and for v24 it is bumped to v24.15.0. This ensures compatibility with newer runtime versions and coordinates ranges across monorepo packages.
2026-05-27 10:39:17 -07:00
Andrew Scott df68a96b26 fix(vscode-extension): disable language server in untrusted workspaces
Restrict untrusted workspace support to limited mode. Skip launching the language client and registering commands in restricted mode, and only start them once workspace trust has been explicitly granted.
2026-05-22 12:22:07 -07:00
Andrew Scott d8c871ef80 refactor(vscode-extension): Remove effectively dead code
Since bundled path is at the start of probe locations, it's always going to be found first.
Workspace versions will never be used. getProbeLocations is effectively dead and confusing code.
2026-05-22 09:58:22 -07:00
Andrew Scott 3403e79f9f fix(vscode-extension): restrict jsdoc markdown trust and harden document opening
Restrict JSDoc hover links to the custom openJSDocLink command and implement document
opening using safe workspace APIs.
2026-05-22 09:56:25 -07:00
Andrew Scott 4f4820f410 fix(vscode-extension): prompt for confirmation before loading workspace tsdk
Harden the typescript.tsdk and js/ts.tsdk.path settings loading
in the VS Code extension client.

This change hardens tsdk loading by:
1. Ignoring workspace-level tsdk paths in untrusted workspaces.
2. Prompting the user for explicit confirmation before loading a
   workspace-level tsdk path in trusted workspaces, and saving the
   approval state in a secure, local workspaceState.
2026-05-22 09:52:14 -07:00
Angular Robot 6ff3256b90 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-05-20 10:11:57 -07:00
Angular Robot ff816fb5ae build: update cross-repo angular dependencies
See associated pull request for more information.
2026-05-12 16:41:38 -07:00
Alan Agius b8d3f36ed9 feat(compiler-cli): add support for Node.js 26.0.0
Updates the supported Node.js engine versions to include Node.js 26.

This allows running the CLI on Node.js 26.0.0 and above while continuing to support active LTS versions.
2026-05-06 09:55:38 -07:00
Angular Robot 4f048e7de3 build: update dependency typescript to v6.0.3
See associated pull request for more information.
2026-05-04 13:05:58 -07:00
Andrew Scott af24a4ae3a fix(vscode-extension): Look for tsdk override in the new js/ts.tsdk.path setting
recent versions of vscode use js/ts.tsdk.path rather than typescript.tsdk

relates to #68423
2026-04-29 13:39:15 -07:00
Angular Robot a0d45639a9 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-04-17 15:14:59 -07:00
Angular Robot 56ff89c92d build: update all non-major dependencies
See associated pull request for more information.
2026-04-17 14:26:35 -07:00
Matthieu Riegler 1fa8bb7a99 refactor(vscode-extension): allow toggle attributes via LS.
This change allows to toggle attributes that are on their own line and have a 1+ leading space.

This change doesn't suffer from the issue that was reverted in #68067.

Also this change fixes another regression that messed up highlighting if an attribute value included a '//', like in an href.
2026-04-13 22:10:16 +03:00
Matthieu Riegler e95d84684f fix(vscode-extension): restore correct highlighting
This is a regression introduced by #66891 when trying to support commenting attribute via the language service extension
2026-04-07 14:53:08 -07:00
Matthieu Riegler f3c471e0d5 refactor(compiler): remove fullTemplateTypeCheck compiler option.
The option was deprecated back in v13. Users should use `strictTemplates: true`.
2026-04-06 11:55:09 -07:00
Andrew Scott fb347afb99 refactor: fix types extraction for private (#67898)
fixes types extraction for private entrypoint of language service

PR Close #67898
2026-03-26 21:32:19 +00:00
Andrew Scott eecfa4c909 refactor(language-service): Export template target from API
allows template target to be used in other tooling
2026-03-25 13:07:42 -07:00