Deliver web apps with confidence 🚀
Find a file
Andrew Scott d48cfbca75 fix(language-service): Add resource files as roots to their associated projects (#45601)
When an external template is read, adds the template file to to the project which contains.
This is necessary to keep the projects open when navigating away from HTML files.
Since a `tsconfig` cannot express including non-TS files,
we need another way to indicate the template files are considered part of the project.

Note that this does not ensure that the project in question _directly_ contains the component
file. That is, the project might just include the component file through the program rather
than directly in the `include` glob of the `tsconfig`. This distinction is somewhat important
because the TypeScript language service/server prefers projects which _directly_ contain the TS
file (see `projectContainsInfoDirectly` in the TS codebase). What this means it that there can
possibly be a different project used between the TS and HTML files.

For example, in Nx projects, the referenced configs are `tsconfig.app.json` and
`tsconfig.editor.json`. `tsconfig.app.json` comes first in the base `tsconfig.json` and
contains the entry point of the app. `tsconfig.editor.json` contains the `**.ts` glob of all TS
files. This means that `tsconfig.editor.json` will be preferred by the TS server for TS files
but the `tsconfig.app.json` will be used for HTML files since it comes first and we cannot
effectively express `projectContainsInfoDirectly` for HTML files.

We could consider also updating the language server implementation to attempt
to select the project to use for the template file based on which project
contains its component file directly, using either the internal `project.projectContainsInfoDirectly`
or as a workaround, check `project.isRoot(componentTsFile)`.

Finally, keeping the projects open is hugely important in the solution style config case like
Nx. When a TS file is opened, TypeScript will only retain `tsconfig.editor.json` and not
`tsconfig.app.json`. However, if our extension does not also know to select
`tsconfig.editor.json`, it will automatically select `tsconfig.app.json` since it is defined
first in the `tsconfig.json` file. So we need to teach TS server that we are (1) interested in
keeping projects open when there is an HTML file open and (2) optionally attempt to do this
_only_ for projects that we know the TS language service will prioritize in TS files (i.e.,
attempt to only keep `tsconfig.editor.json` open and allow `tsconfig.app.json` to close)
and prioritize that project for all requests.

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

PR Close #45601
2022-05-10 09:36:26 -07:00
.circleci ci: enable the aio_preview CircleCI job (#45935) 2022-05-09 12:33:32 -07:00
.devcontainer ci: update default circle ci image to cimg/node:14.17.6 (#43810) 2021-10-12 17:43:15 +00:00
.github ci: update NgBot to sync internal and external configs (#45915) 2022-05-09 11:55:37 -07:00
.husky build: remove unnecessary husky gitignore file (#42870) 2021-07-19 17:31:55 -07:00
.ng-dev build: updates to account for github primary branch rename 2022-04-28 11:17:01 -06:00
.vscode docs: added commas to sentences in .vscode/README.md (#43684) 2021-10-21 18:39:58 +00:00
.yarn build: update to yarn v1.22.17 (#44150) 2021-11-15 11:19:05 -08:00
aio docs: add the change detection guide to the navigation and pullapprove (#45880) 2022-05-09 13:56:34 -07:00
devtools docs: simplify the DevTools readme and add publishing instructions (#45905) 2022-05-09 13:58:06 -07:00
docs build: remove outdated/obsolete github PR utility scripts (#45868) 2022-05-04 16:29:27 -07:00
goldens fix(forms): Allow NonNullableFormBuilder to be injected. (#45904) 2022-05-09 17:31:48 -07:00
integration build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00
modules feat(forms): Implement strict types for the Angular Forms package. (#43834) 2022-04-12 17:37:04 +00:00
packages fix(language-service): Add resource files as roots to their associated projects (#45601) 2022-05-10 09:36:26 -07:00
scripts build: remove outdated/obsolete github PR utility scripts (#45868) 2022-05-04 16:29:27 -07:00
third_party build: rename shims_for_IE.js -> shims_for_internal_tests.js (#43002) 2021-08-02 10:38:42 -07:00
tools build: disable bazel nodejs linker to improve stability on windows (#45872) 2022-05-04 16:20:57 -07:00
.bazelignore refactor(devtools): bring the angular devtools directory into the root bazel workspace 2022-01-26 16:35:31 -05:00
.bazelrc refactor: setup bazel integration test with new integration rule (#44238) 2021-12-08 13:42:41 -05:00
.bazelversion build: update to bazel v5 for new runfiles API used in dev-infra (#45407) 2022-03-21 16:55:36 -07:00
.clang-format feat(tooling): Add a .clang-format for automated JavaScript formatting. 2015-04-02 08:44:34 -07:00
.editorconfig build: use https link to editorconfig.org in .editorconfig (#27664) 2018-12-18 09:30:09 -08:00
.gitattributes build: remove ts-api-guardian from repository (#42735) 2021-07-26 12:02:14 -07:00
.gitignore ci: fix stamping for builds performed in CI (#45147) 2022-02-25 19:14:05 +00:00
.gitmessage build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00
.mailmap build: add a Git .mailmap with my new name (#19550) 2017-10-09 14:35:30 -07:00
.npmrc build: rely on engines to prevent using npm for dependency install (#41477) 2021-04-07 12:05:01 -07:00
.nvmrc build: update repository to node@16 locally (#44211) 2021-11-24 18:55:33 +00:00
.prettierrc ci: use prettier to format yml files (#42136) 2021-05-19 11:20:20 -07:00
.pullapprove.yml docs: add the change detection guide to the navigation and pullapprove (#45880) 2022-05-09 13:56:34 -07:00
.yarnrc build: update to yarn v1.22.17 (#44150) 2021-11-15 11:19:05 -08:00
browser-providers.conf.js ci: enable Android 12 for tests on CI (#45926) 2022-05-09 11:26:10 -07:00
BUILD.bazel build: disable bazel nodejs linker to improve stability on windows (#45872) 2022-05-04 16:20:57 -07:00
CHANGELOG.md release: cut the v14.0.0-next.16 release (#45875) 2022-05-04 13:13:51 -07:00
CHANGELOG_ARCHIVE.md docs: move old changelog entries to a separate file (#45638) 2022-04-14 15:01:21 -07:00
CODE_OF_CONDUCT.md docs: add Discord as an official communication channel (#39149) 2020-10-14 10:23:15 -07:00
CONTRIBUTING.md build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00
gulpfile.js build: convert CLDR locale extraction from Gulp to Bazel tool (#42230) 2021-07-16 12:44:59 -07:00
karma-js.conf.js build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
LICENSE build: bump license year (#44590) 2022-01-04 12:05:25 -08:00
package.json fix(bazel): speed up d.ts bundling by configuring worker (#45900) 2022-05-05 15:35:14 -07:00
README.md build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00
renovate.json build: updates to account for github primary branch rename 2022-04-28 11:17:01 -06:00
test-events.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-tslint.json refactor(devtools): run ng-dev format on angular devtools files 2022-01-26 16:35:30 -05:00
tslint.json refactor(devtools): bring the angular devtools directory into the root bazel workspace 2022-01-26 16:35:31 -05:00
WORKSPACE build: use vendored yarn script for installing Sass repositories (#45892) 2022-05-05 13:56:38 -07:00
yarn.lock build: update dependency @types/chrome to ^0.0.184 (#45849) 2022-05-05 10:16:12 -07:00
yarn.lock.readme.md build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00

Angular - The modern web developer's platform.

angular-logo
Angular is a development platform for building mobile and desktop web applications
using Typescript/JavaScript and other languages.

www.angular.io

Contributing Guidelines · Submit an Issue · Blog

CI status   Angular on npm   Discord conversation


Documentation

Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.

Advanced

Development Setup

Prerequisites

Setting Up a Project

Install the Angular CLI globally:

npm install -g @angular/cli

Create workspace:

ng new [PROJECT NAME]

Run the application:

cd [PROJECT NAME]
ng serve

Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.

Quickstart

Get started in 5 minutes.

Ecosystem

angular ecosystem logos

Changelog

Learn about the latest improvements.

Upgrading

Check out our upgrade guide to find out the best way to upgrade your project.

Contributing

Contributing Guidelines

Read through our contributing guidelines to learn about our submission process, coding rules and more.

Want to Help?

Want to report a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.

Code of Conduct

Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.

Community

Join the conversation and help the community.

Love Angular badge

Love Angular? Give our repo a star ⬆️.