@@ -16,6 +16,7 @@ import type { Account } from '../../git/models/author';
1616import type { GitBranch } from '../../git/models/branch' ;
1717import type { PullRequest , SearchedPullRequest } from '../../git/models/pullRequest' ;
1818import type { GitRemote } from '../../git/models/remote' ;
19+ import type { ProviderReference } from '../../git/models/remoteProvider' ;
1920import type { Repository } from '../../git/models/repository' ;
2021import { getOrOpenPullRequestRepository } from '../../git/utils/-webview/pullRequest.utils' ;
2122import type { PullRequestUrlIdentity } from '../../git/utils/pullRequest.utils' ;
@@ -46,7 +47,11 @@ import type { ConnectionStateChangeEvent } from '../integrations/integrationServ
4647import { isMaybeGitHubPullRequestUrl } from '../integrations/providers/github/github.utils' ;
4748import { isMaybeGitLabPullRequestUrl } from '../integrations/providers/gitlab/gitlab.utils' ;
4849import type { EnrichablePullRequest , ProviderActionablePullRequest } from '../integrations/providers/models' ;
49- import { getActionablePullRequests , toProviderPullRequestWithUniqueId } from '../integrations/providers/models' ;
50+ import {
51+ getActionablePullRequests ,
52+ supportsCodeSuggest ,
53+ toProviderPullRequestWithUniqueId ,
54+ } from '../integrations/providers/models' ;
5055import {
5156 convertIntegrationIdToEnrichProvider ,
5257 convertRemoteProviderIdToEnrichProvider ,
@@ -63,12 +68,26 @@ import {
6368 sharedCategoryToLaunchpadActionCategoryMap ,
6469} from './models/launchpad' ;
6570
66- export function getSuggestedActions ( category : LaunchpadActionCategory , isCurrentBranch : boolean ) : LaunchpadAction [ ] {
71+ export function getSuggestedActions (
72+ category : LaunchpadActionCategory ,
73+ provider : ProviderReference ,
74+ isCurrentBranch : boolean ,
75+ ) : LaunchpadAction [ ] {
6776 const actions = [ ...prActionsMap . get ( category ) ! ] ;
6877 if ( isCurrentBranch ) {
69- actions . push ( 'show-overview' , 'open-changes' , 'code-suggest' , 'open-in-graph' ) ;
78+ actions . push ( 'show-overview' , 'open-changes' ) ;
79+ if ( supportsCodeSuggest ( provider ) ) {
80+ actions . push ( 'code-suggest' ) ;
81+ }
82+
83+ actions . push ( 'open-in-graph' ) ;
7084 } else {
71- actions . push ( 'open-worktree' , 'switch' , 'switch-and-code-suggest' , 'open-in-graph' ) ;
85+ actions . push ( 'open-worktree' , 'switch' ) ;
86+ if ( supportsCodeSuggest ( provider ) ) {
87+ actions . push ( 'switch-and-code-suggest' ) ;
88+ }
89+
90+ actions . push ( 'open-in-graph' ) ;
7291 }
7392 return actions ;
7493}
@@ -205,7 +224,9 @@ export class LaunchpadProvider implements Disposable {
205224 if ( prs ?. value ?. length && subscription ?. account != null ) {
206225 try {
207226 suggestionCounts = await withDurationAndSlowEventOnTimeout (
208- this . container . drafts . getCodeSuggestionCounts ( prs . value . map ( pr => pr . pullRequest ) ) ,
227+ this . container . drafts . getCodeSuggestionCounts (
228+ prs . value . map ( pr => pr . pullRequest ) . filter ( pr => supportsCodeSuggest ( pr . provider ) ) ,
229+ ) ,
209230 'getCodeSuggestionCounts' ,
210231 this . container ,
211232 ) ;
@@ -326,7 +347,7 @@ export class LaunchpadProvider implements Disposable {
326347 this . _codeSuggestions . get ( item . uuid ) ! . expiresAt < Date . now ( )
327348 ) {
328349 const providerId = item . provider . id ;
329- if ( ! isSupportedLaunchpadIntegrationId ( providerId ) ) {
350+ if ( ! isSupportedLaunchpadIntegrationId ( providerId ) || ! supportsCodeSuggest ( item . provider ) ) {
330351 return undefined ;
331352 }
332353
@@ -790,6 +811,7 @@ export class LaunchpadProvider implements Disposable {
790811
791812 const suggestedActions = getSuggestedActions (
792813 actionableCategory ,
814+ item . provider ,
793815 openRepository ?. localBranch ?. current ?? false ,
794816 ) ;
795817
0 commit comments