MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / constructor

Method constructor

src/api/providers/vscode-lm.ts:69–97  ·  view source on GitHub ↗
(options: ApiHandlerOptions)

Source from the content-addressed store, hash-verified

67 private currentRequestCancellation: vscode.CancellationTokenSource | null
68
69 constructor(options: ApiHandlerOptions) {
70 super()
71 this.options = options
72 this.client = null
73 this.disposable = null
74 this.currentRequestCancellation = null
75
76 try {
77 // Listen for model changes and reset client
78 this.disposable = vscode.workspace.onDidChangeConfiguration((event) => {
79 if (event.affectsConfiguration("lm")) {
80 try {
81 this.client = null
82 this.ensureCleanState()
83 } catch (error) {
84 console.error("Error during configuration change cleanup:", error)
85 }
86 }
87 })
88 this.initializeClient()
89 } catch (error) {
90 // Ensure cleanup if constructor fails
91 this.dispose()
92
93 throw new Error(
94 `Roo Code <Language Model API>: Failed to initialize handler: ${error instanceof Error ? error.message : "Unknown error"}`,
95 )
96 }
97 }
98 /**
99 * Initializes the VS Code Language Model client.
100 * This method is called during the constructor to set up the client.

Callers

nothing calls this directly

Calls 6

ensureCleanStateMethod · 0.95
initializeClientMethod · 0.95
disposeMethod · 0.95
affectsConfigurationMethod · 0.80
errorMethod · 0.65

Tested by

no test coverage detected