Home / Function/ activate() — react Function Reference

activate() — react Function Reference

Architecture documentation for the activate() function in extension.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6e272fef_1bca_f5e2_f939_7988fd3b6dcb["activate()"]
  f813a254_53b8_e2e6_c027_4a274369335d["extension.ts"]
  6e272fef_1bca_f5e2_f939_7988fd3b6dcb -->|defined in| f813a254_53b8_e2e6_c027_4a274369335d
  53a1361f_1c97_6de1_db62_3c0cc543d4ec["requestAutoDepsDecorations()"]
  6e272fef_1bca_f5e2_f939_7988fd3b6dcb -->|calls| 53a1361f_1c97_6de1_db62_3c0cc543d4ec
  9984b01f_cbfd_cf9b_3f19_3fdcd7f3fdb6["getCurrentlyDecoratedAutoDepFnLoc()"]
  6e272fef_1bca_f5e2_f939_7988fd3b6dcb -->|calls| 9984b01f_cbfd_cf9b_3f19_3fdcd7f3fdb6
  8b03c84d_93d1_8f5d_1738_d4c92b683f01["positionLiteralToVSCodePosition()"]
  6e272fef_1bca_f5e2_f939_7988fd3b6dcb -->|calls| 8b03c84d_93d1_8f5d_1738_d4c92b683f01
  style 6e272fef_1bca_f5e2_f939_7988fd3b6dcb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/react-forgive/client/src/extension.ts lines 26–95

export function activate(context: vscode.ExtensionContext) {
  const serverModule = context.asAbsolutePath(path.join('dist', 'server.js'));
  const documentSelector = [
    {scheme: 'file', language: 'javascriptreact'},
    {scheme: 'file', language: 'typescriptreact'},
  ];

  // If the extension is launched in debug mode then the debug server options are used
  // Otherwise the run options are used
  const serverOptions: ServerOptions = {
    run: {
      module: serverModule,
      transport: TransportKind.ipc,
    },
    debug: {
      module: serverModule,
      transport: TransportKind.ipc,
    },
  };

  const clientOptions: LanguageClientOptions = {
    documentSelector,
    progressOnInitialization: true,
  };

  // Create the language client and start the client.
  try {
    client = new LanguageClient(
      'react-forgive',
      'React Analyzer',
      serverOptions,
      clientOptions,
    );
  } catch {
    vscode.window.showErrorMessage(
      `React Analyzer couldn't be started. See the output channel for details.`,
    );
    return;
  }

  vscode.languages.registerHoverProvider(documentSelector, {
    provideHover(_document, position, _token) {
      requestAutoDepsDecorations(client, position, {shouldUpdateCurrent: true});
      return null;
    },
  });

  vscode.workspace.onDidChangeTextDocument(async _e => {
    const currentlyDecoratedAutoDepFnLoc = getCurrentlyDecoratedAutoDepFnLoc();
    if (currentlyDecoratedAutoDepFnLoc !== null) {
      requestAutoDepsDecorations(client, currentlyDecoratedAutoDepFnLoc.start, {
        shouldUpdateCurrent: false,
      });
    }
  });

  vscode.commands.registerCommand(
    'react.requestAutoDepsDecorations',
    (position: Position) => {
      requestAutoDepsDecorations(
        client,
        positionLiteralToVSCodePosition(position),
        {shouldUpdateCurrent: true},
      );
    },
  );

  client.registerProposedFeatures();
  client.start();
}

Domain

Subdomains

Frequently Asked Questions

What does activate() do?
activate() is a function in the react codebase, defined in compiler/packages/react-forgive/client/src/extension.ts.
Where is activate() defined?
activate() is defined in compiler/packages/react-forgive/client/src/extension.ts at line 26.
What does activate() call?
activate() calls 3 function(s): getCurrentlyDecoratedAutoDepFnLoc, positionLiteralToVSCodePosition, requestAutoDepsDecorations.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free