Implement signature help for the Language Service#41581
Closed
alxhub wants to merge 4 commits intoangular:masterfrom
Closed
Implement signature help for the Language Service#41581alxhub wants to merge 4 commits intoangular:masterfrom
alxhub wants to merge 4 commits intoangular:masterfrom
Conversation
This 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.
3fa912f to
3fb47e7
Compare
zarend
approved these changes
Apr 12, 2021
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, 2021
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. PR Close #41581
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See individual commits for details