Repository: atom/atom
File: src/workspace.js (JavaScript)

Code before:
    if (fileSize >= (this.config.get('core.warnOnLargeFileLimit') * 1048576)) { // 40MB by default
      await new Promise((resolve, reject) => {
        this.applicationDelegate.confirm({
          message: 'Atom will be unresponsive during the loading of very large files.',
          detail: 'Do you still want to load this file?',
          buttons: ['Proceed', 'Cancel']
        }, response => {
          if (response === 1) {
            const error = new Error()
            error.code = 'CANCELLED'
            reject(error)
          } else {
            resolve()
          }
        })
      })
    }

    const buffer = await this.project.bufferForPath(filePath, options)
    return this.textEditorRegistry.build(Object.assign({buffer, autoHeight: false}, options))
  }

  handleGrammarUsed (grammar) {
    if (grammar == null) { return }
    this.packageManager.triggerActivationHook(`${grammar.scopeName}:root-scope-used`)
    return this.packageManager.triggerActivationHook(`${grammar.packageName}:grammar-used`)
  }

  // Public: Returns a {Boolean} that is `true` if `object` is a `TextEditor`.
  //
  // * `object` An {Object} you want to perform the check against.
  isTextEditor (object) {
    return object instanceof TextEditor
  }

  // Extended: Create a new text editor.
  //
  // Returns a {TextEditor}.
  buildTextEditor (params) {
    const editor = this.textEditorRegistry.build(params)
    const subscription = this.textEditorRegistry.maintainConfig(editor)
    editor.onDidDestroy(() => subscription.dispose())
    return editor
  }

  // Public: Asynchronously reopens the last-closed item's URI if it hasn't already been
  // reopened.
  //
  // Returns a {Promise} that is resolved when the item is opened
  reopenItem () {
    const uri = this.destroyedItemURIs.pop()

Review comment (suggestion):
Outside the scope of this PR, but remarking on it anyway; should we :fire the `return` here? There is no value returned by `triggerActivationHook`, so returning here doesn't make any sense and is simply confusing.

Code after:
    if (fileSize >= (this.config.get('core.warnOnLargeFileLimit') * 1048576)) { // 40MB by default
      await new Promise((resolve, reject) => {
        this.applicationDelegate.confirm({
          message: 'Atom will be unresponsive during the loading of very large files.',
          detail: 'Do you still want to load this file?',
          buttons: ['Proceed', 'Cancel']
        }, response => {
          if (response === 1) {
            const error = new Error()
            error.code = 'CANCELLED'
            reject(error)
          } else {
            resolve()
          }
        })
      })
    }

    const buffer = await this.project.bufferForPath(filePath, options)
    return this.textEditorRegistry.build(Object.assign({buffer, autoHeight: false}, options))
  }

  handleGrammarUsed (grammar) {
    if (grammar == null) { return }
    this.packageManager.triggerActivationHook(`${grammar.scopeName}:root-scope-used`)
    this.packageManager.triggerActivationHook(`${grammar.packageName}:grammar-used`)
  }

  // Public: Returns a {Boolean} that is `true` if `object` is a `TextEditor`.
  //
  // * `object` An {Object} you want to perform the check against.
  isTextEditor (object) {
    return object instanceof TextEditor
  }

  // Extended: Create a new text editor.
  //
  // Returns a {TextEditor}.
  buildTextEditor (params) {
    const editor = this.textEditorRegistry.build(params)
    const subscription = this.textEditorRegistry.maintainConfig(editor)
    editor.onDidDestroy(() => subscription.dispose())
    return editor
  }

  // Public: Asynchronously reopens the last-closed item's URI if it hasn't already been
  // reopened.
  //
  // Returns a {Promise} that is resolved when the item is opened
  reopenItem () {
    const uri = this.destroyedItemURIs.pop()