MCPcopy Create free account
hub / github.com/anus-dev/ANUS / setState

Method setState

packages/core/src/ide/ide-client.ts:228–255  ·  view source on GitHub ↗
(
    status: IDEConnectionStatus,
    details?: string,
    logToConsole = false,
  )

Source from the content-addressed store, hash-verified

226 }
227
228 private setState(
229 status: IDEConnectionStatus,
230 details?: string,
231 logToConsole = false,
232 ) {
233 const isAlreadyDisconnected =
234 this.state.status === IDEConnectionStatus.Disconnected &&
235 status === IDEConnectionStatus.Disconnected;
236
237 // Only update details & log to console if the state wasn't already
238 // disconnected, so that the first detail message is preserved.
239 if (!isAlreadyDisconnected) {
240 this.state = { status, details };
241 if (details) {
242 if (logToConsole) {
243 logger.error(details);
244 } else {
245 // We only want to log disconnect messages to debug
246 // if they are not already being logged to the console.
247 logger.debug(details);
248 }
249 }
250 }
251
252 if (status === IDEConnectionStatus.Disconnected) {
253 ideContext.clearIdeContext();
254 }
255 }
256
257 static validateWorkspacePath(
258 ideWorkspacePath: string | undefined,

Callers 4

connectMethod · 0.95
disconnectMethod · 0.95
establishConnectionMethod · 0.95

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected