Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement signature help for the Language Service #41581

Closed
wants to merge 4 commits into from

Commits on Apr 12, 2021

  1. refactor(compiler): add an argumentSpan to the method call AST

    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.
    alxhub committed Apr 12, 2021
    Configuration menu
    Copy the full SHA
    44e608a View commit details
    Browse the repository at this point in the history
  2. fix(compiler): avoid parsing EmptyExpr with a backwards span

    `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.
    alxhub committed Apr 12, 2021
    Configuration menu
    Copy the full SHA
    4735492 View commit details
    Browse the repository at this point in the history
  3. refactor(language-service): specifically identify empty argument posi…

    …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`.
    alxhub committed Apr 12, 2021
    Configuration menu
    Copy the full SHA
    435dfbd View commit details
    Browse the repository at this point in the history
  4. feat(language-service): implement signature help

    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.
    alxhub committed Apr 12, 2021
    Configuration menu
    Copy the full SHA
    3fb47e7 View commit details
    Browse the repository at this point in the history