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

Allow references to be marked as imprecise #1174

Closed
sqs opened this issue Nov 29, 2018 · 17 comments
Closed

Allow references to be marked as imprecise #1174

sqs opened this issue Nov 29, 2018 · 17 comments
Assignees
Labels
extensions Sourcegraph extensions
Milestone

Comments

@sqs
Copy link
Member

sqs commented Nov 29, 2018

There are many useful things that are like "references" but that are not precise: our current basic-code-intel extension, #981, cross-repo references that may take shortcuts to be imprecise, etc.

To support these without violating users' reasonable expectation that "references" means precise, it would be valuable to have a way to display imprecise references and communicate the imprecision clearly to the user.

Strawman ideas:

  1. Extensions could mark individual reference results in a field on the result element that would cause the UI to display an "imprecise" or "best-effort" badge (possibly with an explanatory tooltip or label).
  2. Extensions could contribute new panel tabs other than "References", such as "API matches (imprecise)" or "Text matches". Downside: the tab title would need to convey the imprecision, which could make it long and therefore weird-looking in the UI. (Related: External references UI #1172.)

cc @tsenart

@sqs sqs added the needs-design Design requests - add to 'design priorities' project, add a deadline, if possible.. label Nov 29, 2018
@sqs sqs added this to the 3.0 milestone Nov 29, 2018
@tsenart
Copy link
Contributor

tsenart commented Nov 29, 2018

I like the first idea.

@nicksnyder nicksnyder modified the milestones: 3.0-preview.2, 3.0 Dec 14, 2018
@sqs sqs self-assigned this Dec 15, 2018
@sqs
Copy link
Member Author

sqs commented Dec 15, 2018

@francisschmaltz I'll just find a place to add a badge to these reference results (idea 1 above) unless you have any better ideas.

@francisschmaltz
Copy link
Contributor

We should replace the repo badge with this icon if the match is from basic-code-intel:
https://materialdesignicons.com/icon/blur

@sqs sqs added extensions Sourcegraph extensions and removed needs-design Design requests - add to 'design priorities' project, add a deadline, if possible.. labels Dec 31, 2018
sqs added a commit to sourcegraph/code-intel-extensions that referenced this issue Jan 4, 2019
@sqs
Copy link
Member Author

sqs commented Jan 4, 2019

@francisschmaltz:

We should replace the repo badge with this icon if the match is from basic-code-intel:

That solution alone doesn't work well, because we don't want to special-case a single extension (basic-code-intel).

@sqs
Copy link
Member Author

sqs commented Jan 4, 2019

PR at #1627

sqs added a commit that referenced this issue Jan 6, 2019
This lets extensions' location providers (definition/reference/etc. providers) associate context data with each location, and also contribute actions that are shown selectively in the file title for location matches shown in the panel.

Together, these new features allow the basic-code-intel extension to add "Fuzzy" badges to defs/refs in the panel. This fixes #1174.

It would also enable things like:

- Showing a "source" badge on cross-repository reference results explaining how the reference was found (eg by looking up dependents on npm)
- Showing the type of reference (eg denoting some references as "Assignments", some as "Calls", some as "References", etc.)
- Adding an action to "hide" or "always ignore" the reference
- Adding an action to add the match to a saved list
- Adding an action for users to say "This was useful" or "This was not useful" (eg for a code examples extension)

See sourcegraph/code-intel-extensions#10 for an example of how extensions can use this new API.
@nicksnyder
Copy link
Contributor

Is this release blocking for 3.0?

@sqs
Copy link
Member Author

sqs commented Jan 7, 2019

No

sqs added a commit that referenced this issue Jan 8, 2019
This lets extensions' location providers (definition/reference/etc. providers) associate context data with each location, and also contribute actions that are shown selectively in the file title for location matches shown in the panel.

Together, these new features allow the basic-code-intel extension to add "Fuzzy" badges to defs/refs in the panel. This fixes #1174.

It would also enable things like:

- Showing a "source" badge on cross-repository reference results explaining how the reference was found (eg by looking up dependents on npm)
- Showing the type of reference (eg denoting some references as "Assignments", some as "Calls", some as "References", etc.)
- Adding an action to "hide" or "always ignore" the reference
- Adding an action to add the match to a saved list
- Adding an action for users to say "This was useful" or "This was not useful" (eg for a code examples extension)

See sourcegraph/code-intel-extensions#10 for an example of how extensions can use this new API.
@sqs
Copy link
Member Author

sqs commented Jan 8, 2019

I am postponing the fix for this issue (#1627) until 3.1. Because it is postponed, some users may be confused if all of the following are true:

  • They have the basic-code-intel extension enabled
  • They also have a precise code intel extension enabled

In this case, they will need to toggle the "Show/hide fuzzy refs" button if they want to see only precise refs. I will document this.

This is less of a problem for self-hosted instance users than Sourcegraph.com users because self-hosted instance users:

  • need to explicitly enable the basic-code-intel extension (or their admin needs to) to experience this confusion, but explicitly enabling it means they are more likely to be aware of what's happening when they see fuzzy matches; it isn't enabled automatically as it is on Sourcegraph.com users
  • are less likely (at least initially) to have a precise code intel extension enabled, so there is less likely to be confusion about which matches are precise and which are fuzzy

So overall it is still a big win to ship basic-code-intel even without this issue addressed.

@sqs sqs modified the milestones: 3.0, 3.1 Jan 8, 2019
@sqs sqs added this to the 3.1 milestone Jan 15, 2019
@sqs sqs assigned lguychard and unassigned sqs Jan 15, 2019
@sqs
Copy link
Member Author

sqs commented Jan 15, 2019

@lguychard I saw you moved this from 3.1 to 3.0. I am assuming that was a mistake, and I moved it back to 3.1. I don't know if this will be a priority for 3.1, but we can triage it together soon and will have more feedback from users to help us decide.

@sqs sqs self-assigned this Jan 15, 2019
@sqs sqs modified the milestones: 3.1, Backlog Jan 25, 2019
@sqs
Copy link
Member Author

sqs commented Jan 25, 2019

Moving to backlog. Will monitor user feedback and bump this up in priority as needed.

@sqs sqs modified the milestones: Backlog, 3.1 Jan 30, 2019
@lguychard
Copy link
Contributor

Discussed with @sqs:

  • Fuzzy references could be differentiated through highlight color. For instance, in the below screenshot, the two fuzzy references would have a different highlight color, but we would still display all references:

image

  • Hovering on a fuzzy reference could show a simple "fuzzy" badge

@lguychard
Copy link
Contributor

@chrismwendt reassigning to you since you'll be working on this

@chrismwendt
Copy link
Contributor

@lguychard Ah, thanks! I've been looking for this issue. Linking to #2452

@nicksnyder
Copy link
Contributor

Should this be moved into the 3.2 milestone?

@chrismwendt chrismwendt modified the milestones: Backlog, 3.2 Mar 6, 2019
@chrismwendt
Copy link
Contributor

@nicksnyder Yup, moved.

@chrismwendt
Copy link
Contributor

Now that basic code intel has been split into N language extensions, showing the badge at the file header level is OK. You'll never see mixed fuzzy + precise results. That means #1627 will probably solve this issue.

I'll optimistically pick that up and work on it until someone chimes in.

@chrismwendt
Copy link
Contributor

Resolved by adding an "Imprecise results" action item in the references panel sourcegraph/code-intel-extensions#41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions Sourcegraph extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants