Home / Function/ guessEditor() — react Function Reference

guessEditor() — react Function Reference

Architecture documentation for the guessEditor() function in editor.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  69e6ca1c_8316_7a87_603d_cb11c67925e2["guessEditor()"]
  39f6c195_7b6b_6f87_7437_5d782daf3565["editor.js"]
  69e6ca1c_8316_7a87_603d_cb11c67925e2 -->|defined in| 39f6c195_7b6b_6f87_7437_5d782daf3565
  e8507b55_91a3_8bd9_66bd_762108bb46c6["launchEditor()"]
  e8507b55_91a3_8bd9_66bd_762108bb46c6 -->|calls| 69e6ca1c_8316_7a87_603d_cb11c67925e2
  style 69e6ca1c_8316_7a87_603d_cb11c67925e2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-core/src/editor.js lines 77–108

function guessEditor(): Array<string> {
  // Explicit config always wins
  if (process.env.REACT_EDITOR) {
    return parse(process.env.REACT_EDITOR);
  }

  // Using `ps x` on OSX we can find out which editor is currently running.
  // Potentially we could use similar technique for Windows and Linux
  if (process.platform === 'darwin') {
    try {
      const output = execSync('ps x').toString();
      const processNames = Object.keys(COMMON_EDITORS);
      for (let i = 0; i < processNames.length; i++) {
        const processName = processNames[i];
        if (output.indexOf(processName) !== -1) {
          return [COMMON_EDITORS[processName]];
        }
      }
    } catch (error) {
      // Ignore...
    }
  }

  // Last resort, use old-school env vars
  if (process.env.VISUAL) {
    return [process.env.VISUAL];
  } else if (process.env.EDITOR) {
    return [process.env.EDITOR];
  }

  return [];
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does guessEditor() do?
guessEditor() is a function in the react codebase, defined in packages/react-devtools-core/src/editor.js.
Where is guessEditor() defined?
guessEditor() is defined in packages/react-devtools-core/src/editor.js at line 77.
What calls guessEditor()?
guessEditor() is called by 1 function(s): launchEditor.

Analyze Your Own Codebase

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

Try Supermodel Free