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

Hover actions from extensions, better handling of multiple def providers #1313

Merged
merged 1 commit into from Dec 31, 2018

Commits on Dec 31, 2018

  1. extension hover actions + implement "Go to definition" and "Find refe…

    …rences"
    
    The goal of this PR is to make [basic-code-intel](sourcegraph/code-intel-extensions#9) an awesome experience when you need go-to-definition, hovers, and find-references when browsing code in any language with no configuration. That means that the initial experience of site admins and users will be much better, because they get to see code intelligence with *much* less setup required.
    
    **Depends on** the codeintellify PR sourcegraph/codeintellify#70. That PR makes it so that codeintellify (which implements our hover tooltip) supports custom actions, instead of hardcoding "Go to definition" and "Find references".
    
    This commit makes the web app and browser extensin make use of that, so that:
    
    1. The "Go to definition" and "Find references" actions work in the same way in the web app and browser extension as all other action buttons. This means those actions are no longer hard-coded in a separate library.
    2. These buttons are selectively displayed in a smarter way based on (e.g.) whether there are any registered definition or reference providers for the current document. This fixes the issue where both buttons were always shown if there was a hover, even if the client app knew they would not return anything.
    3. The buttons can do smarter things, like opening up the definition panel if there are multiple definitions (instead of just jumping to the 1st definition).
    4. Extensions can add their own actions to the hover, such as "Find implementations", "Show history" (eg when a func, or calls to a func, were added/removed in Git history), "Show authors", "Show users", "Show stack traces", etc.
    
    (I initially began implementing this so that basic-code-intel could add "Go to definition (fuzzy)" to the hover using (4), but I think that the improvements in (2) and (3) actually make that unnecessary for basic-code-intel. (It's still important to prioritize precise definitions in the panel; that will come soon.) See sourcegraph/code-intel-extensions#9 for the basic-code-intel changes that make use of this new behavior. (Note that there are *no* new extension APIs added in this PR, just improved handling of what already exists.))
    sqs committed Dec 31, 2018
    Copy the full SHA
    4f64986 View commit details
    Browse the repository at this point in the history