angular-docs-cn/packages/language-service/ivy/testing/src
Andrew Scott a86ca4fe04 feat(language-service): Enable renaming of pipes (#40523)
This commit updates the logic in the LS renaming to handle renaming of
pipes, both from the name expression in the pipe metadata as well as
from the template.

The approach here is to introduce a new concept for renaming: an
"indirect" rename. In this type of rename, we find rename locations
in with the native TS Language Service using a different node than the
one we are renaming. Using pipes as an example, if we want to rename the
pipe name from the string literal expression, we use the transform
method to find rename locations rather than the string literal itself
(which will not return any results because it's just a string).

So the general approach is:
* Determine the details about the requested rename location, i.e. the
  targeted template node and symbol for a template rename, or the TS
  node for a rename outside a template.
* Using the details of the location, determine if the node is attempting
  to rename something that is an indirect rename (pipes, selectors,
  bindings). Other renames are considered "direct" and we use whatever
  results the native TSLS returns for the rename locations.
* In the case of indirect renames, we throw out results that do not
  appear in the templates (in this case, the shim files). These results will be
  for the "indirect" rename that we don't want to touch, but are only
  using to find template results.
* Create an additional rename result for the string literal expression
  that is used for the input/output alias, the pipe name, or the
  selector.

 Note that renaming is moving towards being much more accurate in its
 results than "find references". When the approach for renaming
 stabilizes, we may want to then port the changes back to being shared
 with the approach for retrieving references.

PR Close #40523
2021-05-06 17:54:13 -04:00
..
buffer.ts feat(language-service): implement signature help (#41581) 2021-04-13 12:39:17 -07:00
env.ts refactor(language-service): migrate definitions_spec to new testing package (#40966) 2021-02-24 08:54:34 -08:00
host.ts test(language-service): introduce new, more configurable testing env (#40679) 2021-02-22 08:40:41 -08:00
project.ts feat(language-service): Enable renaming of pipes (#40523) 2021-05-06 17:54:13 -04:00
util.ts fix(language-service): use 'any' instead of failing for inline TCBs (#41513) 2021-04-12 21:02:20 -07:00