File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { getLogger } from 'aws-core-vscode/shared'
88import { AutoDebugCommands } from './commands'
99import { AutoDebugCodeActionsProvider } from './codeActionsProvider'
1010import { AutoDebugController } from './controller'
11+ import { registerAutoDebugFeature } from '../lsp/client'
1112
1213/**
1314 * Auto Debug feature activation for Amazon Q
@@ -75,5 +76,9 @@ export class AutoDebugFeature implements vscode.Disposable {
7576export async function activateAutoDebug ( context : vscode . ExtensionContext ) : Promise < AutoDebugFeature > {
7677 const feature = new AutoDebugFeature ( context )
7778 await feature . activate ( )
79+
80+ // Register the feature with the module-level registry
81+ registerAutoDebugFeature ( feature )
82+
7883 return feature
7984}
Original file line number Diff line number Diff line change @@ -52,6 +52,17 @@ import { InlineTutorialAnnotation } from '../app/inline/tutorials/inlineTutorial
5252import { InlineChatTutorialAnnotation } from '../app/inline/tutorials/inlineChatTutorialAnnotation'
5353import { AutoDebugFeature } from '../autoDebug'
5454
55+ // Module-level registry for AutoDebug feature
56+ let registeredAutoDebugFeature : AutoDebugFeature | undefined
57+
58+ export function registerAutoDebugFeature ( feature : AutoDebugFeature ) {
59+ registeredAutoDebugFeature = feature
60+ }
61+
62+ export function getRegisteredAutoDebugFeature ( ) : AutoDebugFeature | undefined {
63+ return registeredAutoDebugFeature
64+ }
65+
5566const localize = nls . loadMessageBundle ( )
5667const logger = getLogger ( 'amazonqLsp.lspClient' )
5768
@@ -299,9 +310,9 @@ async function onLanguageServerReady(
299310
300311 await retryWithExponentialBackoff (
301312 ( ) => {
302- const autoDebugFeature = ( global as any ) . autoDebugFeature as AutoDebugFeature | undefined
313+ const autoDebugFeature = getRegisteredAutoDebugFeature ( )
303314 if ( ! autoDebugFeature ) {
304- throw new Error ( 'AutoDebug feature not available ' )
315+ throw new Error ( 'AutoDebug feature not registered ' )
305316 }
306317 const controller = autoDebugFeature . getController ( )
307318 if ( ! controller ) {
You can’t perform that action at this time.
0 commit comments