Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Conversation

@sqs
Copy link
Member

@sqs sqs commented Jan 4, 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 https://github.com/sourcegraph/sourcegraph/issues/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.

Screenshot (note the Fuzzy badge in the panel)

screenshot from 2019-01-03 23-03-24

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit bothered by this in its current implementation. For users having basic-code-intel + other language extensions installed, this will fail to reliably differentiate fuzzy refs from lsp refs (because the badge is shown at the file header level, and not at the reference level).

Worse, it might lead users to think that all they're getting is fuzzy references, and that their other language are not working correctly, since they might end up with fuzzy badges on all file matches, even though there are some LSP matches in there.

With this in mind, rethinking how matches are displayed to show contributions at match-level and not at file header level is needed and not a second step / nice to have IMO. A nice-to-have would be to also show a badge on the file header if all locations in a file match have the same contribution (ie. all matches are "fuzzy")

Copy link
Member Author

@sqs sqs Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this in mind, rethinking how matches are displayed to show contributions at match-level and not at file header level is needed and not a second step / nice to have IMO.

Yeah, on second thought, you are right. Precise matches are almost always going to be a subset of fuzzy matches.

@francisschmaltz Any ideas here? What about showing references in the same way VS Code does: showing 1 line per match, and making the "snippet area" a full editor that scrolls to the line of the match? This would add a new column (or a new level of hierarchy to an existing column) in the panel.

I will think of ideas...we need to figure something out by 3.0.

screenshot from 2019-01-04 03-36-19

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguychard Besides this UI stuff, what do you think of the rest of the PR (the extension API changes)? My assumption for all the UI solutions is that they would use these same API changes, so most of this PR will remain the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest LGTM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't think this will be possible to finish in time to get merged. It requires significant changes to the way results are shown in the panel.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sqs From a product perspective, are there any other items blocking this?

From a technical perspective, I bet this needs to be migrated to the post-Comlink world and some merge conflicts fixed up. I'll optimistically start on this until someone chimes in.

@sqs sqs force-pushed the imprecise-refs branch 4 times, most recently from 3907f04 to 104cb81 Compare January 8, 2019 07:07
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 sourcegraph/sourcegraph#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 sqs added this to the 3.1 milestone Jan 8, 2019
…not in FileMatch header

This turned out to be more complicated than I thought.
@sqs sqs modified the milestones: 3.1, Backlog Feb 17, 2019
@felixfbecker felixfbecker added the needs-design Design requests - add to 'design priorities' project, add a deadline, if possible.. label Feb 20, 2019
@sqs
Copy link
Member Author

sqs commented Mar 7, 2019 via email

@chrismwendt
Copy link
Contributor

Yeah, that's even simpler, and makes it clear that ALL of the defs/refs in the panel are precise or imprecise.

Would it be implemented using https://github.com/sourcegraph/sourcegraph/blob/master/doc/extensions/authoring/builtin_commands.md#executelocationprovider ? I'll give that a shot.

@sqs
Copy link
Member Author

sqs commented Mar 7, 2019

It would just be an action contribution to the panel, not execute location provider.

@chrismwendt
Copy link
Contributor

Gotcha, this part:

image

@sqs
Copy link
Member Author

sqs commented Mar 7, 2019

Yep

@chrismwendt
Copy link
Contributor

Closing this now that I implemented "Imprecise results" action item in the panel in sourcegraph/code-intel-extensions#41

@chrismwendt chrismwendt closed this Mar 8, 2019
@nicksnyder nicksnyder deleted the imprecise-refs branch September 30, 2019 22:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

extensions Sourcegraph extensions needs-design Design requests - add to 'design priorities' project, add a deadline, if possible..

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow references to be marked as imprecise

5 participants