b48cc6ead5
This commit introduces two visitors, one for Template AST and the other for Expression AST to allow us to easily find the node that most closely corresponds to a given cursor position. This is crucial because many language service APIs take in a `position` parameter, and the information returned depends on how well we can find a good candidate node. In View Engine implementation of language service, the search for the node and the processing of information to return the result are strongly coupled. This makes the code hard to understand and hard to debug because the stack trace is often littered with layers of visitor calls. With this new feature, we could test the "searching" part separately and colocate all the logic (aka hacks) that's required to retrieve an accurate span for a given node. Right now, only the most "narrow" node is returned by the main exported function `findNodeAtPosition`. If needed, we could expose the entire AST path, or expose other methods to provide more context for a node. Note that due to limitations in the template AST interface, there are a few known cases where microsyntax spans are not recorded properly. This will be dealt with in a follow-up PR. PR Close #38540 |
||
---|---|---|
.. | ||
animations | ||
bazel | ||
benchpress | ||
common | ||
compiler | ||
compiler-cli | ||
core | ||
docs | ||
elements | ||
examples | ||
forms | ||
language-service | ||
localize | ||
misc/angular-in-memory-web-api | ||
platform-browser | ||
platform-browser-dynamic | ||
platform-server | ||
platform-webworker | ||
platform-webworker-dynamic | ||
private/testing | ||
router | ||
service-worker | ||
upgrade | ||
zone.js | ||
BUILD.bazel | ||
README.md | ||
circular-deps-test.conf.js | ||
empty.ts | ||
goog.d.ts | ||
license-banner.txt | ||
system.d.ts | ||
tsconfig-build-no-strict.json | ||
tsconfig-build.json | ||
tsconfig-test.json | ||
tsconfig.json | ||
types.d.ts |
README.md
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT