Implement signature help for the Language Service by alxhub · Pull Request #41581 · angular/angular
added 3 commits
April 12, 2021 11:17This commit adds a separate span to `MethodCall` and `SafeMethodCall` which tracks the text span between the `(` and `)` tokens of the call. Tools like the Language Service can use this span to more accurately understand a cursor position within a method call expression.
`EmptyExpr` is somewhat unique, in that it's constructed in a circumstance where the parser has been looking for a particular token or string of tokens and has failed to find any. This means the parser state when constructing `EmptyExpr` is fairly unique. This gives rise to a bug where the parser constructs `EmptyExpr` with a backwards span - a `start` value that's beyond the `end` value. This likely happens because of the strange state the parser is in when recovering with `EmptyExpr`. This commit adds a backstop/workaround to avoid constructing such broken `EmptyExpr` spans (or any other kind of span). Eventually, the parser state should be fixed such that this does not occur, but that requires a significant change to the parser's functionality, so a simple fix in th interim is in order.
…tions This commit changes `getTemplateAtTarget` to be able to identify when a cursor position is specifically within the argument span of a `MethodCall` or `SafeMethodCall` with no arguments. If the call had arguments, one of the argument expressions would be returned instead, but in a call with no arguments the tightest node _is_ the `MethodCall`. Adding the additional argument context will allow for functionality that relies on tracking argument positions, like `getSignatureHelpItems`.
This commit implements signature help in the Language Service, on top of TypeScript's implementation within the TCB. A separate PR adds support for translation of signature help data from TS' API to the LSP in the Language Service extension.
zarend pushed a commit that referenced this pull request
Apr 13, 2021`EmptyExpr` is somewhat unique, in that it's constructed in a circumstance where the parser has been looking for a particular token or string of tokens and has failed to find any. This means the parser state when constructing `EmptyExpr` is fairly unique. This gives rise to a bug where the parser constructs `EmptyExpr` with a backwards span - a `start` value that's beyond the `end` value. This likely happens because of the strange state the parser is in when recovering with `EmptyExpr`. This commit adds a backstop/workaround to avoid constructing such broken `EmptyExpr` spans (or any other kind of span). Eventually, the parser state should be fixed such that this does not occur, but that requires a significant change to the parser's functionality, so a simple fix in th interim is in order. PR Close #41581
zarend pushed a commit that referenced this pull request
Apr 13, 2021…tions (#41581) This commit changes `getTemplateAtTarget` to be able to identify when a cursor position is specifically within the argument span of a `MethodCall` or `SafeMethodCall` with no arguments. If the call had arguments, one of the argument expressions would be returned instead, but in a call with no arguments the tightest node _is_ the `MethodCall`. Adding the additional argument context will allow for functionality that relies on tracking argument positions, like `getSignatureHelpItems`. PR Close #41581
zarend pushed a commit that referenced this pull request
Apr 13, 2021This commit implements signature help in the Language Service, on top of TypeScript's implementation within the TCB. A separate PR adds support for translation of signature help data from TS' API to the LSP in the Language Service extension. PR Close #41581
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters