extension api: allow ext to specify max results in panels (#29738)

Follow up to #29629 to allow extensions to also use the user-configured
`codeIntelligence.maxPanelResults` setting to tell the Sourcegraph how
many results are shown in provided panel.
This commit is contained in:
Thorsten Ball 2022-01-17 14:11:24 +01:00 committed by GitHub
parent 4c0651a8ca
commit 3daa1c5364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -174,9 +174,11 @@ export const Panel = React.memo<Props>(props => {
)
.map((panelView: PanelViewWithComponent) => {
const locationProviderID = panelView.component?.locationProvider
const maxLocations = panelView.component?.maxLocationResults
if (locationProviderID) {
const panelViewWithProvider: PanelViewWithComponent = {
...panelView,
maxLocationResults: maxLocations,
locationProvider: wrapRemoteObservable(
extensionHostAPI.getActiveCodeEditorPosition()
).pipe(

View File

@ -1,6 +1,6 @@
{
"name": "sourcegraph",
"version": "25.4.0",
"version": "25.5.0",
"license": "Apache-2.0",
"description": "Sourcegraph extension API: build extensions that enhance reading and reviewing code in your existing tools",
"author": "Sourcegraph",

View File

@ -757,14 +757,16 @@ declare module 'sourcegraph' {
priority: number
/**
* Display the results of the location provider (with the given ID) in this panel below the
* {@link PanelView#contents}.
* Display the results of the location provider (with the given ID) in
* this panel below the {@link PanelView#contents}. If
* maxLocationResults is set, then only maxLocationResults will be shown
* in the panel.
*
* Experimental. Subject to change or removal without notice.
*
* @internal
*/
component: { locationProvider: string } | null
component: { locationProvider: string; maxLocationResults?: number } | null
/**
* A selector that defines the documents this panel is applicable to.