Skip to content

Instantly share code, notes, and snippets.

@alangpierce
Created July 23, 2017 23:40
Show Gist options
  • Save alangpierce/08611d4d1cf5572fc5a272d7468b96d6 to your computer and use it in GitHub Desktop.
Save alangpierce/08611d4d1cf5572fc5a272d7468b96d6 to your computer and use it in GitHub Desktop.
Instances of soak operations in the Atom codebase
Example from repos/atom/atom/spec/atom-environment-spec.coffee:
637 |
638 | afterEach ->
> 639 | subscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^
640 |
641 | it "invokes onUpdateAvailable listeners", ->
Example from repos/atom/atom/spec/atom-reporter.coffee:
18 |
19 | # Remove first line of stack when it is the same as the error message
> 20 | errorMatch = lines[0]?.match(/^Error: (.*)/)
| ^^^^^^^^^^^^^^^
21 | lines.shift() if message.trim() is errorMatch?[1]?.trim()
22 |
Example from repos/atom/atom/spec/atom-reporter.coffee:
19 | # Remove first line of stack when it is the same as the error message
20 | errorMatch = lines[0]?.match(/^Error: (.*)/)
> 21 | lines.shift() if message.trim() is errorMatch?[1]?.trim()
| ^^^^^^^^^^^^^^^^^^^^
22 |
23 | for line, index in lines
Example from repos/atom/atom/spec/atom-reporter.coffee:
19 | # Remove first line of stack when it is the same as the error message
20 | errorMatch = lines[0]?.match(/^Error: (.*)/)
> 21 | lines.shift() if message.trim() is errorMatch?[1]?.trim()
| ^^^^^^^^^^^^^^
22 |
23 | for line, index in lines
Example from repos/atom/atom/spec/git-repository-spec.coffee:
19 |
20 | afterEach ->
> 21 | repo.destroy() if repo?.repo?
| ^^^^^^^^^^
22 | try
23 | temp.cleanupSync() # These tests sometimes lag at shutting down resources
Example from repos/atom/atom/spec/git-repository-spec.coffee:
340 |
341 | afterEach ->
> 342 | project2?.destroy()
| ^^^^^^^^^^^^^^^^^
343 |
344 | it "subscribes to all the serialized buffers in the project", ->
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
88 | .addCommand "waitForPaneItemCount", (count, timeout, cb) ->
89 | @waitUntil(->
> 90 | @execute(-> atom.workspace?.getActivePane()?.getItems().length)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91 | .then(({value}) -> value is count)
92 | , timeout)
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
88 | .addCommand "waitForPaneItemCount", (count, timeout, cb) ->
89 | @waitUntil(->
> 90 | @execute(-> atom.workspace?.getActivePane()?.getItems().length)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91 | .then(({value}) -> value is count)
92 | , timeout)
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
165 |
166 | client.on "error", (err) ->
> 167 | jasmine.getEnv().currentSpec.fail(new Error(err.response?.body?.value?.message))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168 | finish()
169 |
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
165 |
166 | client.on "error", (err) ->
> 167 | jasmine.getEnv().currentSpec.fail(new Error(err.response?.body?.value?.message))
| ^^^^^^^^^^^^^^^^^^^^^^^^^
168 | finish()
169 |
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
165 |
166 | client.on "error", (err) ->
> 167 | jasmine.getEnv().currentSpec.fail(new Error(err.response?.body?.value?.message))
| ^^^^^^^^^^^^^^^^^^
168 | finish()
169 |
Example from repos/atom/atom/spec/package-manager-spec.coffee:
504 |
505 | afterEach ->
> 506 | registration?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^
507 | mainModule = null
508 |
Example from repos/atom/atom/spec/package-spec.coffee:
40 | expect(pack.isCompatible()).toBe true
41 |
> 42 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-cached-incompatible-native-module')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43 | pack = buildPackage(packagePath)
44 | expect(pack.isCompatible()).toBe false
Example from repos/atom/atom/spec/package-spec.coffee:
75 |
76 | it "returns a promise resolving to the results of `apm rebuild`", ->
> 77 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-index')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78 | pack = buildPackage(packagePath)
79 | rebuildCallbacks = []
Example from repos/atom/atom/spec/package-spec.coffee:
89 |
90 | it "persists build failures in local storage", ->
> 91 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-index')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92 | pack = buildPackage(packagePath)
93 |
Example from repos/atom/atom/spec/package-spec.coffee:
118 |
119 | it "sets cached incompatible modules to an empty array when the rebuild completes (there may be a build error, but rebuilding *deletes* native modules)", ->
> 120 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-incompatible-native-module')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121 | pack = buildPackage(packagePath)
122 |
Example from repos/atom/atom/spec/package-spec.coffee:
144 | it "loads and applies css", ->
145 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe "1234px"
> 146 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-index-css')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 | theme = buildThemePackage(themePath)
148 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
151 | it "parses, loads and applies less", ->
152 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe "1234px"
> 153 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-index-less')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154 | theme = buildThemePackage(themePath)
155 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
162 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe("103px")
163 |
> 164 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165 | theme = buildThemePackage(themePath)
166 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
175 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe "30px"
176 |
> 177 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-without-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178 | theme = buildThemePackage(themePath)
179 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
184 | describe "reloading a theme", ->
185 | beforeEach ->
> 186 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
187 | theme = buildThemePackage(themePath)
188 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
195 | describe "events", ->
196 | beforeEach ->
> 197 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198 | theme = buildThemePackage(themePath)
199 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
208 |
209 | beforeEach ->
> 210 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-different-directory-name')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211 | metadata = atom.packages.loadPackageMetadata(packagePath, true)
212 |
Example from repos/atom/atom/spec/project-spec.coffee:
9 | describe "Project", ->
10 | beforeEach ->
> 11 | atom.project.setPaths([atom.project.getDirectories()[0]?.resolve('dir')])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | # Wait for project's service consumers to be asynchronously added
Example from repos/atom/atom/spec/project-spec.coffee:
21 |
22 | afterEach ->
> 23 | deserializedProject?.destroy()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 |
25 | it "does not deserialize paths to non directories", ->
Example from repos/atom/atom/spec/project-spec.coffee:
110 | notQuittingProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm})
111 | notQuittingProject.deserialize(atom.project.serialize({isUnloading: false})).then ->
> 112 | expect(notQuittingProject.getBuffers()[0].getMarkerLayer(layerA.id)?.getMarker(markerA.id)).toBeUndefined()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113 | expect(notQuittingProject.getBuffers()[0].undo()).toBe(false)
114 |
Example from repos/atom/atom/spec/project-spec.coffee:
116 | quittingProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm})
117 | quittingProject.deserialize(atom.project.serialize({isUnloading: true})).then ->
> 118 | expect(quittingProject.getBuffers()[0].getMarkerLayer(layerA.id)?.getMarker(markerA.id)).not.toBeUndefined()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119 | expect(quittingProject.getBuffers()[0].undo()).toBe(true)
120 |
Example from repos/atom/atom/spec/spec-helper.coffee:
255 | promise.then(moveOn)
256 | promise.catch.call promise, (error) ->
> 257 | jasmine.getEnv().currentSpec.fail("Expected promise to be resolved, but it was rejected with: #{error?.message} #{jasmine.pp(error)}")
| ^^^^^^^^^^^^^^
258 | moveOn()
259 |
Example from repos/atom/atom/spec/squirrel-update-spec.coffee:
11 | error = null
12 | stdout = ''
> 13 | callback?(error, stdout)
| ^^^^^^^^^^^^^^^^^^^^^^^^
14 |
15 | describe "Windows Squirrel Update", ->
Example from repos/atom/atom/spec/squirrel-update-spec.coffee:
80 | jasmine.unspy(Spawner, 'spawn')
81 | spyOn(Spawner, 'spawn').andCallFake (command, args, callback) ->
> 82 | if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut' and args?[3].match /Desktop/i
| ^^^^^^^^
83 | fs.writeFileSync(desktopShortcutPath, '')
84 | else
Example from repos/atom/atom/spec/squirrel-update-spec.coffee:
80 | jasmine.unspy(Spawner, 'spawn')
81 | spyOn(Spawner, 'spawn').andCallFake (command, args, callback) ->
> 82 | if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut' and args?[3].match /Desktop/i
| ^^^^^^^^
83 | fs.writeFileSync(desktopShortcutPath, '')
84 | else
Example from repos/atom/atom/spec/text-editor-spec.coffee:
3962 | textEditor.setCursorBufferPosition([0, 0])
3963 | textEditor.insertText(text)
> 3964 | numberOfNewlines = text.match(/\n/g)?.length
| ^^^^^^^^^^^^^^^^^^^^^^^^^
3965 | endColumn = text.match(/[^\n]*$/)[0]?.length
3966 | textEditor.getLastSelection().setBufferRange([[0, startColumn], [numberOfNewlines, endColumn]])
Example from repos/atom/atom/spec/text-editor-spec.coffee:
3963 | textEditor.insertText(text)
3964 | numberOfNewlines = text.match(/\n/g)?.length
> 3965 | endColumn = text.match(/[^\n]*$/)[0]?.length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3966 | textEditor.getLastSelection().setBufferRange([[0, startColumn], [numberOfNewlines, endColumn]])
3967 | textEditor.cutSelectedText()
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
164 | atom.styles.onDidAddStyleElement styleElementAddedHandler = jasmine.createSpy("styleElementAddedHandler")
165 |
> 166 | cssPath = atom.project.getDirectories()[0]?.resolve('css.css')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167 | lengthBefore = document.querySelectorAll('head style').length
168 |
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
186 |
187 | it "synchronously loads and parses less files at the given path and installs a style tag for it in the head", ->
> 188 | lessPath = atom.project.getDirectories()[0]?.resolve('sample.less')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189 | lengthBefore = document.querySelectorAll('head style').length
190 | atom.themes.requireStylesheet(lessPath)
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
211 | it "supports requiring css and less stylesheets without an explicit extension", ->
212 | atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'css')
> 213 | expect(document.querySelector('head style[source-path*="css.css"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('css.css')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
214 | atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'sample')
215 | expect(document.querySelector('head style[source-path*="sample.less"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('sample.less')
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
213 | expect(document.querySelector('head style[source-path*="css.css"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('css.css')
214 | atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'sample')
> 215 | expect(document.querySelector('head style[source-path*="sample.less"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('sample.less')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
216 |
217 | document.querySelector('head style[source-path*="css.css"]').remove()
Example from repos/atom/atom/spec/tokenized-buffer-spec.coffee:
16 |
17 | afterEach ->
> 18 | tokenizedBuffer?.destroy()
| ^^^^^^^^^^^^^^^^^^^^^^^^
19 |
20 | startTokenizing = (tokenizedBuffer) ->
Example from repos/atom/atom/src/application-delegate.coffee:
151 | else
152 | callback = buttons[buttonLabels[chosen]]
> 153 | callback?()
| ^^^^^^^^^^^
154 |
155 | showMessageDialog: (params) ->
Example from repos/atom/atom/src/atom-environment.coffee:
348 |
349 | @disposables.dispose()
> 350 | @workspace?.destroy()
| ^^^^^^^^^^^^^^^^^^^
351 | @workspace = null
352 | @themes.workspace = null
Example from repos/atom/atom/src/atom-environment.coffee:
351 | @workspace = null
352 | @themes.workspace = null
> 353 | @project?.destroy()
| ^^^^^^^^^^^^^^^^^
354 | @project = null
355 | @commands.clear()
Example from repos/atom/atom/src/atom-environment.coffee:
594 | @focus()
595 | ]
> 596 | steps.push(@setFullScreen(true)) if @windowDimensions?.fullScreen
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
597 | steps.push(@maximize()) if @windowDimensions?.maximized and process.platform isnt 'darwin'
598 | Promise.all(steps)
Example from repos/atom/atom/src/atom-environment.coffee:
595 | ]
596 | steps.push(@setFullScreen(true)) if @windowDimensions?.fullScreen
> 597 | steps.push(@maximize()) if @windowDimensions?.maximized and process.platform isnt 'darwin'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
598 | Promise.all(steps)
599 |
Example from repos/atom/atom/src/atom-environment.coffee:
685 |
686 | loadStatePromise = @loadState().then (state) =>
> 687 | @windowDimensions = state?.windowDimensions
| ^^^^^^^^^^^^^^^^^^^^^^^
688 | @displayWindow().then =>
689 | @commandInstaller.installAtomCommand false, (error) ->
Example from repos/atom/atom/src/atom-environment.coffee:
699 | .catch(console.error)
700 | .then =>
> 701 | @workspace?.confirmClose({
| ^^^^^^^^^^^^^^^^^^^^^^^^
702 | windowCloseRequested: true,
703 | projectHasPaths: @project.getPaths().length > 0
Example from repos/atom/atom/src/atom-environment.coffee:
724 |
725 | @document.body.appendChild(@workspace.getElement())
> 726 | @backgroundStylesheet?.remove()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
727 |
728 | @watchProjectPaths()
Example from repos/atom/atom/src/atom-environment.coffee:
769 | openInitialEmptyEditorIfNecessary: ->
770 | return unless @config.get('core.openEmptyEditorOnStart')
> 771 | if @getLoadSettings().initialPaths?.length is 0 and @workspace.getPaneItems().length is 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
772 | @workspace.open(null)
773 |
Example from repos/atom/atom/src/atom-environment.coffee:
803 |
804 | uninstallWindowEventHandler: ->
> 805 | @windowEventHandler?.unsubscribe()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
806 | @windowEventHandler = null
807 |
Example from repos/atom/atom/src/atom-environment.coffee:
882 | if callbackOrMetadata?
883 | if typeof callbackOrMetadata is 'function'
> 884 | callbackOrMetadata?(error)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
885 | else
886 | error.metadata = callbackOrMetadata
Example from repos/atom/atom/src/atom-environment.coffee:
901 |
902 | setDocumentEdited: (edited) ->
> 903 | @applicationDelegate.setWindowDocumentEdited?(edited)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
904 |
905 | setRepresentedFilename: (filename) ->
Example from repos/atom/atom/src/atom-environment.coffee:
904 |
905 | setRepresentedFilename: (filename) ->
> 906 | @applicationDelegate.setWindowRepresentedFilename?(filename)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
907 |
908 | addProjectFolder: ->
Example from repos/atom/atom/src/atom-environment.coffee:
969 | state = @serialize(options)
970 | savePromise =
> 971 | if storageKey ?= @getStateKey(@project?.getPaths())
| ^^^^^^^^^^^^^^^^^^
972 | @stateStore.save(storageKey, state)
973 | else
Example from repos/atom/atom/src/atom-environment.coffee:
994 | return Promise.resolve() unless state?
995 |
> 996 | if grammarOverridesByPath = state.grammars?.grammarOverridesByPath
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
997 | @grammars.grammarOverridesByPath = grammarOverridesByPath
998 |
Example from repos/atom/atom/src/atom-environment.coffee:
1017 |
1018 | getStateKey: (paths) ->
> 1019 | if paths?.length > 0
| ^^^^^^^^^^^^^
1020 | sha1 = crypto.createHash('sha1').update(paths.slice().sort().join("\n")).digest('hex')
1021 | "editor-#{sha1}"
Example from repos/atom/atom/src/atom-environment.coffee:
1071 |
1072 | openLocations: (locations) ->
> 1073 | needsProjectPaths = @project?.getPaths().length is 0
| ^^^^^^^^^^^^^^^^^^
1074 |
1075 | foldersToAddToProject = []
Example from repos/atom/atom/src/atom-environment.coffee:
1102 | @project.addPath(folder) for folder in foldersToAddToProject
1103 | for {pathToOpen, initialLine, initialColumn} in fileLocationsToOpen
> 1104 | promises.push @workspace?.open(pathToOpen, {initialLine, initialColumn})
| ^^^^^^^^^^^^^^^^
1105 | Promise.all(promises)
1106 | else
Example from repos/atom/atom/src/atom-environment.coffee:
1107 | promises = []
1108 | for {pathToOpen, initialLine, initialColumn} in fileLocationsToOpen
> 1109 | promises.push @workspace?.open(pathToOpen, {initialLine, initialColumn})
| ^^^^^^^^^^^^^^^^
1110 | promise = Promise.all(promises)
1111 |
Example from repos/atom/atom/src/command-installer.coffee:
5 | symlinkCommand = (sourcePath, destinationPath, callback) ->
6 | fs.unlink destinationPath, (error) ->
> 7 | if error? and error?.code isnt 'ENOENT'
| ^^^^^^^^^^^
8 | callback(error)
9 | else
Example from repos/atom/atom/src/command-installer.coffee:
84 |
85 | symlinkCommand commandPath, destinationPath, (error) ->
> 86 | if askForPrivilege and error?.code is 'EACCES'
| ^^^^^^^^^^^
87 | try
88 | error = null
Example from repos/atom/atom/src/command-installer.coffee:
91 | error = err
92 |
> 93 | callback?(error)
| ^^^^^^^^^^^^^^^^
94 |
Example from repos/atom/atom/src/command-registry.coffee:
159 | for commandName, listeners of @selectorBasedListenersByCommandName
160 | for listener in listeners
> 161 | if currentTarget.webkitMatchesSelector?(listener.selector)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
162 | unless commandNames.has(commandName)
163 | commandNames.add(commandName)
Example from repos/atom/atom/src/command-registry.coffee:
231 | immediatePropagationStopped = true
232 | Object.defineProperty dispatchedEvent, 'abortKeyBinding', value: ->
> 233 | event.abortKeyBinding?()
| ^^^^^^^^^^^^^^^^^^^^^^^^
234 |
235 | for key in Object.keys(event)
Example from repos/atom/atom/src/command-registry.coffee:
239 |
240 | loop
> 241 | listeners = @inlineListenersByCommandName[event.type]?.get(currentTarget) ? []
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242 | if currentTarget.webkitMatchesSelector?
243 | selectorBasedListeners =
Example from repos/atom/atom/src/config.coffee:
648 | set: ->
649 | [keyPath, value, options] = arguments
> 650 | scopeSelector = options?.scopeSelector
| ^^^^^^^^^^^^^^^^^^^^^^
651 | source = options?.source
652 | shouldSave = options?.save ? true
Example from repos/atom/atom/src/config.coffee:
649 | [keyPath, value, options] = arguments
650 | scopeSelector = options?.scopeSelector
> 651 | source = options?.source
| ^^^^^^^^^^^^^^^
652 | shouldSave = options?.save ? true
653 |
Example from repos/atom/atom/src/config.coffee:
650 | scopeSelector = options?.scopeSelector
651 | source = options?.source
> 652 | shouldSave = options?.save ? true
| ^^^^^^^^^^^^^
653 |
654 | if source and not scopeSelector
Example from repos/atom/atom/src/config.coffee:
718 | for key in keys
719 | if schema.type is 'object'
> 720 | childSchema = schema.properties?[key]
| ^^^^^^^^^^^^^^^^^^^^^^^
721 | unless childSchema?
722 | if isPlainObject(schema.additionalProperties)
Example from repos/atom/atom/src/config.coffee:
892 |
893 | unobserveUserConfig: ->
> 894 | @watchSubscription?.close()
| ^^^^^^^^^^^^^^^^^^^^^^^^^
895 | @watchSubscription = null
896 |
Example from repos/atom/atom/src/config.coffee:
896 |
897 | notifyFailure: (errorMessage, detail) ->
> 898 | @notificationManager?.addError(errorMessage, {detail, dismissable: true})
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
899 |
900 | save: ->
Example from repos/atom/atom/src/config.coffee:
937 |
938 | getRawValue: (keyPath, options) ->
> 939 | unless options?.excludeSources?.indexOf(@getUserConfigPath()) >= 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
940 | value = getValueAtKeyPath(@settings, keyPath)
941 | unless options?.sources?.length > 0
Example from repos/atom/atom/src/config.coffee:
937 |
938 | getRawValue: (keyPath, options) ->
> 939 | unless options?.excludeSources?.indexOf(@getUserConfigPath()) >= 0
| ^^^^^^^^^^^^^^^^^^^^^^^
940 | value = getValueAtKeyPath(@settings, keyPath)
941 | unless options?.sources?.length > 0
Example from repos/atom/atom/src/config.coffee:
939 | unless options?.excludeSources?.indexOf(@getUserConfigPath()) >= 0
940 | value = getValueAtKeyPath(@settings, keyPath)
> 941 | unless options?.sources?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^
942 | defaultValue = getValueAtKeyPath(@defaultSettings, keyPath)
943 |
Example from repos/atom/atom/src/config.coffee:
939 | unless options?.excludeSources?.indexOf(@getUserConfigPath()) >= 0
940 | value = getValueAtKeyPath(@settings, keyPath)
> 941 | unless options?.sources?.length > 0
| ^^^^^^^^^^^^^^^^
942 | defaultValue = getValueAtKeyPath(@defaultSettings, keyPath)
943 |
Example from repos/atom/atom/src/config.coffee:
1061 |
1062 | makeValueConformToSchema: (keyPath, value, options) ->
> 1063 | if options?.suppressException
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1064 | try
1065 | @makeValueConformToSchema(keyPath, value)
Example from repos/atom/atom/src/context-menu-manager.coffee:
7 | MenuHelpers = require './menu-helpers'
8 |
> 9 | platformContextMenu = require('../package.json')?._atomMenu?['context-menu']
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | # Extended: Provides a registry for commands that you'd like to appear in the
Example from repos/atom/atom/src/context-menu-manager.coffee:
7 | MenuHelpers = require './menu-helpers'
8 |
> 9 | platformContextMenu = require('../package.json')?._atomMenu?['context-menu']
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | # Extended: Provides a registry for commands that you'd like to appear in the
Example from repos/atom/atom/src/context-menu-manager.coffee:
170 | if typeof item.shouldDisplay is 'function'
171 | return null unless item.shouldDisplay(event)
> 172 | item.created?(event)
| ^^^^^^^^^^^^^^^^^^^^
173 | if Array.isArray(item.submenu)
174 | item.submenu = item.submenu
Example from repos/atom/atom/src/context-menu-manager.coffee:
202 | menuTemplate = @templateForEvent(event)
203 |
> 204 | return unless menuTemplate?.length > 0
| ^^^^^^^^^^^^^^^^^^^^
205 | remote.getCurrentWindow().emit('context-menu', menuTemplate)
206 | return
Example from repos/atom/atom/src/cursor.coffee:
162 | {row, column} = @getBufferPosition()
163 | range = [[row, column], [row, Infinity]]
> 164 | @editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) is 0
| ^^^^^^^^^^^^^^^^^^
165 |
166 | # Public: Returns the indentation level of the current line.
Example from repos/atom/atom/src/cursor.coffee:
409 | beginningOfWordPosition = range.start
410 |
> 411 | if not beginningOfWordPosition?.isEqual(currentBufferPosition)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
412 | stop()
413 |
Example from repos/atom/atom/src/cursor.coffee:
434 | endOfWordPosition = range.end
435 |
> 436 | if not endOfWordPosition?.isEqual(currentBufferPosition)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
437 | stop()
438 |
Example from repos/atom/atom/src/cursor.coffee:
572 | # Public: Deselects the current selection.
573 | clearSelection: (options) ->
> 574 | @selection?.clear(options)
| ^^^^^^^^^^^^^^^^^
575 |
576 | # Public: Get the RegExp used by the cursor to determine what a "word" is.
Example from repos/atom/atom/src/cursor.coffee:
584 | nonWordCharacters = _.escapeRegExp(@getNonWordCharacters())
585 | source = "^[\t ]*$|[^\\s#{nonWordCharacters}]+"
> 586 | if options?.includeNonWordCharacters ? true
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
587 | source += "|" + "[#{nonWordCharacters}]+"
588 | new RegExp(source, "g")
Example from repos/atom/atom/src/deprecated-packages.coffee:
1 | semver = require 'semver'
2 |
> 3 | deprecatedPackages = require('../package.json')?._deprecatedPackages ? {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | ranges = {}
5 |
Example from repos/atom/atom/src/git-repository-provider.coffee:
11 | try
12 | gitFileBuff = fs.readFileSync(gitFile, 'utf8')
> 13 | return gitFileBuff?.match(gitFileRegex)[1]
| ^^^^^^^^^^^^^^^^^^
14 |
15 | # Checks whether a valid `.git` directory is contained within the given
Example from repos/atom/atom/src/git-repository-provider.coffee:
23 | # getParent(), getFile(), getSubdirectory().
24 | gitDir = directory.getSubdirectory('.git')
> 25 | gitDirPath = pathFromGitFile(gitDir.getPath?())
| ^^^^^^^^^^^^^^^^^
26 | if gitDirPath
27 | gitDir = new Directory(directory.resolve(gitDirPath))
Example from repos/atom/atom/src/git-repository-provider.coffee:
26 | if gitDirPath
27 | gitDir = new Directory(directory.resolve(gitDirPath))
> 28 | if gitDir.existsSync?() and isValidGitDirectorySync gitDir
| ^^^^^^^^^^^^^^^^^^^^
29 | gitDir
30 | else if directory.isRoot()
Example from repos/atom/atom/src/git-repository.coffee:
181 | # repository.
182 | isProjectAtRoot: ->
> 183 | @projectAtRoot ?= @project?.relativize(@getWorkingDirectory()) is ''
| ^^^^^^^^^^^^^^^^^^^^
184 |
185 | # Public: Makes a path relative to the repository's working directory.
Example from repos/atom/atom/src/git-repository.coffee:
472 | @handlerPath ?= require.resolve('./repository-status-handler')
473 |
> 474 | relativeProjectPaths = @project?.getPaths()
| ^^^^^^^^^^^^^^^^^^
475 | .map (projectPath) => @relativize(projectPath)
476 | .filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath)
Example from repos/atom/atom/src/git-repository.coffee:
476 | .filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath)
477 |
> 478 | @statusTask?.terminate()
| ^^^^^^^^^^^^^^^^^^^^^^
479 | new Promise (resolve) =>
480 | @statusTask = Task.once @handlerPath, @getPath(), relativeProjectPaths, ({statuses, upstream, branch, submodules}) =>
Example from repos/atom/atom/src/git-repository.coffee:
490 |
491 | for submodulePath, submoduleRepo of @getRepo().submodules
> 492 | submoduleRepo.upstream = submodules[submodulePath]?.upstream ? {ahead: 0, behind: 0}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
493 |
494 | unless statusesUnchanged
Example from repos/atom/atom/src/grammar-registry.coffee:
62 |
63 | fileTypes = grammar.fileTypes
> 64 | if customFileTypes = @config.get('core.customFileTypes')?[grammar.scopeName]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65 | fileTypes = fileTypes.concat(customFileTypes)
66 |
Example from repos/atom/atom/src/gutter.coffee:
11 | constructor: (gutterContainer, options) ->
12 | @gutterContainer = gutterContainer
> 13 | @name = options?.name
| ^^^^^^^^^^^^^
14 | @priority = options?.priority ? DefaultPriority
15 | @visible = options?.visible ? true
Example from repos/atom/atom/src/gutter.coffee:
12 | @gutterContainer = gutterContainer
13 | @name = options?.name
> 14 | @priority = options?.priority ? DefaultPriority
| ^^^^^^^^^^^^^^^^^
15 | @visible = options?.visible ? true
16 |
Example from repos/atom/atom/src/gutter.coffee:
13 | @name = options?.name
14 | @priority = options?.priority ? DefaultPriority
> 15 | @visible = options?.visible ? true
| ^^^^^^^^^^^^^^^^
16 |
17 | @emitter = new Emitter
Example from repos/atom/atom/src/keymap-extensions.coffee:
4 | CSON = require 'season'
5 |
> 6 | bundledKeymaps = require('../package.json')?._atomKeymaps
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 |
8 | KeymapManager::onDidLoadBundledKeymaps = (callback) ->
Example from repos/atom/atom/src/language-mode.coffee:
28 | scope = @editor.scopeDescriptorForBufferPosition([start, 0])
29 | commentStrings = @editor.getCommentStrings(scope)
> 30 | return unless commentStrings?.commentStartString
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31 | {commentStartString, commentEndString} = commentStrings
32 |
Example from repos/atom/atom/src/language-mode.coffee:
53 | else
54 | buffer.transact ->
> 55 | indentLength = buffer.lineForRow(start).match(/^\s*/)?[0].length ? 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 | buffer.insert([start, indentLength], commentStartString)
57 | buffer.insert([end, buffer.lineLengthForRow(end)], commentEndString)
Example from repos/atom/atom/src/language-mode.coffee:
62 | for row in [start..end] by 1
63 | line = buffer.lineForRow(row)
> 64 | blank = line?.match(/^\s*$/)
| ^^^^^^^^^^^
65 |
66 | allBlank = false unless blank
Example from repos/atom/atom/src/language-mode.coffee:
85 | for row in [start..end] by 1
86 | line = buffer.lineForRow(row)
> 87 | if indentLength = line.match(indentRegex)?[0].length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 | buffer.insert([row, indentLength], commentStartString)
89 | else
Example from repos/atom/atom/src/language-mode.coffee:
149 |
150 | rowRangeForCommentAtBufferRow: (bufferRow) ->
> 151 | return unless @editor.tokenizedBuffer.tokenizedLines[bufferRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152 |
153 | startRow = bufferRow
Example from repos/atom/atom/src/language-mode.coffee:
156 | if bufferRow > 0
157 | for currentRow in [bufferRow-1..0] by -1
> 158 | break unless @editor.tokenizedBuffer.tokenizedLines[currentRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159 | startRow = currentRow
160 |
Example from repos/atom/atom/src/language-mode.coffee:
161 | if bufferRow < @buffer.getLastRow()
162 | for currentRow in [[email protected]()] by 1
> 163 | break unless @editor.tokenizedBuffer.tokenizedLines[currentRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164 | endRow = currentRow
165 |
Example from repos/atom/atom/src/language-mode.coffee:
175 | indentation = @editor.indentationForBufferRow(row)
176 | if indentation <= startIndentLevel
> 177 | includeRowInFold = indentation is startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178 | foldEndRow = row if includeRowInFold
179 | break
Example from repos/atom/atom/src/language-mode.coffee:
190 | isLineCommentedAtBufferRow: (bufferRow) ->
191 | return false unless 0 <= bufferRow <= @editor.getLastBufferRow()
> 192 | @editor.tokenizedBuffer.tokenizedLines[bufferRow]?.isComment() ? false
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 |
194 | # Find a row range for a 'paragraph' around specified bufferRow. A paragraph
Example from repos/atom/atom/src/language-mode.coffee:
199 | commentStrings = @editor.getCommentStrings(scope)
200 | commentStartRegex = null
> 201 | if commentStrings?.commentStartString? and not commentStrings.commentEndString?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
202 | commentStartRegexString = _.escapeRegExp(commentStrings.commentStartString).replace(/(\s+)$/, '(?:$1)?')
203 | commentStartRegex = new OnigRegExp("^(\\s*)(#{commentStartRegexString})")
Example from repos/atom/atom/src/language-mode.coffee:
206 | if commentStartRegex?
207 | matches = commentStartRegex.searchSync(line)
> 208 | line = line.substring(matches[0].end) if matches?.length
| ^^^^^^^^^^^^^^^
209 | line
210 |
Example from repos/atom/atom/src/language-mode.coffee:
259 | decreaseNextIndentRegex = @decreaseNextIndentRegexForScopeDescriptor(scopeDescriptor)
260 |
> 261 | if options?.skipBlankLines ? true
| ^^^^^^^^^^^^^^^^^^^^^^^
262 | precedingRow = @buffer.previousNonBlankRow(bufferRow)
263 | return 0 unless precedingRow?
Example from repos/atom/atom/src/language-mode.coffee:
271 | unless @editor.isBufferRowCommented(precedingRow)
272 | precedingLine = @buffer.lineForRow(precedingRow)
> 273 | desiredIndentLevel += 1 if increaseIndentRegex?.testSync(precedingLine)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274 | desiredIndentLevel -= 1 if decreaseNextIndentRegex?.testSync(precedingLine)
275 |
Example from repos/atom/atom/src/language-mode.coffee:
272 | precedingLine = @buffer.lineForRow(precedingRow)
273 | desiredIndentLevel += 1 if increaseIndentRegex?.testSync(precedingLine)
> 274 | desiredIndentLevel -= 1 if decreaseNextIndentRegex?.testSync(precedingLine)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
275 |
276 | unless @buffer.isRowBlank(precedingRow)
Example from repos/atom/atom/src/language-mode.coffee:
275 |
276 | unless @buffer.isRowBlank(precedingRow)
> 277 | desiredIndentLevel -= 1 if decreaseIndentRegex?.testSync(line)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278 |
279 | Math.max(desiredIndentLevel, 0)
Example from repos/atom/atom/src/layer-decoration.coffee:
62 |
63 | getPropertiesForMarker: (marker) ->
> 64 | @overridePropertiesByMarker?.get(marker)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65 |
Example from repos/atom/atom/src/main-process/application-menu.coffee:
80 | enableWindowSpecificItems: (enable) ->
81 | for item in @flattenMenuItems(@menu)
> 82 | item.enabled = enable if item.metadata?.windowSpecific
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
83 | return
84 |
Example from repos/atom/atom/src/main-process/application-menu.coffee:
120 | submenu: [
121 | {label: "Check for Update", metadata: {autoUpdate: true}}
> 122 | {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
| ^^^^^^^^^^^^^^^^^^^^^^^^
123 | {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
124 | {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
Example from repos/atom/atom/src/main-process/application-menu.coffee:
121 | {label: "Check for Update", metadata: {autoUpdate: true}}
122 | {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
> 123 | {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
| ^^^^^^^^^^^^^^^^^^^^^^^
124 | {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
125 | {label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()}
Example from repos/atom/atom/src/main-process/application-menu.coffee:
122 | {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
123 | {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
> 124 | {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125 | {label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()}
126 | ]
Example from repos/atom/atom/src/main-process/application-menu.coffee:
157 | # by atom shell to provide nice icons where available.
158 | acceleratorForCommand: (command, keystrokesByCommand) ->
> 159 | firstKeystroke = keystrokesByCommand[command]?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
160 | return null unless firstKeystroke
161 |
Example from repos/atom/atom/src/main-process/atom-application.coffee:
123 | if options.test or options.benchmark or options.benchmarkTest
124 | @openWithOptions(options)
> 125 | else if options.pathsToOpen?.length > 0 or options.urlsToOpen?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
126 | if @config.get('core.restorePreviousWindowsOnStart') is 'always'
127 | @loadState(_.deepClone(options))
Example from repos/atom/atom/src/main-process/atom-application.coffee:
123 | if options.test or options.benchmark or options.benchmarkTest
124 | @openWithOptions(options)
> 125 | else if options.pathsToOpen?.length > 0 or options.urlsToOpen?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
126 | if @config.get('core.restorePreviousWindowsOnStart') is 'always'
127 | @loadState(_.deepClone(options))
Example from repos/atom/atom/src/main-process/atom-application.coffee:
165 | @windows.splice(@windows.indexOf(window), 1)
166 | if @windows.length is 0
> 167 | @applicationMenu?.enableWindowSpecificItems(false)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168 | if process.platform in ['win32', 'linux']
169 | app.quit()
Example from repos/atom/atom/src/main-process/atom-application.coffee:
174 | addWindow: (window) ->
175 | @windows.push window
> 176 | @applicationMenu?.addWindow(window.browserWindow)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
177 | window.once 'window:loaded', =>
178 | @autoUpdateManager?.emitUpdateAvailableEvent(window)
Example from repos/atom/atom/src/main-process/atom-application.coffee:
176 | @applicationMenu?.addWindow(window.browserWindow)
177 | window.once 'window:loaded', =>
> 178 | @autoUpdateManager?.emitUpdateAvailableEvent(window)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
179 |
180 | unless window.isSpec
Example from repos/atom/atom/src/main-process/atom-application.coffee:
224 | handleEvents: ->
225 | getLoadSettings = =>
> 226 | devMode: @focusedWindow()?.devMode
| ^^^^^^^^^^^^^^^^^^^^^^^^^
227 | safeMode: @focusedWindow()?.safeMode
228 |
Example from repos/atom/atom/src/main-process/atom-application.coffee:
225 | getLoadSettings = =>
226 | devMode: @focusedWindow()?.devMode
> 227 | safeMode: @focusedWindow()?.safeMode
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
228 |
229 | @on 'application:quit', -> app.quit()
Example from repos/atom/atom/src/main-process/atom-application.coffee:
234 | @on 'application:inspect', ({x, y, atomWindow}) ->
235 | atomWindow ?= @focusedWindow()
> 236 | atomWindow?.browserWindow.inspectElement(x, y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
237 |
238 | @on 'application:open-documentation', -> shell.openExternal('http://flight-manual.atom.io/')
Example from repos/atom/atom/src/main-process/atom-application.coffee:
257 | @on 'application:zoom', -> Menu.sendActionToFirstResponder('zoom:')
258 | else
> 259 | @on 'application:minimize', -> @focusedWindow()?.minimize()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
260 | @on 'application:zoom', -> @focusedWindow()?.maximize()
261 |
Example from repos/atom/atom/src/main-process/atom-application.coffee:
258 | else
259 | @on 'application:minimize', -> @focusedWindow()?.minimize()
> 260 | @on 'application:zoom', -> @focusedWindow()?.maximize()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
261 |
262 | @openPathOnEvent('application:about', 'atom://about')
Example from repos/atom/atom/src/main-process/atom-application.coffee:
289 | @disposable.add ipcHelpers.on app, 'activate', (event, hasVisibleWindows) =>
290 | unless hasVisibleWindows
> 291 | event?.preventDefault()
| ^^^^^^^^^^^^^^^^^^^^^
292 | @emit('application:new-window')
293 |
Example from repos/atom/atom/src/main-process/atom-application.coffee:
312 | if typeof options.pathsToOpen is 'string'
313 | options.pathsToOpen = [options.pathsToOpen]
> 314 | if options.pathsToOpen?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
315 | options.window = window
316 | @openPaths(options)
Example from repos/atom/atom/src/main-process/atom-application.coffee:
322 | @disposable.add ipcHelpers.on ipcMain, 'update-application-menu', (event, template, keystrokesByCommand) =>
323 | win = BrowserWindow.fromWebContents(event.sender)
> 324 | @applicationMenu?.update(win, template, keystrokesByCommand)
| ^^^^^^^^^^^^^^^^^^^^^^^^
325 |
326 | @disposable.add ipcHelpers.on ipcMain, 'run-package-specs', (event, packageSpecPath) =>
Example from repos/atom/atom/src/main-process/atom-application.coffee:
346 |
347 | @disposable.add ipcHelpers.respondTo 'window-method', (browserWindow, method, args...) =>
> 348 | @atomWindowForBrowserWindow(browserWindow)?[method](args...)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
349 |
350 | @disposable.add ipcHelpers.on ipcMain, 'pick-folder', (event, responseChannel) =>
Example from repos/atom/atom/src/main-process/atom-application.coffee:
390 |
391 | @disposable.add ipcHelpers.on ipcMain, 'execute-javascript-in-dev-tools', (event, code) ->
> 392 | event.sender.devToolsWebContents?.executeJavaScript(code)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
393 |
394 | @disposable.add ipcHelpers.on ipcMain, 'get-auto-update-manager-state', (event) =>
Example from repos/atom/atom/src/main-process/atom-application.coffee:
499 | # the platform.
500 | getDimensionsForNewWindow: ->
> 501 | return if (@focusedWindow() ? @lastFocusedWindow)?.isMaximized()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
502 | dimensions = (@focusedWindow() ? @lastFocusedWindow)?.getDimensions()
503 | offset = @getWindowOffsetForCurrentPlatform()
Example from repos/atom/atom/src/main-process/atom-application.coffee:
500 | getDimensionsForNewWindow: ->
501 | return if (@focusedWindow() ? @lastFocusedWindow)?.isMaximized()
> 502 | dimensions = (@focusedWindow() ? @lastFocusedWindow)?.getDimensions()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
503 | offset = @getWindowOffsetForCurrentPlatform()
504 | if dimensions? and offset?
Example from repos/atom/atom/src/main-process/atom-application.coffee:
551 | currentWindow.devMode is devMode and
552 | (
> 553 | stats.every((stat) -> stat.isFile?()) or
| ^^^^^^^^^^^^^^
554 | stats.some((stat) -> stat.isDirectory?() and not currentWindow.hasProjectPath())
555 | )
Example from repos/atom/atom/src/main-process/atom-application.coffee:
552 | (
553 | stats.every((stat) -> stat.isFile?()) or
> 554 | stats.some((stat) -> stat.isDirectory?() and not currentWindow.hasProjectPath())
| ^^^^^^^^^^^^^^^^^^^
555 | )
556 | )
Example from repos/atom/atom/src/main-process/atom-application.coffee:
617 |
618 | loadState: (options) ->
> 619 | if (@config.get('core.restorePreviousWindowsOnStart') in ['yes', 'always']) and (states = @storageFolder.load('application.json'))?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
620 | for state in states
621 | @openWithOptions(Object.assign(options, {
Example from repos/atom/atom/src/main-process/atom-protocol-handler.coffee:
34 | if relativePath.indexOf('assets/') is 0
35 | assetsPath = path.join(process.env.ATOM_HOME, relativePath)
> 36 | filePath = assetsPath if fs.statSyncNoException(assetsPath).isFile?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37 |
38 | unless filePath
Example from repos/atom/atom/src/main-process/atom-protocol-handler.coffee:
39 | for loadPath in @loadPaths
40 | filePath = path.join(loadPath, relativePath)
> 41 | break if fs.statSyncNoException(filePath).isFile?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 |
43 | callback(filePath)
Example from repos/atom/atom/src/main-process/atom-window.coffee:
65 | for {pathToOpen} in locationsToOpen when pathToOpen
66 | stat = fs.statSyncNoException(pathToOpen) or null
> 67 | if stat?.isDirectory()
| ^^^^^^^^^^^^^^^^^
68 | pathToOpen
69 | else
Example from repos/atom/atom/src/main-process/atom-window.coffee:
69 | else
70 | parentDirectory = path.dirname(pathToOpen)
> 71 | if stat?.isFile() or fs.existsSync(parentDirectory)
| ^^^^^^^^^^^^
72 | parentDirectory
73 | else
Example from repos/atom/atom/src/main-process/atom-window.coffee:
135 | else if pathToCheck is projectPath
136 | true
> 137 | else if fs.statSyncNoException(pathToCheck).isDirectory?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138 | false
139 | else if pathToCheck.indexOf(path.join(projectPath, path.sep)) is 0
Example from repos/atom/atom/src/main-process/atom-window.coffee:
233 |
234 | sendCommandToBrowserWindow: (command, args...) ->
> 235 | action = if args[0]?.contextCommand then 'context-command' else 'command'
| ^^^^^^^^^^^^^^^^^^^^^^^
236 | @browserWindow.webContents.send action, command, args...
237 |
Example from repos/atom/atom/src/main-process/auto-updater-win32.coffee:
20 | # Last line of output is the JSON details about the releases
21 | json = stdout.trim().split('\n').pop()
> 22 | update = JSON.parse(json)?.releasesToApply?.pop?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 | catch error
24 | error.stdout = stdout
Example from repos/atom/atom/src/main-process/auto-updater-win32.coffee:
20 | # Last line of output is the JSON details about the releases
21 | json = stdout.trim().split('\n').pop()
> 22 | update = JSON.parse(json)?.releasesToApply?.pop?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 | catch error
24 | error.stdout = stdout
Example from repos/atom/atom/src/main-process/auto-updater-win32.coffee:
20 | # Last line of output is the JSON details about the releases
21 | json = stdout.trim().split('\n').pop()
> 22 | update = JSON.parse(json)?.releasesToApply?.pop?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 | catch error
24 | error.stdout = stdout
Example from repos/atom/atom/src/main-process/spawner.coffee:
20 | catch error
21 | # Spawn can throw an error
> 22 | process.nextTick -> callback?(error, stdout)
| ^^^^^^^^^^^^^^^^^^^^^^^^
23 | return
24 |
Example from repos/atom/atom/src/main-process/spawner.coffee:
29 | spawnedProcess.on 'close', (code, signal) ->
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
> 31 | error?.code ?= code
| ^^^^^^^^^^^
32 | error?.stdout ?= stdout
33 | callback?(error, stdout)
Example from repos/atom/atom/src/main-process/spawner.coffee:
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
31 | error?.code ?= code
> 32 | error?.stdout ?= stdout
| ^^^^^^^^^^^^^
33 | callback?(error, stdout)
34 | # This is necessary if using Powershell 2 on Windows 7 to get the events to raise
Example from repos/atom/atom/src/main-process/spawner.coffee:
31 | error?.code ?= code
32 | error?.stdout ?= stdout
> 33 | callback?(error, stdout)
| ^^^^^^^^^^^^^^^^^^^^^^^^
34 | # This is necessary if using Powershell 2 on Windows 7 to get the events to raise
35 | # http://stackoverflow.com/questions/9155289/calling-powershell-from-nodejs
Example from repos/atom/atom/src/main-process/squirrel-update.coffee:
119 | # Restart Atom using the version pointed to by the atom.cmd shim
120 | exports.restartAtom = (app) ->
> 121 | if projectPath = global.atomApplication?.lastFocusedWindow?.projectPath
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122 | args = [projectPath]
123 | app.once 'will-quit', -> Spawner.spawn(path.join(binFolder, 'atom.cmd'), args)
Example from repos/atom/atom/src/main-process/squirrel-update.coffee:
119 | # Restart Atom using the version pointed to by the atom.cmd shim
120 | exports.restartAtom = (app) ->
> 121 | if projectPath = global.atomApplication?.lastFocusedWindow?.projectPath
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122 | args = [projectPath]
123 | app.once 'will-quit', -> Spawner.spawn(path.join(binFolder, 'atom.cmd'), args)
Example from repos/atom/atom/src/menu-helpers.coffee:
15 | unless itemSpecificity < ItemSpecificities.get(matchingItem)
16 | menu[matchingItemIndex] = item
> 17 | else unless item.type is 'separator' and _.last(menu)?.type is 'separator'
| ^^^^^^^^^^^^^^^^^^
18 | menu.push(item)
19 |
Example from repos/atom/atom/src/menu-helpers.coffee:
28 | unmerge(matchingItem.submenu, submenuItem) for submenuItem in item.submenu
29 |
> 30 | unless matchingItem.submenu?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31 | menu.splice(matchingItemIndex, 1)
32 |
Example from repos/atom/atom/src/menu-manager.coffee:
9 | MenuHelpers = require './menu-helpers'
10 |
> 11 | platformMenu = require('../package.json')?._atomMenu?.menu
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | # Extended: Provides a registry for menu items that you'd like to appear in the
Example from repos/atom/atom/src/menu-manager.coffee:
9 | MenuHelpers = require './menu-helpers'
10 |
> 11 | platformMenu = require('../package.json')?._atomMenu?.menu
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | # Extended: Provides a registry for menu items that you'd like to appear in the
Example from repos/atom/atom/src/menu-manager.coffee:
192 | # Get an {Array} of {String} classes for the given element.
193 | classesForElement: (element) ->
> 194 | if classList = element?.classList
| ^^^^^^^^^^^^^^^^^^
195 | Array::slice.apply(classList)
196 | else
Example from repos/atom/atom/src/menu-manager.coffee:
199 | sortPackagesMenu: ->
200 | packagesMenu = _.find @template, ({label}) -> MenuHelpers.normalizeLabel(label) is 'Packages'
> 201 | return unless packagesMenu?.submenu?
| ^^^^^^^^^^^^^^^^^^^^^
202 |
203 | packagesMenu.submenu.sort (item1, item2) ->
Example from repos/atom/atom/src/model.coffee:
8 |
9 | constructor: (params) ->
> 10 | @assignId(params?.id)
| ^^^^^^^^^^
11 |
12 | assignId: (id) ->
Example from repos/atom/atom/src/model.coffee:
17 | return unless @isAlive()
18 | @alive = false
> 19 | @destroyed?()
| ^^^^^^^^^^^^^
20 |
21 | isAlive: -> @alive
Example from repos/atom/atom/src/module-cache.coffee:
51 | for childPath in fs.listSync(path.join(modulePath, 'node_modules'))
52 | continue if path.basename(childPath) is '.bin'
> 53 | continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | childMetadataPath = path.join(childPath, 'package.json')
Example from repos/atom/atom/src/module-cache.coffee:
57 |
58 | childMetadata = JSON.parse(fs.readFileSync(childMetadataPath))
> 59 | if childMetadata?.version
| ^^^^^^^^^^^^^^^^^^^^^^
60 | try
61 | mainPath = require.resolve(childPath)
Example from repos/atom/atom/src/module-cache.coffee:
79 | return unless fs.isFileSync(metadataPath)
80 |
> 81 | dependencies = JSON.parse(fs.readFileSync(metadataPath))?.dependencies ? {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82 |
83 | for name, version of dependencies
Example from repos/atom/atom/src/module-cache.coffee:
104 | for childPath in fs.listSync(path.join(modulePath, 'node_modules'))
105 | continue if path.basename(childPath) is '.bin'
> 106 | continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107 |
108 | loadFolderCompatibility(childPath, rootPath, rootMetadata, moduleCache)
Example from repos/atom/atom/src/module-cache.coffee:
136 | if parentPath is nodeModulesPath
137 | packageName = path.basename(childPath)
> 138 | return false if rootMetadata.packageDependencies?.hasOwnProperty(packageName)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139 |
140 | true
Example from repos/atom/atom/src/module-cache.coffee:
152 | resolveFilePath = (relativePath, parentModule) ->
153 | return unless relativePath
> 154 | return unless parentModule?.filename
| ^^^^^^^^^^^^^^^^^^^^^^
155 | return unless relativePath[0] is '.' or isAbsolute(relativePath)
156 |
Example from repos/atom/atom/src/module-cache.coffee:
160 | extension = path.extname(resolvedPath)
161 | if extension
> 162 | return resolvedPath if cache.extensions[extension]?.has(resolvedPath)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163 | else
164 | for extension, paths of cache.extensions
Example from repos/atom/atom/src/module-cache.coffee:
170 | resolveModulePath = (relativePath, parentModule) ->
171 | return unless relativePath
> 172 | return unless parentModule?.filename
| ^^^^^^^^^^^^^^^^^^^^^^
173 |
174 | nativeModules ?= process.binding('natives')
Example from repos/atom/atom/src/module-cache.coffee:
179 | folderPath = path.dirname(parentModule.filename)
180 |
> 181 | range = cache.folders[folderPath]?[relativePath]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
182 | unless range?
183 | if builtinPath = cache.builtins[relativePath]
Example from repos/atom/atom/src/module-cache.coffee:
262 | return
263 |
> 264 | cacheToAdd = metadata?._atomModuleCache
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
265 | return unless cacheToAdd?
266 |
Example from repos/atom/atom/src/overlay-manager.coffee:
21 | cachedOverlay = @overlaysById[decorationId]
22 | return true unless cachedOverlay?
> 23 | cachedOverlay.pixelPosition?.top isnt overlay.pixelPosition?.top or
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 | cachedOverlay.pixelPosition?.left isnt overlay.pixelPosition?.left
25 |
Example from repos/atom/atom/src/overlay-manager.coffee:
21 | cachedOverlay = @overlaysById[decorationId]
22 | return true unless cachedOverlay?
> 23 | cachedOverlay.pixelPosition?.top isnt overlay.pixelPosition?.top or
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
24 | cachedOverlay.pixelPosition?.left isnt overlay.pixelPosition?.left
25 |
Example from repos/atom/atom/src/overlay-manager.coffee:
22 | return true unless cachedOverlay?
23 | cachedOverlay.pixelPosition?.top isnt overlay.pixelPosition?.top or
> 24 | cachedOverlay.pixelPosition?.left isnt overlay.pixelPosition?.left
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 |
26 | measureOverlay: (decorationId, itemView) ->
Example from repos/atom/atom/src/overlay-manager.coffee:
22 | return true unless cachedOverlay?
23 | cachedOverlay.pixelPosition?.top isnt overlay.pixelPosition?.top or
> 24 | cachedOverlay.pixelPosition?.left isnt overlay.pixelPosition?.left
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 |
26 | measureOverlay: (decorationId, itemView) ->
Example from repos/atom/atom/src/overlay-manager.coffee:
31 | itemView = @views.getView(item)
32 | cachedOverlay = @overlaysById[decorationId]
> 33 | unless overlayNode = cachedOverlay?.overlayNode
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
34 | overlayNode = document.createElement('atom-overlay')
35 | overlayNode.classList.add(klass) if klass?
Example from repos/atom/atom/src/package-manager.coffee:
205 | enablePackage: (name) ->
206 | pack = @loadPackage(name)
> 207 | pack?.enable()
| ^^^^^^^^^^^^
208 | pack
209 |
Example from repos/atom/atom/src/package-manager.coffee:
217 |
218 | unless @isPackageDisabled(name)
> 219 | pack?.disable()
| ^^^^^^^^^^^^^
220 |
221 | pack
Example from repos/atom/atom/src/package-manager.coffee:
305 | packages = []
306 | for pack in @getAvailablePackages()
> 307 | metadata = @getLoadedPackage(pack.name)?.metadata ? @loadPackageMetadata(pack, true)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
308 | packages.push(metadata)
309 | packages
Example from repos/atom/atom/src/package-manager.coffee:
351 | hasAtomEngine: (packagePath) ->
352 | metadata = @loadPackageMetadata(packagePath, true)
> 353 | metadata?.engines?.atom?
| ^^^^^^^^^^^^^^^^^^^^^^^
354 |
355 | unobserveDisabledPackages: ->
Example from repos/atom/atom/src/package-manager.coffee:
351 | hasAtomEngine: (packagePath) ->
352 | metadata = @loadPackageMetadata(packagePath, true)
> 353 | metadata?.engines?.atom?
| ^^^^^^^^^^^^^^^^^
354 |
355 | unobserveDisabledPackages: ->
Example from repos/atom/atom/src/package-manager.coffee:
354 |
355 | unobserveDisabledPackages: ->
> 356 | @disabledPackagesSubscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
357 | @disabledPackagesSubscription = null
358 |
Example from repos/atom/atom/src/package-manager.coffee:
367 |
368 | unobservePackagesWithKeymapsDisabled: ->
> 369 | @packagesWithKeymapsDisabledSubscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
370 | @packagesWithKeymapsDisabledSubscription = null
371 |
Example from repos/atom/atom/src/package-manager.coffee:
377 | disabledPackageNames = new Set(@config.get('core.disabledPackages'))
378 | for packageName in keymapsToDisable when not disabledPackageNames.has(packageName)
> 379 | @getLoadedPackage(packageName)?.deactivateKeymaps()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
380 | for packageName in keymapsToEnable when not disabledPackageNames.has(packageName)
381 | @getLoadedPackage(packageName)?.activateKeymaps()
Example from repos/atom/atom/src/package-manager.coffee:
379 | @getLoadedPackage(packageName)?.deactivateKeymaps()
380 | for packageName in keymapsToEnable when not disabledPackageNames.has(packageName)
> 381 | @getLoadedPackage(packageName)?.activateKeymaps()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
382 | null
383 |
Example from repos/atom/atom/src/package-manager.coffee:
391 | metadata.name = packageName
392 |
> 393 | if metadata.repository?.type is 'git' and typeof metadata.repository.url is 'string'
| ^^^^^^^^^^^^^^^^^^^^^^^^^
394 | metadata.repository.url = metadata.repository.url.replace(/(^git\+)|(\.git$)/g, '')
395 |
Example from repos/atom/atom/src/package-manager.coffee:
437 | preloadedPackage = @preloadedPackages[availablePackage.name]
438 |
> 439 | if disabledPackageNames?.has(availablePackage.name)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
440 | if preloadedPackage?
441 | preloadedPackage.deactivate()
Example from repos/atom/atom/src/package-manager.coffee:
566 |
567 | serializePackage: (pack) ->
> 568 | @setPackageState(pack.name, state) if state = pack.serialize?()
| ^^^^^^^^^^^^^^^^^
569 |
570 | # Deactivate all packages
Example from repos/atom/atom/src/package-manager.coffee:
606 | reloadActivePackageStyleSheets: ->
607 | for pack in @getActivePackages() when pack.getType() isnt 'theme'
> 608 | pack.reloadStylesheets?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^
609 | return
610 |
Example from repos/atom/atom/src/package-manager.coffee:
614 |
615 | @resourcePathWithTrailingSlash ?= "#{@resourcePath}#{path.sep}"
> 616 | packagePath?.startsWith(@resourcePathWithTrailingSlash)
| ^^^^^^^^^^^^^^^^^^^^^^^
617 |
618 | loadPackageMetadata: (packagePathOrAvailablePackage, ignoreErrors=false) ->
Example from repos/atom/atom/src/package-manager.coffee:
628 |
629 | if isBundled
> 630 | metadata = @packagesCache[packageName]?.metadata
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
631 |
632 | unless metadata?
Example from repos/atom/atom/src/package-manager.coffee:
642 | metadata.name = packageName
643 |
> 644 | if metadata.repository?.type is 'git' and typeof metadata.repository.url is 'string'
| ^^^^^^^^^^^^^^^^^^^^^^^^^
645 | metadata.repository.url = metadata.repository.url.replace(/(^git\+)|(\.git$)/g, '')
646 |
Example from repos/atom/atom/src/package-manager.coffee:
648 |
649 | normalizePackageMetadata: (metadata) ->
> 650 | unless metadata?._id
| ^^^^^^^^^^^^^
651 | normalizePackageData ?= require 'normalize-package-data'
652 | normalizePackageData(metadata)
Example from repos/atom/atom/src/package.coffee:
42 | @metadata ?= @packageManager.loadPackageMetadata(@path)
43 | @bundledPackage ?= @packageManager.isBundledPackagePath(@path)
> 44 | @name = @metadata?.name ? params.name ? path.basename(@path)
| ^^^^^^^^^^^^^^^
45 | @reset()
46 |
Example from repos/atom/atom/src/package.coffee:
68 |
69 | isTheme: ->
> 70 | @metadata?.theme?
| ^^^^^^^^^^^^^^^^
71 |
72 | measure: (key, fn) ->
Example from repos/atom/atom/src/package.coffee:
154 | # providers are used.
155 | @requireMainModule() unless @mainModule?
> 156 | @mainModule.initialize?(@packageManager.getPackageState(@name) ? {})
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157 | @mainInitialized = true
158 | catch error
Example from repos/atom/atom/src/package.coffee:
185 | if @mainModule? and not @mainActivated
186 | @initializeIfNeeded()
> 187 | @mainModule.activateConfig?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188 | @mainModule.activate?(@packageManager.getPackageState(@name) ? {})
189 | @mainActivated = true
Example from repos/atom/atom/src/package.coffee:
186 | @initializeIfNeeded()
187 | @mainModule.activateConfig?()
> 188 | @mainModule.activate?(@packageManager.getPackageState(@name) ? {})
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189 | @mainActivated = true
190 | @activateServices()
Example from repos/atom/atom/src/package.coffee:
189 | @mainActivated = true
190 | @activateServices()
> 191 | @activationCommandSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 | @activationHookSubscriptions?.dispose()
193 | catch error
Example from repos/atom/atom/src/package.coffee:
190 | @activateServices()
191 | @activationCommandSubscriptions?.dispose()
> 192 | @activationHookSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 | catch error
194 | @handleError("Failed to activate the #{@name} package", error)
Example from repos/atom/atom/src/package.coffee:
194 | @handleError("Failed to activate the #{@name} package", error)
195 |
> 196 | @resolveActivationPromise?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
197 |
198 | registerConfigSchemaFromMetadata: ->
Example from repos/atom/atom/src/package.coffee:
277 | return if not @keymapActivated
278 |
> 279 | @keymapDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
280 | @menuManager.update()
281 |
Example from repos/atom/atom/src/package.coffee:
373 |
374 | activateCoreStartupServices: ->
> 375 | if directoryProviderService = @metadata.providedServices?['atom.directory-provider']
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
376 | @requireMainModule()
377 | servicesByVersion = {}
Example from repos/atom/atom/src/package.coffee:
394 |
395 | getStylesheetPaths: ->
> 396 | if @bundledPackage and @packageManager.packagesCache[@name]?.styleSheetPaths?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
397 | styleSheetPaths = @packageManager.packagesCache[@name].styleSheetPaths
398 | styleSheetPaths.map (styleSheetPath) => path.join(@path, styleSheetPath)
Example from repos/atom/atom/src/package.coffee:
495 | if @mainActivated
496 | try
> 497 | @mainModule?.serialize?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^
498 | catch e
499 | console.error "Error serializing package '#{@name}'", e.stack
Example from repos/atom/atom/src/package.coffee:
495 | if @mainActivated
496 | try
> 497 | @mainModule?.serialize?()
| ^^^^^^^^^^^^^^^^^^^^^^
498 | catch e
499 | console.error "Error serializing package '#{@name}'", e.stack
Example from repos/atom/atom/src/package.coffee:
502 | @activationPromise = null
503 | @resolveActivationPromise = null
> 504 | @activationCommandSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
505 | @activationHookSubscriptions?.dispose()
506 | @configSchemaRegisteredOnActivate = false
Example from repos/atom/atom/src/package.coffee:
503 | @resolveActivationPromise = null
504 | @activationCommandSubscriptions?.dispose()
> 505 | @activationHookSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
506 | @configSchemaRegisteredOnActivate = false
507 | @deactivateResources()
Example from repos/atom/atom/src/package.coffee:
509 | if @mainActivated
510 | try
> 511 | @mainModule?.deactivate?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
512 | @mainModule?.deactivateConfig?()
513 | @mainActivated = false
Example from repos/atom/atom/src/package.coffee:
509 | if @mainActivated
510 | try
> 511 | @mainModule?.deactivate?()
| ^^^^^^^^^^^^^^^^^^^^^^^
512 | @mainModule?.deactivateConfig?()
513 | @mainActivated = false
Example from repos/atom/atom/src/package.coffee:
510 | try
511 | @mainModule?.deactivate?()
> 512 | @mainModule?.deactivateConfig?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
513 | @mainActivated = false
514 | @mainInitialized = false
Example from repos/atom/atom/src/package.coffee:
510 | try
511 | @mainModule?.deactivate?()
> 512 | @mainModule?.deactivateConfig?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
513 | @mainActivated = false
514 | @mainInitialized = false
Example from repos/atom/atom/src/package.coffee:
520 | grammar.deactivate() for grammar in @grammars
521 | settings.deactivate() for settings in @settings
> 522 | @stylesheetDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
523 | @activationDisposables?.dispose()
524 | @keymapDisposables?.dispose()
Example from repos/atom/atom/src/package.coffee:
521 | settings.deactivate() for settings in @settings
522 | @stylesheetDisposables?.dispose()
> 523 | @activationDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
524 | @keymapDisposables?.dispose()
525 | @stylesheetsActivated = false
Example from repos/atom/atom/src/package.coffee:
522 | @stylesheetDisposables?.dispose()
523 | @activationDisposables?.dispose()
> 524 | @keymapDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
525 | @stylesheetsActivated = false
526 | @grammarsActivated = false
Example from repos/atom/atom/src/package.coffee:
534 | @handleError("Failed to reload the #{@name} package stylesheets", error)
535 |
> 536 | @stylesheetDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
537 | @stylesheetDisposables = new CompositeDisposable
538 | @stylesheetsActivated = false
Example from repos/atom/atom/src/package.coffee:
584 |
585 | hasActivationHooks: ->
> 586 | @getActivationHooks()?.length > 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
587 |
588 | hasActivationCommands: ->
Example from repos/atom/atom/src/package.coffee:
675 |
676 | if @metadata._atomModuleCache?
> 677 | relativeNativeModuleBindingPaths = @metadata._atomModuleCache.extensions?['.node'] ? []
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
678 | for relativeNativeModuleBindingPath in relativeNativeModuleBindingPaths
679 | nativeModulePath = path.join(@path, relativeNativeModuleBindingPath, '..', '..', '..')
Example from repos/atom/atom/src/pane-axis-element.coffee:
32 |
33 | isPaneResizeHandleElement: (element) ->
> 34 | element?.nodeName.toLowerCase() is 'atom-pane-resize-handle'
| ^^^^^^^^^^^^^^^^^
35 |
36 | childAdded: ({child, index}) ->
Example from repos/atom/atom/src/pane-axis-element.coffee:
62 | @childRemoved({child: oldChild, index})
63 | @childAdded({child: newChild, index})
> 64 | focusedElement?.focus() if document.activeElement is document.body
| ^^^^^^^^^^^^^^^^^^^^^
65 |
66 | flexScaleChanged: (flexScale) -> @style.flexGrow = flexScale
Example from repos/atom/atom/src/pane-container-element.coffee:
16 | rootChanged: (root) ->
17 | focusedElement = document.activeElement if @hasFocus()
> 18 | @firstChild?.remove()
| ^^^^^^^^^^^^^^^^^^^
19 | if root?
20 | view = @views.getView(root)
Example from repos/atom/atom/src/pane-container-element.coffee:
20 | view = @views.getView(root)
21 | @appendChild(view)
> 22 | focusedElement?.focus()
| ^^^^^^^^^^^^^^^^^^^^^
23 |
24 | hasFocus: ->
Example from repos/atom/atom/src/pane-element.coffee:
86 | itemView = @views.getView(item)
87 |
> 88 | if itemPath = item.getPath?()
| ^^^^^^^^^^^^^^^
89 | @dataset.activeItemName = path.basename(itemPath)
90 | @dataset.activeItemPath = itemPath
Example from repos/atom/atom/src/pane-resize-handle-element.coffee:
18 | resizeToFitContent: ->
19 | # clear flex-grow css style of both pane
> 20 | @previousSibling?.model.setFlexScale(1)
| ^^^^^^^^^^^^^^^^^^^^^^^
21 | @nextSibling?.model.setFlexScale(1)
22 |
Example from repos/atom/atom/src/pane-resize-handle-element.coffee:
19 | # clear flex-grow css style of both pane
20 | @previousSibling?.model.setFlexScale(1)
> 21 | @nextSibling?.model.setFlexScale(1)
| ^^^^^^^^^^^^^^^^^^^
22 |
23 | resizeStarted: (e) ->
Example from repos/atom/atom/src/pane.coffee:
61 | @focused ?= false
62 |
> 63 | @addItems(compact(params?.items ? []))
| ^^^^^^^^^^^^^
64 | @setActiveItem(@items[0]) unless @getActiveItem()?
65 | @addItemsToStack(params?.itemStackIndices ? [])
Example from repos/atom/atom/src/pane.coffee:
63 | @addItems(compact(params?.items ? []))
64 | @setActiveItem(@items[0]) unless @getActiveItem()?
> 65 | @addItemsToStack(params?.itemStackIndices ? [])
| ^^^^^^^^^^^^^^^^^^^^^^^^
66 | @setFlexScale(params?.flexScale ? 1)
67 |
Example from repos/atom/atom/src/pane.coffee:
64 | @setActiveItem(@items[0]) unless @getActiveItem()?
65 | @addItemsToStack(params?.itemStackIndices ? [])
> 66 | @setFlexScale(params?.flexScale ? 1)
| ^^^^^^^^^^^^^^^^^
67 |
68 | getElement: ->
Example from repos/atom/atom/src/pane.coffee:
333 |
334 | unsubscribeFromItem: (item) ->
> 335 | @subscriptionsPerItem.get(item)?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336 | @subscriptionsPerItem.delete(item)
337 |
Example from repos/atom/atom/src/pane.coffee:
357 | @activeItem = activeItem
358 | @emitter.emit 'did-change-active-item', @activeItem
> 359 | @container?.didChangeActiveItemOnPane(this, @activeItem)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
360 | @activeItem
361 |
Example from repos/atom/atom/src/pane.coffee:
499 |
500 | throw new Error("Pane items must be objects. Attempted to add item #{item}.") unless item? and typeof item is 'object'
> 501 | throw new Error("Adding a pane item with URI '#{item.getURI?()}' that has already been destroyed") if item.isDestroyed?()
| ^^^^^^^^^^^^^^^^^^^
502 |
503 | return if item in @items
Example from repos/atom/atom/src/pane.coffee:
499 |
500 | throw new Error("Pane items must be objects. Attempted to add item #{item}.") unless item? and typeof item is 'object'
> 501 | throw new Error("Adding a pane item with URI '#{item.getURI?()}' that has already been destroyed") if item.isDestroyed?()
| ^^^^^^^^^^^^^^
502 |
503 | return if item in @items
Example from repos/atom/atom/src/pane.coffee:
518 |
519 | @emitter.emit 'did-add-item', {item, index, moved}
> 520 | @container?.didAddPaneItem(item, this, index) unless moved
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
521 |
522 | @destroyItem(lastPendingItem) if replacingPendingItem
Example from repos/atom/atom/src/pane.coffee:
571 | @items.splice(index, 1)
572 | @emitter.emit 'did-remove-item', {item, index, destroyed: not moved, moved}
> 573 | @container?.didDestroyPaneItem({item, index, pane: this}) unless moved
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
574 | @destroy() if @items.length is 0 and @config.get('core.destroyEmptyPanes')
575 |
Example from repos/atom/atom/src/pane.coffee:
622 | index = @items.indexOf(item)
623 | if index isnt -1
> 624 | return false if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
625 | @emitter.emit 'will-destroy-item', {item, index}
626 | @container?.willDestroyPaneItem({item, index, pane: this})
Example from repos/atom/atom/src/pane.coffee:
622 | index = @items.indexOf(item)
623 | if index isnt -1
> 624 | return false if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
625 | @emitter.emit 'will-destroy-item', {item, index}
626 | @container?.willDestroyPaneItem({item, index, pane: this})
Example from repos/atom/atom/src/pane.coffee:
624 | return false if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
625 | @emitter.emit 'will-destroy-item', {item, index}
> 626 | @container?.willDestroyPaneItem({item, index, pane: this})
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
627 | if force or not item?.shouldPromptToSave?()
628 | @removeItem(item, false)
Example from repos/atom/atom/src/pane.coffee:
625 | @emitter.emit 'will-destroy-item', {item, index}
626 | @container?.willDestroyPaneItem({item, index, pane: this})
> 627 | if force or not item?.shouldPromptToSave?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
628 | @removeItem(item, false)
629 | item.destroy?()
Example from repos/atom/atom/src/pane.coffee:
625 | @emitter.emit 'will-destroy-item', {item, index}
626 | @container?.willDestroyPaneItem({item, index, pane: this})
> 627 | if force or not item?.shouldPromptToSave?()
| ^^^^^^^^^^^^^^^^^^^^^^^^
628 | @removeItem(item, false)
629 | item.destroy?()
Example from repos/atom/atom/src/pane.coffee:
627 | if force or not item?.shouldPromptToSave?()
628 | @removeItem(item, false)
> 629 | item.destroy?()
| ^^^^^^^^^^^^^^^
630 | else
631 | @promptToSaveItem(item).then (result) =>
Example from repos/atom/atom/src/pane.coffee:
632 | if result
633 | @removeItem(item, false)
> 634 | item.destroy?()
| ^^^^^^^^^^^^^^^
635 | result
636 |
Example from repos/atom/atom/src/pane.coffee:
650 |
651 | promptToSaveItem: (item, options={}) ->
> 652 | return Promise.resolve(true) unless item.shouldPromptToSave?(options)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
653 |
654 | if typeof item.getURI is 'function'
Example from repos/atom/atom/src/pane.coffee:
679 | saveError = (error) =>
680 | if error
> 681 | saveDialog("Save as", @saveItemAs, "'#{item.getTitle?() ? uri}' could not be saved.\nError: #{@getMessageForErrorCode(error.code)}")
| ^^^^^^^^^^^^^^^^
682 | else
683 | Promise.resolve(true)
Example from repos/atom/atom/src/pane.coffee:
683 | Promise.resolve(true)
684 |
> 685 | saveDialog("Save", @saveItem, "'#{item.getTitle?() ? uri}' has changes, do you want to save them?")
| ^^^^^^^^^^^^^^^^
686 |
687 | # Public: Save the active item.
Example from repos/atom/atom/src/pane.coffee:
709 | # Returns a {Promise} that resolves when the save is complete
710 | saveItem: (item, nextAction) =>
> 711 | if typeof item?.getURI is 'function'
| ^^^^^^^^^^^^
712 | itemURI = item.getURI()
713 | else if typeof item?.getUri is 'function'
Example from repos/atom/atom/src/pane.coffee:
711 | if typeof item?.getURI is 'function'
712 | itemURI = item.getURI()
> 713 | else if typeof item?.getUri is 'function'
| ^^^^^^^^^^^^
714 | itemURI = item.getUri()
715 |
Example from repos/atom/atom/src/pane.coffee:
717 | if item.save?
718 | promisify -> item.save()
> 719 | .then -> nextAction?()
| ^^^^^^^^^^^^^
720 | .catch (error) =>
721 | if nextAction
Example from repos/atom/atom/src/pane.coffee:
724 | @handleSaveError(error, item)
725 | else
> 726 | nextAction?()
| ^^^^^^^^^^^^^
727 | else
728 | @saveItemAs(item, nextAction)
Example from repos/atom/atom/src/pane.coffee:
737 | # provided
738 | saveItemAs: (item, nextAction) =>
> 739 | return unless item?.saveAs?
| ^^^^^^^^^^^^
740 |
741 | saveOptions = item.getSaveDialogOptions?() ? {}
Example from repos/atom/atom/src/pane.coffee:
739 | return unless item?.saveAs?
740 |
> 741 | saveOptions = item.getSaveDialogOptions?() ? {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
742 | saveOptions.defaultPath ?= item.getPath()
743 | newItemPath = @applicationDelegate.showSaveDialog(saveOptions)
Example from repos/atom/atom/src/pane.coffee:
744 | if newItemPath
745 | promisify -> item.saveAs(newItemPath)
> 746 | .then -> nextAction?()
| ^^^^^^^^^^^^^
747 | .catch (error) =>
748 | if nextAction?
Example from repos/atom/atom/src/pane.coffee:
756 | saveItems: ->
757 | for item in @getItems()
> 758 | @saveItem(item) if item.isModified?()
| ^^^^^^^^^^^^^^^^^^
759 | return
760 |
Example from repos/atom/atom/src/pane.coffee:
785 |
786 | copyActiveItem: ->
> 787 | @activeItem?.copy?()
| ^^^^^^^^^^^^^^^^^^^^
788 |
789 | ###
Example from repos/atom/atom/src/pane.coffee:
785 |
786 | copyActiveItem: ->
> 787 | @activeItem?.copy?()
| ^^^^^^^^^^^^^^^^^
788 |
789 | ###
Example from repos/atom/atom/src/pane.coffee:
795 | # Returns a {Boolean}.
796 | isActive: ->
> 797 | @container?.getActivePane() is this
| ^^^^^^^^^^^^^^^^^^^^^^^^^
798 |
799 | # Public: Makes this pane the *active* pane, causing it to gain focus.
Example from repos/atom/atom/src/pane.coffee:
800 | activate: ->
801 | throw new Error("Pane has been destroyed") if @isDestroyed()
> 802 | @container?.didActivatePane(this)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
803 | @emitter.emit 'did-activate'
804 |
Example from repos/atom/atom/src/pane.coffee:
808 | # itself will not be destroyed.
809 | destroy: ->
> 810 | if @container?.isAlive() and @container.getPanes().length is 1
| ^^^^^^^^^^^^^^^^^^^
811 | @destroyItems()
812 | else
Example from repos/atom/atom/src/pane.coffee:
813 | @emitter.emit 'will-destroy'
814 | @alive = false
> 815 | @container?.willDestroyPane(pane: this)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
816 | @container.activateNextPane() if @isActive()
817 | @emitter.emit 'did-destroy'
Example from repos/atom/atom/src/pane.coffee:
817 | @emitter.emit 'did-destroy'
818 | @emitter.dispose()
> 819 | item.destroy?() for item in @items.slice()
| ^^^^^^^^^^^^^^^
820 | @container?.didDestroyPane(pane: this)
821 |
Example from repos/atom/atom/src/pane.coffee:
818 | @emitter.dispose()
819 | item.destroy?() for item in @items.slice()
> 820 | @container?.didDestroyPane(pane: this)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
821 |
822 | isAlive: -> @alive
Example from repos/atom/atom/src/pane.coffee:
872 |
873 | split: (orientation, side, params) ->
> 874 | if params?.copyActiveItem
| ^^^^^^^^^^^^^^^^^^^^^^
875 | params.items ?= []
876 | params.items.push(@copyActiveItem())
Example from repos/atom/atom/src/pane.coffee:
885 | when 'after' then @parent.insertChildAfter(this, newPane)
886 |
> 887 | @moveItemToPane(@activeItem, newPane) if params?.moveActiveItem
| ^^^^^^^^^^^^^^^^^^^^^^
888 |
889 | newPane.activate()
Example from repos/atom/atom/src/pane.coffee:
955 |
956 | handleSaveError: (error, item) ->
> 957 | itemPath = error.path ? item?.getPath?()
| ^^^^^^^^^^^^^^^^
958 | addWarningWithPath = (message, options) =>
959 | message = "#{message} '#{itemPath}'" if itemPath
Example from repos/atom/atom/src/pane.coffee:
955 |
956 | handleSaveError: (error, item) ->
> 957 | itemPath = error.path ? item?.getPath?()
| ^^^^^^^^^^^^^
958 | addWarningWithPath = (message, options) =>
959 | message = "#{message} '#{itemPath}'" if itemPath
Example from repos/atom/atom/src/pane.coffee:
963 | if customMessage?
964 | addWarningWithPath("Unable to save file: #{customMessage}")
> 965 | else if error.code is 'EISDIR' or error.message?.endsWith?('is a directory')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
966 | @notificationManager.addWarning("Unable to save file: #{error.message}")
967 | else if error.code in ['EPERM', 'EBUSY', 'UNKNOWN', 'EEXIST', 'ELOOP', 'EAGAIN']
Example from repos/atom/atom/src/pane.coffee:
963 | if customMessage?
964 | addWarningWithPath("Unable to save file: #{customMessage}")
> 965 | else if error.code is 'EISDIR' or error.message?.endsWith?('is a directory')
| ^^^^^^^^^^^^^^^^^^^^^^^
966 | @notificationManager.addWarning("Unable to save file: #{error.message}")
967 | else if error.code in ['EPERM', 'EBUSY', 'UNKNOWN', 'EEXIST', 'ELOOP', 'EAGAIN']
Example from repos/atom/atom/src/project.coffee:
33 | destroyed: ->
34 | buffer.destroy() for buffer in @buffers.slice()
> 35 | repository?.destroy() for repository in @repositories.slice()
| ^^^^^^^^^^^^^^^^^^^
36 | @rootDirectories = []
37 | @repositories = []
Example from repos/atom/atom/src/project.coffee:
41 | @emitter = new Emitter
42 |
> 43 | buffer?.destroy() for buffer in @buffers
| ^^^^^^^^^^^^^^^
44 | @buffers = []
45 | @setPaths([])
Example from repos/atom/atom/src/project.coffee:
152 | # directory.
153 | @repositoryPromisesByPath.delete(pathForDirectory) unless repo?
> 154 | repo?.onDidDestroy?(=> @repositoryPromisesByPath.delete(pathForDirectory))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155 | repo
156 | @repositoryPromisesByPath.set(pathForDirectory, promise)
Example from repos/atom/atom/src/project.coffee:
152 | # directory.
153 | @repositoryPromisesByPath.delete(pathForDirectory) unless repo?
> 154 | repo?.onDidDestroy?(=> @repositoryPromisesByPath.delete(pathForDirectory))
| ^^^^^^^^^^^^^^^^^^
155 | repo
156 | @repositoryPromisesByPath.set(pathForDirectory, promise)
Example from repos/atom/atom/src/project.coffee:
169 | # * `projectPaths` {Array} of {String} paths.
170 | setPaths: (projectPaths) ->
> 171 | repository?.destroy() for repository in @repositories
| ^^^^^^^^^^^^^^^^^^^
172 | @rootDirectories = []
173 | @repositories = []
Example from repos/atom/atom/src/project.coffee:
190 | repo = null
191 | for provider in @repositoryProviders
> 192 | break if repo = provider.repositoryForDirectorySync?(directory)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 | @repositories.push(repo ? null)
194 |
Example from repos/atom/atom/src/project.coffee:
193 | @repositories.push(repo ? null)
194 |
> 195 | unless options?.emitEvent is false
| ^^^^^^^^^^^^^^^^^^
196 | @emitter.emit 'did-change-paths', @getPaths()
197 |
Example from repos/atom/atom/src/project.coffee:
199 | directory = null
200 | for provider in @directoryProviders
> 201 | break if directory = provider.directoryForURISync?(projectPath)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
202 | directory ?= @defaultDirectoryProvider.directoryForURISync(projectPath)
203 | directory
Example from repos/atom/atom/src/project.coffee:
220 | [removedDirectory] = @rootDirectories.splice(indexToRemove, 1)
221 | [removedRepository] = @repositories.splice(indexToRemove, 1)
> 222 | removedRepository?.destroy() unless removedRepository in @repositories
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
223 | @emitter.emit "did-change-paths", @getPaths()
224 | true
Example from repos/atom/atom/src/project.coffee:
233 | return unless uri
234 |
> 235 | if uri?.match(/[A-Za-z0-9+-.]+:\/\//) # leave path alone if it has a scheme
| ^^^^^^^^^^
236 | uri
237 | else
Example from repos/atom/atom/src/project.coffee:
262 | for rootDirectory in @rootDirectories
263 | relativePath = rootDirectory.relativize(fullPath)
> 264 | if relativePath?.length < result[1].length
| ^^^^^^^^^^^^^^^^^^^^
265 | result = [rootDirectory.getPath(), relativePath]
266 | result
Example from repos/atom/atom/src/project.coffee:
329 | # Is the buffer for the given path modified?
330 | isPathModified: (filePath) ->
> 331 | @findBufferForPath(@resolvePath(filePath))?.isModified()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
332 |
333 | findBufferForPath: (filePath) ->
Example from repos/atom/atom/src/project.coffee:
416 | removeBufferAtIndex: (index, options={}) ->
417 | [buffer] = @buffers.splice(index, 1)
> 418 | buffer?.destroy()
| ^^^^^^^^^^^^^^^
419 |
420 | eachBuffer: (args...) ->
Example from repos/atom/atom/src/register-default-commands.coffee:
36 | 'application:new-file': -> ipcRenderer.send('command', 'application:new-file')
37 | 'application:open': ->
> 38 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 | ipcRenderer.send('open-command', 'application:open', defaultPath)
40 | 'application:open-file': ->
Example from repos/atom/atom/src/register-default-commands.coffee:
36 | 'application:new-file': -> ipcRenderer.send('command', 'application:new-file')
37 | 'application:open': ->
> 38 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 | ipcRenderer.send('open-command', 'application:open', defaultPath)
40 | 'application:open-file': ->
Example from repos/atom/atom/src/register-default-commands.coffee:
39 | ipcRenderer.send('open-command', 'application:open', defaultPath)
40 | 'application:open-file': ->
> 41 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 | ipcRenderer.send('open-command', 'application:open-file', defaultPath)
43 | 'application:open-folder': ->
Example from repos/atom/atom/src/register-default-commands.coffee:
39 | ipcRenderer.send('open-command', 'application:open', defaultPath)
40 | 'application:open-file': ->
> 41 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 | ipcRenderer.send('open-command', 'application:open-file', defaultPath)
43 | 'application:open-folder': ->
Example from repos/atom/atom/src/register-default-commands.coffee:
42 | ipcRenderer.send('open-command', 'application:open-file', defaultPath)
43 | 'application:open-folder': ->
> 44 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 | ipcRenderer.send('open-command', 'application:open-folder', defaultPath)
46 | 'application:open-dev': -> ipcRenderer.send('command', 'application:open-dev')
Example from repos/atom/atom/src/register-default-commands.coffee:
42 | ipcRenderer.send('open-command', 'application:open-file', defaultPath)
43 | 'application:open-folder': ->
> 44 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 | ipcRenderer.send('open-command', 'application:open-folder', defaultPath)
46 | 'application:open-dev': -> ipcRenderer.send('command', 'application:open-dev')
Example from repos/atom/atom/src/scan-handler.coffee:
42 |
43 | processPaths = (rootPath, paths) ->
> 44 | return paths unless paths?.length > 0
| ^^^^^^^^^^^^^
45 | rootPathBase = path.basename(rootPath)
46 | results = []
Example from repos/atom/atom/src/selection.coffee:
93 | delete options.flash if options.flash?
94 | @marker.setBufferRange(bufferRange, options)
> 95 | @autoscroll() if options?.autoscroll ? @isLastSelection()
| ^^^^^^^^^^^^^^^^^^^
96 | @decoration.flash('flash', @editor.selectionFlashDuration) if needsFlash
97 |
Example from repos/atom/atom/src/selection.coffee:
177 | @goalScreenRange = null
178 | @marker.clearTail() unless @retainSelection
> 179 | @autoscroll() if options?.autoscroll ? @isLastSelection()
| ^^^^^^^^^^^^^^^^^^^
180 | @finalize()
181 |
Example from repos/atom/atom/src/selection.coffee:
323 | expandOverWord: (options) ->
324 | @setBufferRange(@getBufferRange().union(@cursor.getCurrentWordBufferRange()), autoscroll: false)
> 325 | @cursor.autoscroll() if options?.autoscroll ? true
| ^^^^^^^^^^^^^^^^^^^
326 |
327 | # Public: Selects an entire line in the buffer.
Example from repos/atom/atom/src/selection.coffee:
347 | range = @getBufferRange().union(@cursor.getCurrentLineBufferRange(includeNewline: true))
348 | @setBufferRange(range, autoscroll: false)
> 349 | @cursor.autoscroll() if options?.autoscroll ? true
| ^^^^^^^^^^^^^^^^^^^
350 |
351 | ###
Example from repos/atom/atom/src/selection.coffee:
480 | bufferRange = @getBufferRange()
481 | @editor.buffer.delete(bufferRange) unless bufferRange.isEmpty()
> 482 | @cursor?.setBufferPosition(bufferRange.start)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
483 |
484 | # Public: Removes the line at the beginning of the selection if the selection
Example from repos/atom/atom/src/selection.coffee:
554 | leadingTabRegex = new RegExp("^( {1,#{@editor.getTabLength()}}|\t)")
555 | for row in [start..end]
> 556 | if matchLength = buffer.lineForRow(row).match(leadingTabRegex)?[0].length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
557 | buffer.delete [[row, 0], [row, matchLength]]
558 | return
Example from repos/atom/atom/src/selection.coffee:
807 |
808 | finalize: ->
> 809 | @initialScreenRange = null unless @initialScreenRange?.isEqual(@getScreenRange())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
810 | if @isEmpty()
811 | @wordwise = false
Example from repos/atom/atom/src/task.coffee:
79 | Grim.addSerializedDeprecation(deprecation) for deprecation in deprecations
80 | return
> 81 | @on "task:completed", (args...) => @callback?(args...)
| ^^^^^^^^^^^^^^^^^^^
82 |
83 | @handleEvents()
Example from repos/atom/atom/src/task.coffee:
149 |
150 | @childProcess.removeAllListeners()
> 151 | @childProcess.stdout?.removeAllListeners()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152 | @childProcess.stderr?.removeAllListeners()
153 | @childProcess.kill()
Example from repos/atom/atom/src/task.coffee:
150 | @childProcess.removeAllListeners()
151 | @childProcess.stdout?.removeAllListeners()
> 152 | @childProcess.stderr?.removeAllListeners()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
153 | @childProcess.kill()
154 | @childProcess = null
Example from repos/atom/atom/src/text-editor.coffee:
264 |
265 | if @getApproximateLongestScreenRow() isnt previousLongestRow
> 266 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
267 |
268 | update: (params) ->
Example from repos/atom/atom/src/text-editor.coffee:
336 | else
337 | @decorateCursorLine()
> 338 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
339 |
340 | when 'placeholderText'
Example from repos/atom/atom/src/text-editor.coffee:
359 | if value isnt @showLineNumbers
360 | @showLineNumbers = value
> 361 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
362 |
363 | when 'showInvisibles'
Example from repos/atom/atom/src/text-editor.coffee:
384 | if value isnt @scrollPastEnd
385 | @scrollPastEnd = value
> 386 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
387 |
388 | when 'autoHeight'
Example from repos/atom/atom/src/text-editor.coffee:
397 | if value isnt @showCursorOnSelection
398 | @showCursorOnSelection = value
> 399 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
400 |
401 | else
Example from repos/atom/atom/src/text-editor.coffee:
411 |
412 | scheduleComponentUpdate: ->
> 413 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
414 |
415 | serialize: ->
Example from repos/atom/atom/src/text-editor.coffee:
460 | @disposables.add @displayLayer.onDidChangeSync (e) =>
461 | @mergeIntersectingSelections()
> 462 | @component?.didChangeDisplayLayer(e)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
463 | @emitter.emit 'did-change', e
464 | @disposables.add @displayLayer.onDidReset =>
Example from repos/atom/atom/src/text-editor.coffee:
464 | @disposables.add @displayLayer.onDidReset =>
465 | @mergeIntersectingSelections()
> 466 | @component?.didResetDisplayLayer()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
467 | @emitter.emit 'did-change', {}
468 | @disposables.add @selectionsMarkerLayer.onDidCreateMarker @addSelection.bind(this)
Example from repos/atom/atom/src/text-editor.coffee:
467 | @emitter.emit 'did-change', {}
468 | @disposables.add @selectionsMarkerLayer.onDidCreateMarker @addSelection.bind(this)
> 469 | @disposables.add @selectionsMarkerLayer.onDidUpdate => @component?.didUpdateSelections()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
470 |
471 | destroyed: ->
Example from repos/atom/atom/src/text-editor.coffee:
479 | @emitter.emit 'did-destroy'
480 | @emitter.clear()
> 481 | @component?.element.component = null
| ^^^^^^^^^^^^^^^^^^^
482 | @component = null
483 | @lineNumberGutter.element = null
Example from repos/atom/atom/src/text-editor.coffee:
739 | didAddDecoration: (decoration) ->
740 | if decoration.isType('block')
> 741 | @component?.didAddBlockDecoration(decoration)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
742 |
743 | # Extended: Calls your `callback` when the placeholder text is changed.
Example from repos/atom/atom/src/text-editor.coffee:
1007 | # * `screenRow` A {Number} representing a zero-indexed screen row.
1008 | lineTextForScreenRow: (screenRow) ->
> 1009 | @screenLineForScreenRow(screenRow)?.lineText
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1010 |
1011 | logScreenLines: (start=0, end=@getLastScreenRow()) ->
Example from repos/atom/atom/src/text-editor.coffee:
1179 | selectionsToMove = [selection]
1180 |
> 1181 | while selection.end.row is selections[0]?.start.row
| ^^^^^^^^^^^^^^^^^^^^
1182 | selectionsToMove.push(selections[0])
1183 | selection.end.row = selections[0].end.row
Example from repos/atom/atom/src/text-editor.coffee:
1241 |
1242 | # if the current selection start row matches the next selections' end row - make them one selection
> 1243 | while selection.start.row is selections[0]?.end.row
| ^^^^^^^^^^^^^^^^^^
1244 | selectionsToMove.push(selections[0])
1245 | selection.start.row = selections[0].start.row
Example from repos/atom/atom/src/text-editor.coffee:
1614 | # Returns a {Point}.
1615 | screenPositionForBufferPosition: (bufferPosition, options) ->
> 1616 | if options?.clip?
| ^^^^^^^^^^^^^
1617 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
1618 | options.clipDirection ?= options.clip
Example from repos/atom/atom/src/text-editor.coffee:
1617 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
1618 | options.clipDirection ?= options.clip
> 1619 | if options?.wrapAtSoftNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1620 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1621 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
1620 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1621 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
> 1622 | if options?.wrapBeyondNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1623 | Grim.deprecate("The `wrapBeyondNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1624 | options.clipDirection ?= if options.wrapBeyondNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
1635 | # Returns a {Point}.
1636 | bufferPositionForScreenPosition: (screenPosition, options) ->
> 1637 | if options?.clip?
| ^^^^^^^^^^^^^
1638 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
1639 | options.clipDirection ?= options.clip
Example from repos/atom/atom/src/text-editor.coffee:
1638 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
1639 | options.clipDirection ?= options.clip
> 1640 | if options?.wrapAtSoftNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1641 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1642 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
1641 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1642 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
> 1643 | if options?.wrapBeyondNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1644 | Grim.deprecate("The `wrapBeyondNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1645 | options.clipDirection ?= if options.wrapBeyondNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
1724 | # Returns a {Point}.
1725 | clipScreenPosition: (screenPosition, options) ->
> 1726 | if options?.clip?
| ^^^^^^^^^^^^^
1727 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
1728 | options.clipDirection ?= options.clip
Example from repos/atom/atom/src/text-editor.coffee:
1727 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
1728 | options.clipDirection ?= options.clip
> 1729 | if options?.wrapAtSoftNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1730 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1731 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
1730 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1731 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
> 1732 | if options?.wrapBeyondNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1733 | Grim.deprecate("The `wrapBeyondNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
1734 | options.clipDirection ?= if options.wrapBeyondNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
2090 |
2091 | destroyMarker: (id) ->
> 2092 | @getMarker(id)?.destroy()
| ^^^^^^^^^^^^^^^^^^^^^^^
2093 |
2094 | # Essential: Create a marker layer to group related markers.
Example from repos/atom/atom/src/text-editor.coffee:
2185 | # position. Defaults to true.
2186 | setCursorScreenPosition: (position, options) ->
> 2187 | if options?.clip?
| ^^^^^^^^^^^^^
2188 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
2189 | options.clipDirection ?= options.clip
Example from repos/atom/atom/src/text-editor.coffee:
2188 | Grim.deprecate("The `clip` parameter has been deprecated and will be removed soon. Please, use `clipDirection` instead.")
2189 | options.clipDirection ?= options.clip
> 2190 | if options?.wrapAtSoftNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2191 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
2192 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
2191 | Grim.deprecate("The `wrapAtSoftNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
2192 | options.clipDirection ?= if options.wrapAtSoftNewlines then 'forward' else 'backward'
> 2193 | if options?.wrapBeyondNewlines?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2194 | Grim.deprecate("The `wrapBeyondNewlines` parameter has been deprecated and will be removed soon. Please, use `clipDirection: 'forward'` instead.")
2195 | options.clipDirection ?= if options.wrapBeyondNewlines then 'forward' else 'backward'
Example from repos/atom/atom/src/text-editor.coffee:
2204 | addCursorAtBufferPosition: (bufferPosition, options) ->
2205 | @selectionsMarkerLayer.markBufferPosition(bufferPosition, Object.assign({invalidate: 'never'}, options))
> 2206 | @getLastSelection().cursor.autoscroll() unless options?.autoscroll is false
| ^^^^^^^^^^^^^^^^^^^
2207 | @getLastSelection().cursor
2208 |
Example from repos/atom/atom/src/text-editor.coffee:
2214 | addCursorAtScreenPosition: (screenPosition, options) ->
2215 | @selectionsMarkerLayer.markScreenPosition(screenPosition, {invalidate: 'never'})
> 2216 | @getLastSelection().cursor.autoscroll() unless options?.autoscroll is false
| ^^^^^^^^^^^^^^^^^^^
2217 | @getLastSelection().cursor
2218 |
Example from repos/atom/atom/src/text-editor.coffee:
2528 | lastSelection = @getLastSelection()
2529 | lastSelection.selectToScreenPosition(position, options)
> 2530 | unless options?.suppressSelectionMerge
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2531 | @mergeIntersectingSelections(reversed: lastSelection.isReversed())
2532 |
Example from repos/atom/atom/src/text-editor.coffee:
2799 | options = args.pop() ? {}
2800 |
> 2801 | return fn?() if @suppressSelectionMerging
| ^^^^^
2802 |
2803 | if fn?
Example from repos/atom/atom/src/text-editor.coffee:
2866 | # Called by the selection
2867 | selectionRangeChanged: (event) ->
> 2868 | @component?.didChangeSelectionRange()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2869 | @emitter.emit 'did-change-selection-range', event
2870 |
Example from repos/atom/atom/src/text-editor.coffee:
2985 | usesSoftTabs: ->
2986 | for bufferRow in [0..Math.min(1000, @buffer.getLastRow())]
> 2987 | continue if @tokenizedBuffer.tokenizedLines[bufferRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2988 |
2989 | line = @buffer.lineForRow(bufferRow)
Example from repos/atom/atom/src/text-editor.coffee:
3250 |
3251 | @mutateSelectedText (selection, index) =>
> 3252 | if metadata.selections?.length is @getSelections().length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3253 | {text, indentBasis, fullLine} = metadata.selections[index]
3254 | else
Example from repos/atom/atom/src/text-editor.coffee:
3461 | # * `center` Center the editor around the cursor if possible. (default: true)
3462 | scrollToCursorPosition: (options) ->
> 3463 | @getLastCursor().autoscroll(center: options?.center ? true)
| ^^^^^^^^^^^^^^^
3464 |
3465 | # Essential: Scrolls the editor to the given buffer position.
Example from repos/atom/atom/src/text-editor.coffee:
3494 | screenRange = @clipScreenRange(screenRange) if options.clip isnt false
3495 | scrollEvent = {screenRange, options}
> 3496 | @component?.didRequestAutoscroll(scrollEvent)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3497 | @emitter.emit "did-request-autoscroll", scrollEvent
3498 |
Example from repos/atom/atom/src/text-editor.coffee:
3587 | # Returns a {String} containing the non-word characters.
3588 | getNonWordCharacters: (scopes) ->
> 3589 | @scopedSettingsDelegate?.getNonWordCharacters?(scopes) ? @nonWordCharacters
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3590 |
3591 | getCommentStrings: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3587 | # Returns a {String} containing the non-word characters.
3588 | getNonWordCharacters: (scopes) ->
> 3589 | @scopedSettingsDelegate?.getNonWordCharacters?(scopes) ? @nonWordCharacters
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3590 |
3591 | getCommentStrings: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3590 |
3591 | getCommentStrings: (scopes) ->
> 3592 | @scopedSettingsDelegate?.getCommentStrings?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3593 |
3594 | getIncreaseIndentPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3590 |
3591 | getCommentStrings: (scopes) ->
> 3592 | @scopedSettingsDelegate?.getCommentStrings?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3593 |
3594 | getIncreaseIndentPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3593 |
3594 | getIncreaseIndentPattern: (scopes) ->
> 3595 | @scopedSettingsDelegate?.getIncreaseIndentPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3596 |
3597 | getDecreaseIndentPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3593 |
3594 | getIncreaseIndentPattern: (scopes) ->
> 3595 | @scopedSettingsDelegate?.getIncreaseIndentPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3596 |
3597 | getDecreaseIndentPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3596 |
3597 | getDecreaseIndentPattern: (scopes) ->
> 3598 | @scopedSettingsDelegate?.getDecreaseIndentPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3599 |
3600 | getDecreaseNextIndentPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3596 |
3597 | getDecreaseIndentPattern: (scopes) ->
> 3598 | @scopedSettingsDelegate?.getDecreaseIndentPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3599 |
3600 | getDecreaseNextIndentPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3599 |
3600 | getDecreaseNextIndentPattern: (scopes) ->
> 3601 | @scopedSettingsDelegate?.getDecreaseNextIndentPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3602 |
3603 | getFoldEndPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3599 |
3600 | getDecreaseNextIndentPattern: (scopes) ->
> 3601 | @scopedSettingsDelegate?.getDecreaseNextIndentPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3602 |
3603 | getFoldEndPattern: (scopes) ->
Example from repos/atom/atom/src/text-editor.coffee:
3602 |
3603 | getFoldEndPattern: (scopes) ->
> 3604 | @scopedSettingsDelegate?.getFoldEndPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3605 |
3606 | ###
Example from repos/atom/atom/src/text-editor.coffee:
3602 |
3603 | getFoldEndPattern: (scopes) ->
> 3604 | @scopedSettingsDelegate?.getFoldEndPattern?(scopes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3605 |
3606 | ###
Example from repos/atom/atom/src/theme-manager.coffee:
143 |
144 | unwatchUserStylesheet: ->
> 145 | @userStylsheetSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146 | @userStylsheetSubscriptions = null
147 | @userStylesheetFile = null
Example from repos/atom/atom/src/theme-manager.coffee:
146 | @userStylsheetSubscriptions = null
147 | @userStylesheetFile = null
> 148 | @userStyleSheetDisposable?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149 | @userStyleSheetDisposable = null
150 |
Example from repos/atom/atom/src/theme-manager.coffee:
247 |
248 | removeStylesheet: (stylesheetPath) ->
> 249 | @styleSheetDisposablesBySourcePath[stylesheetPath]?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
250 |
251 | applyStylesheet: (path, text, priority, skipDeprecatedSelectorsTransformation) ->
Example from repos/atom/atom/src/theme-manager.coffee:
306 |
307 | refreshLessCache: ->
> 308 | @lessCache?.setImportPaths(@getImportPaths())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
309 |
310 | getImportPaths: ->
Example from repos/atom/atom/src/tokenized-buffer.coffee:
94 | @rootScopeDescriptor = new ScopeDescriptor(scopes: [@grammar.scopeName])
95 |
> 96 | @grammarUpdateDisposable?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97 | @grammarUpdateDisposable = @grammar.onDidUpdate => @retokenizeLines()
98 | @disposables.add(@grammarUpdateDisposable)
Example from repos/atom/atom/src/tokenized-buffer.coffee:
225 | nextRow = @buffer.nextNonBlankRow(row)
226 | tokenizedLine = @tokenizedLines[row]
> 227 | if @buffer.isRowBlank(row) or tokenizedLine?.isComment() or not nextRow?
| ^^^^^^^^^^^^^^^^^^^^^^^^
228 | false
229 | else
Example from repos/atom/atom/src/tokenized-buffer.coffee:
239 | else
240 | Boolean(
> 241 | not (@tokenizedLines[previousRow]?.isComment()) and
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242 | @tokenizedLines[row]?.isComment() and
243 | @tokenizedLines[nextRow]?.isComment()
Example from repos/atom/atom/src/tokenized-buffer.coffee:
240 | Boolean(
241 | not (@tokenizedLines[previousRow]?.isComment()) and
> 242 | @tokenizedLines[row]?.isComment() and
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243 | @tokenizedLines[nextRow]?.isComment()
244 | )
Example from repos/atom/atom/src/tokenized-buffer.coffee:
241 | not (@tokenizedLines[previousRow]?.isComment()) and
242 | @tokenizedLines[row]?.isComment() and
> 243 | @tokenizedLines[nextRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
244 | )
245 |
Example from repos/atom/atom/src/tokenized-buffer.coffee:
286 |
287 | stackForRow: (bufferRow) ->
> 288 | @tokenizedLines[bufferRow]?.ruleStack
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
289 |
290 | openScopesForRow: (bufferRow) ->
Example from repos/atom/atom/src/tooltip-manager.coffee:
173 |
174 | getKeystroke = (bindings) ->
> 175 | if bindings?.length
| ^^^^^^^^^^^^^^^^
176 | "<span class=\"keystroke\">#{humanizeKeystrokes(bindings[0].keystrokes)}</span>"
177 |
Example from repos/atom/atom/src/view-registry.coffee:
124 | return object
125 |
> 126 | if typeof object?.getElement is 'function'
| ^^^^^^^^^^^^^^^^^^
127 | element = object.getElement()
128 | if element instanceof HTMLElement
Example from repos/atom/atom/src/view-registry.coffee:
129 | return element
130 |
> 131 | if object?.element instanceof HTMLElement
| ^^^^^^^^^^^^^^^
132 | return object.element
133 |
Example from repos/atom/atom/src/view-registry.coffee:
132 | return object.element
133 |
> 134 | if object?.jquery
| ^^^^^^^^^^^^^^
135 | return object[0]
136 |
Example from repos/atom/atom/src/view-registry.coffee:
142 |
143 | if object instanceof provider.modelConstructor
> 144 | if element = provider.createView?(object, @atomEnvironment)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
145 | return element
146 |
Example from repos/atom/atom/src/view-registry.coffee:
147 | if viewConstructor = provider.viewConstructor
148 | element = new viewConstructor
> 149 | element.initialize?(object) ? element.setModel?(object)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
150 | return element
151 |
Example from repos/atom/atom/src/view-registry.coffee:
147 | if viewConstructor = provider.viewConstructor
148 | element = new viewConstructor
> 149 | element.initialize?(object) ? element.setModel?(object)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
150 | return element
151 |
Example from repos/atom/atom/src/view-registry.coffee:
150 | return element
151 |
> 152 | if viewConstructor = object?.getViewClass?()
| ^^^^^^^^^^^^^^^^^^^^^^^
153 | view = new viewConstructor(object)
154 | return view[0]
Example from repos/atom/atom/src/view-registry.coffee:
150 | return element
151 |
> 152 | if viewConstructor = object?.getViewClass?()
| ^^^^^^^^^^^^^^^^^^^^
153 | view = new viewConstructor(object)
154 | return view[0]
Example from repos/atom/atom/src/view-registry.coffee:
199 | writer() while writer = @documentWriters.shift()
200 |
> 201 | resolveNextUpdatePromise?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
202 |
Example from repos/atom/atom/src/window-event-handler.coffee:
177 | handleLinkClick: (event) =>
178 | event.preventDefault()
> 179 | uri = event.currentTarget?.getAttribute('href')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180 | if uri and uri[0] isnt '#' and /^https?:\/\//.test(uri)
181 | @applicationDelegate.openExternal(uri)
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
88 | .addCommand "waitForPaneItemCount", (count, timeout, cb) ->
89 | @waitUntil(->
> 90 | @execute(-> atom.workspace?.getActivePane()?.getItems().length)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91 | .then(({value}) -> value is count)
92 | , timeout)
Example from repos/atom/atom/spec/squirrel-update-spec.coffee:
80 | jasmine.unspy(Spawner, 'spawn')
81 | spyOn(Spawner, 'spawn').andCallFake (command, args, callback) ->
> 82 | if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut' and args?[3].match /Desktop/i
| ^^^^^^^^
83 | fs.writeFileSync(desktopShortcutPath, '')
84 | else
Example from repos/atom/atom/src/atom-environment.coffee:
1071 |
1072 | openLocations: (locations) ->
> 1073 | needsProjectPaths = @project?.getPaths().length is 0
| ^^^^^^^^^^^^^^^^^^
1074 |
1075 | foldersToAddToProject = []
Example from repos/atom/atom/src/git-repository-provider.coffee:
11 | try
12 | gitFileBuff = fs.readFileSync(gitFile, 'utf8')
> 13 | return gitFileBuff?.match(gitFileRegex)[1]
| ^^^^^^^^^^^^^^^^^^
14 |
15 | # Checks whether a valid `.git` directory is contained within the given
Example from repos/atom/atom/src/git-repository.coffee:
472 | @handlerPath ?= require.resolve('./repository-status-handler')
473 |
> 474 | relativeProjectPaths = @project?.getPaths()
| ^^^^^^^^^^^^^^^^^^
475 | .map (projectPath) => @relativize(projectPath)
476 | .filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath)
Example from repos/atom/atom/src/language-mode.coffee:
53 | else
54 | buffer.transact ->
> 55 | indentLength = buffer.lineForRow(start).match(/^\s*/)?[0].length ? 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 | buffer.insert([start, indentLength], commentStartString)
57 | buffer.insert([end, buffer.lineLengthForRow(end)], commentEndString)
Example from repos/atom/atom/src/language-mode.coffee:
85 | for row in [start..end] by 1
86 | line = buffer.lineForRow(row)
> 87 | if indentLength = line.match(indentRegex)?[0].length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 | buffer.insert([row, indentLength], commentStartString)
89 | else
Example from repos/atom/atom/src/main-process/atom-application.coffee:
234 | @on 'application:inspect', ({x, y, atomWindow}) ->
235 | atomWindow ?= @focusedWindow()
> 236 | atomWindow?.browserWindow.inspectElement(x, y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
237 |
238 | @on 'application:open-documentation', -> shell.openExternal('http://flight-manual.atom.io/')
Example from repos/atom/atom/src/main-process/spawner.coffee:
29 | spawnedProcess.on 'close', (code, signal) ->
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
> 31 | error?.code ?= code
| ^^^^^^^^^^^
32 | error?.stdout ?= stdout
33 | callback?(error, stdout)
Example from repos/atom/atom/src/main-process/spawner.coffee:
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
31 | error?.code ?= code
> 32 | error?.stdout ?= stdout
| ^^^^^^^^^^^^^
33 | callback?(error, stdout)
34 | # This is necessary if using Powershell 2 on Windows 7 to get the events to raise
Example from repos/atom/atom/src/pane-axis-element.coffee:
32 |
33 | isPaneResizeHandleElement: (element) ->
> 34 | element?.nodeName.toLowerCase() is 'atom-pane-resize-handle'
| ^^^^^^^^^^^^^^^^^
35 |
36 | childAdded: ({child, index}) ->
Example from repos/atom/atom/src/pane-resize-handle-element.coffee:
18 | resizeToFitContent: ->
19 | # clear flex-grow css style of both pane
> 20 | @previousSibling?.model.setFlexScale(1)
| ^^^^^^^^^^^^^^^^^^^^^^^
21 | @nextSibling?.model.setFlexScale(1)
22 |
Example from repos/atom/atom/src/pane-resize-handle-element.coffee:
19 | # clear flex-grow css style of both pane
20 | @previousSibling?.model.setFlexScale(1)
> 21 | @nextSibling?.model.setFlexScale(1)
| ^^^^^^^^^^^^^^^^^^^
22 |
23 | resizeStarted: (e) ->
Example from repos/atom/atom/src/selection.coffee:
554 | leadingTabRegex = new RegExp("^( {1,#{@editor.getTabLength()}}|\t)")
555 | for row in [start..end]
> 556 | if matchLength = buffer.lineForRow(row).match(leadingTabRegex)?[0].length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
557 | buffer.delete [[row, 0], [row, matchLength]]
558 | return
Example from repos/atom/atom/src/text-editor.coffee:
479 | @emitter.emit 'did-destroy'
480 | @emitter.clear()
> 481 | @component?.element.component = null
| ^^^^^^^^^^^^^^^^^^^
482 | @component = null
483 | @lineNumberGutter.element = null
Example from repos/atom/atom/src/text-editor.coffee:
1179 | selectionsToMove = [selection]
1180 |
> 1181 | while selection.end.row is selections[0]?.start.row
| ^^^^^^^^^^^^^^^^^^^^
1182 | selectionsToMove.push(selections[0])
1183 | selection.end.row = selections[0].end.row
Example from repos/atom/atom/src/text-editor.coffee:
1241 |
1242 | # if the current selection start row matches the next selections' end row - make them one selection
> 1243 | while selection.start.row is selections[0]?.end.row
| ^^^^^^^^^^^^^^^^^^
1244 | selectionsToMove.push(selections[0])
1245 | selection.start.row = selections[0].start.row
Example from repos/atom/atom/spec/atom-environment-spec.coffee:
637 |
638 | afterEach ->
> 639 | subscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^
640 |
641 | it "invokes onUpdateAvailable listeners", ->
Example from repos/atom/atom/spec/atom-reporter.coffee:
18 |
19 | # Remove first line of stack when it is the same as the error message
> 20 | errorMatch = lines[0]?.match(/^Error: (.*)/)
| ^^^^^^^^^^^^^^^
21 | lines.shift() if message.trim() is errorMatch?[1]?.trim()
22 |
Example from repos/atom/atom/spec/atom-reporter.coffee:
19 | # Remove first line of stack when it is the same as the error message
20 | errorMatch = lines[0]?.match(/^Error: (.*)/)
> 21 | lines.shift() if message.trim() is errorMatch?[1]?.trim()
| ^^^^^^^^^^^^^^^^^^^^
22 |
23 | for line, index in lines
Example from repos/atom/atom/spec/git-repository-spec.coffee:
340 |
341 | afterEach ->
> 342 | project2?.destroy()
| ^^^^^^^^^^^^^^^^^
343 |
344 | it "subscribes to all the serialized buffers in the project", ->
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
88 | .addCommand "waitForPaneItemCount", (count, timeout, cb) ->
89 | @waitUntil(->
> 90 | @execute(-> atom.workspace?.getActivePane()?.getItems().length)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91 | .then(({value}) -> value is count)
92 | , timeout)
Example from repos/atom/atom/spec/integration/helpers/start-atom.coffee:
88 | .addCommand "waitForPaneItemCount", (count, timeout, cb) ->
89 | @waitUntil(->
> 90 | @execute(-> atom.workspace?.getActivePane()?.getItems().length)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91 | .then(({value}) -> value is count)
92 | , timeout)
Example from repos/atom/atom/spec/package-manager-spec.coffee:
504 |
505 | afterEach ->
> 506 | registration?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^
507 | mainModule = null
508 |
Example from repos/atom/atom/spec/package-spec.coffee:
40 | expect(pack.isCompatible()).toBe true
41 |
> 42 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-cached-incompatible-native-module')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43 | pack = buildPackage(packagePath)
44 | expect(pack.isCompatible()).toBe false
Example from repos/atom/atom/spec/package-spec.coffee:
75 |
76 | it "returns a promise resolving to the results of `apm rebuild`", ->
> 77 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-index')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78 | pack = buildPackage(packagePath)
79 | rebuildCallbacks = []
Example from repos/atom/atom/spec/package-spec.coffee:
89 |
90 | it "persists build failures in local storage", ->
> 91 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-index')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92 | pack = buildPackage(packagePath)
93 |
Example from repos/atom/atom/spec/package-spec.coffee:
118 |
119 | it "sets cached incompatible modules to an empty array when the rebuild completes (there may be a build error, but rebuilding *deletes* native modules)", ->
> 120 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-incompatible-native-module')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121 | pack = buildPackage(packagePath)
122 |
Example from repos/atom/atom/spec/package-spec.coffee:
144 | it "loads and applies css", ->
145 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe "1234px"
> 146 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-index-css')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 | theme = buildThemePackage(themePath)
148 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
151 | it "parses, loads and applies less", ->
152 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe "1234px"
> 153 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-index-less')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154 | theme = buildThemePackage(themePath)
155 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
162 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe("103px")
163 |
> 164 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165 | theme = buildThemePackage(themePath)
166 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
175 | expect(getComputedStyle(editorElement).paddingBottom).not.toBe "30px"
176 |
> 177 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-without-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178 | theme = buildThemePackage(themePath)
179 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
184 | describe "reloading a theme", ->
185 | beforeEach ->
> 186 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
187 | theme = buildThemePackage(themePath)
188 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
195 | describe "events", ->
196 | beforeEach ->
> 197 | themePath = atom.project.getDirectories()[0]?.resolve('packages/theme-with-package-file')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198 | theme = buildThemePackage(themePath)
199 | theme.activate()
Example from repos/atom/atom/spec/package-spec.coffee:
208 |
209 | beforeEach ->
> 210 | packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-different-directory-name')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211 | metadata = atom.packages.loadPackageMetadata(packagePath, true)
212 |
Example from repos/atom/atom/spec/project-spec.coffee:
9 | describe "Project", ->
10 | beforeEach ->
> 11 | atom.project.setPaths([atom.project.getDirectories()[0]?.resolve('dir')])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | # Wait for project's service consumers to be asynchronously added
Example from repos/atom/atom/spec/project-spec.coffee:
21 |
22 | afterEach ->
> 23 | deserializedProject?.destroy()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 |
25 | it "does not deserialize paths to non directories", ->
Example from repos/atom/atom/spec/project-spec.coffee:
110 | notQuittingProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm})
111 | notQuittingProject.deserialize(atom.project.serialize({isUnloading: false})).then ->
> 112 | expect(notQuittingProject.getBuffers()[0].getMarkerLayer(layerA.id)?.getMarker(markerA.id)).toBeUndefined()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113 | expect(notQuittingProject.getBuffers()[0].undo()).toBe(false)
114 |
Example from repos/atom/atom/spec/project-spec.coffee:
116 | quittingProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm})
117 | quittingProject.deserialize(atom.project.serialize({isUnloading: true})).then ->
> 118 | expect(quittingProject.getBuffers()[0].getMarkerLayer(layerA.id)?.getMarker(markerA.id)).not.toBeUndefined()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119 | expect(quittingProject.getBuffers()[0].undo()).toBe(true)
120 |
Example from repos/atom/atom/spec/squirrel-update-spec.coffee:
80 | jasmine.unspy(Spawner, 'spawn')
81 | spyOn(Spawner, 'spawn').andCallFake (command, args, callback) ->
> 82 | if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut' and args?[3].match /Desktop/i
| ^^^^^^^^
83 | fs.writeFileSync(desktopShortcutPath, '')
84 | else
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
164 | atom.styles.onDidAddStyleElement styleElementAddedHandler = jasmine.createSpy("styleElementAddedHandler")
165 |
> 166 | cssPath = atom.project.getDirectories()[0]?.resolve('css.css')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167 | lengthBefore = document.querySelectorAll('head style').length
168 |
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
186 |
187 | it "synchronously loads and parses less files at the given path and installs a style tag for it in the head", ->
> 188 | lessPath = atom.project.getDirectories()[0]?.resolve('sample.less')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189 | lengthBefore = document.querySelectorAll('head style').length
190 | atom.themes.requireStylesheet(lessPath)
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
211 | it "supports requiring css and less stylesheets without an explicit extension", ->
212 | atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'css')
> 213 | expect(document.querySelector('head style[source-path*="css.css"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('css.css')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
214 | atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'sample')
215 | expect(document.querySelector('head style[source-path*="sample.less"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('sample.less')
Example from repos/atom/atom/spec/theme-manager-spec.coffee:
213 | expect(document.querySelector('head style[source-path*="css.css"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('css.css')
214 | atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'sample')
> 215 | expect(document.querySelector('head style[source-path*="sample.less"]').getAttribute('source-path')).toEqualPath atom.project.getDirectories()[0]?.resolve('sample.less')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
216 |
217 | document.querySelector('head style[source-path*="css.css"]').remove()
Example from repos/atom/atom/spec/tokenized-buffer-spec.coffee:
16 |
17 | afterEach ->
> 18 | tokenizedBuffer?.destroy()
| ^^^^^^^^^^^^^^^^^^^^^^^^
19 |
20 | startTokenizing = (tokenizedBuffer) ->
Example from repos/atom/atom/src/atom-environment.coffee:
348 |
349 | @disposables.dispose()
> 350 | @workspace?.destroy()
| ^^^^^^^^^^^^^^^^^^^
351 | @workspace = null
352 | @themes.workspace = null
Example from repos/atom/atom/src/atom-environment.coffee:
351 | @workspace = null
352 | @themes.workspace = null
> 353 | @project?.destroy()
| ^^^^^^^^^^^^^^^^^
354 | @project = null
355 | @commands.clear()
Example from repos/atom/atom/src/atom-environment.coffee:
699 | .catch(console.error)
700 | .then =>
> 701 | @workspace?.confirmClose({
| ^^^^^^^^^^^^^^^^^^^^^^^^
702 | windowCloseRequested: true,
703 | projectHasPaths: @project.getPaths().length > 0
Example from repos/atom/atom/src/atom-environment.coffee:
724 |
725 | @document.body.appendChild(@workspace.getElement())
> 726 | @backgroundStylesheet?.remove()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
727 |
728 | @watchProjectPaths()
Example from repos/atom/atom/src/atom-environment.coffee:
803 |
804 | uninstallWindowEventHandler: ->
> 805 | @windowEventHandler?.unsubscribe()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
806 | @windowEventHandler = null
807 |
Example from repos/atom/atom/src/atom-environment.coffee:
969 | state = @serialize(options)
970 | savePromise =
> 971 | if storageKey ?= @getStateKey(@project?.getPaths())
| ^^^^^^^^^^^^^^^^^^
972 | @stateStore.save(storageKey, state)
973 | else
Example from repos/atom/atom/src/atom-environment.coffee:
1071 |
1072 | openLocations: (locations) ->
> 1073 | needsProjectPaths = @project?.getPaths().length is 0
| ^^^^^^^^^^^^^^^^^^
1074 |
1075 | foldersToAddToProject = []
Example from repos/atom/atom/src/atom-environment.coffee:
1102 | @project.addPath(folder) for folder in foldersToAddToProject
1103 | for {pathToOpen, initialLine, initialColumn} in fileLocationsToOpen
> 1104 | promises.push @workspace?.open(pathToOpen, {initialLine, initialColumn})
| ^^^^^^^^^^^^^^^^
1105 | Promise.all(promises)
1106 | else
Example from repos/atom/atom/src/atom-environment.coffee:
1107 | promises = []
1108 | for {pathToOpen, initialLine, initialColumn} in fileLocationsToOpen
> 1109 | promises.push @workspace?.open(pathToOpen, {initialLine, initialColumn})
| ^^^^^^^^^^^^^^^^
1110 | promise = Promise.all(promises)
1111 |
Example from repos/atom/atom/src/command-registry.coffee:
239 |
240 | loop
> 241 | listeners = @inlineListenersByCommandName[event.type]?.get(currentTarget) ? []
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242 | if currentTarget.webkitMatchesSelector?
243 | selectorBasedListeners =
Example from repos/atom/atom/src/config.coffee:
892 |
893 | unobserveUserConfig: ->
> 894 | @watchSubscription?.close()
| ^^^^^^^^^^^^^^^^^^^^^^^^^
895 | @watchSubscription = null
896 |
Example from repos/atom/atom/src/config.coffee:
896 |
897 | notifyFailure: (errorMessage, detail) ->
> 898 | @notificationManager?.addError(errorMessage, {detail, dismissable: true})
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
899 |
900 | save: ->
Example from repos/atom/atom/src/config.coffee:
937 |
938 | getRawValue: (keyPath, options) ->
> 939 | unless options?.excludeSources?.indexOf(@getUserConfigPath()) >= 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
940 | value = getValueAtKeyPath(@settings, keyPath)
941 | unless options?.sources?.length > 0
Example from repos/atom/atom/src/cursor.coffee:
409 | beginningOfWordPosition = range.start
410 |
> 411 | if not beginningOfWordPosition?.isEqual(currentBufferPosition)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
412 | stop()
413 |
Example from repos/atom/atom/src/cursor.coffee:
434 | endOfWordPosition = range.end
435 |
> 436 | if not endOfWordPosition?.isEqual(currentBufferPosition)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
437 | stop()
438 |
Example from repos/atom/atom/src/cursor.coffee:
572 | # Public: Deselects the current selection.
573 | clearSelection: (options) ->
> 574 | @selection?.clear(options)
| ^^^^^^^^^^^^^^^^^
575 |
576 | # Public: Get the RegExp used by the cursor to determine what a "word" is.
Example from repos/atom/atom/src/git-repository-provider.coffee:
11 | try
12 | gitFileBuff = fs.readFileSync(gitFile, 'utf8')
> 13 | return gitFileBuff?.match(gitFileRegex)[1]
| ^^^^^^^^^^^^^^^^^^
14 |
15 | # Checks whether a valid `.git` directory is contained within the given
Example from repos/atom/atom/src/git-repository.coffee:
181 | # repository.
182 | isProjectAtRoot: ->
> 183 | @projectAtRoot ?= @project?.relativize(@getWorkingDirectory()) is ''
| ^^^^^^^^^^^^^^^^^^^^
184 |
185 | # Public: Makes a path relative to the repository's working directory.
Example from repos/atom/atom/src/git-repository.coffee:
472 | @handlerPath ?= require.resolve('./repository-status-handler')
473 |
> 474 | relativeProjectPaths = @project?.getPaths()
| ^^^^^^^^^^^^^^^^^^
475 | .map (projectPath) => @relativize(projectPath)
476 | .filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath)
Example from repos/atom/atom/src/git-repository.coffee:
476 | .filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath)
477 |
> 478 | @statusTask?.terminate()
| ^^^^^^^^^^^^^^^^^^^^^^
479 | new Promise (resolve) =>
480 | @statusTask = Task.once @handlerPath, @getPath(), relativeProjectPaths, ({statuses, upstream, branch, submodules}) =>
Example from repos/atom/atom/src/language-mode.coffee:
53 | else
54 | buffer.transact ->
> 55 | indentLength = buffer.lineForRow(start).match(/^\s*/)?[0].length ? 0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 | buffer.insert([start, indentLength], commentStartString)
57 | buffer.insert([end, buffer.lineLengthForRow(end)], commentEndString)
Example from repos/atom/atom/src/language-mode.coffee:
62 | for row in [start..end] by 1
63 | line = buffer.lineForRow(row)
> 64 | blank = line?.match(/^\s*$/)
| ^^^^^^^^^^^
65 |
66 | allBlank = false unless blank
Example from repos/atom/atom/src/language-mode.coffee:
85 | for row in [start..end] by 1
86 | line = buffer.lineForRow(row)
> 87 | if indentLength = line.match(indentRegex)?[0].length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 | buffer.insert([row, indentLength], commentStartString)
89 | else
Example from repos/atom/atom/src/language-mode.coffee:
149 |
150 | rowRangeForCommentAtBufferRow: (bufferRow) ->
> 151 | return unless @editor.tokenizedBuffer.tokenizedLines[bufferRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152 |
153 | startRow = bufferRow
Example from repos/atom/atom/src/language-mode.coffee:
156 | if bufferRow > 0
157 | for currentRow in [bufferRow-1..0] by -1
> 158 | break unless @editor.tokenizedBuffer.tokenizedLines[currentRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159 | startRow = currentRow
160 |
Example from repos/atom/atom/src/language-mode.coffee:
161 | if bufferRow < @buffer.getLastRow()
162 | for currentRow in [[email protected]()] by 1
> 163 | break unless @editor.tokenizedBuffer.tokenizedLines[currentRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164 | endRow = currentRow
165 |
Example from repos/atom/atom/src/language-mode.coffee:
175 | indentation = @editor.indentationForBufferRow(row)
176 | if indentation <= startIndentLevel
> 177 | includeRowInFold = indentation is startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178 | foldEndRow = row if includeRowInFold
179 | break
Example from repos/atom/atom/src/language-mode.coffee:
190 | isLineCommentedAtBufferRow: (bufferRow) ->
191 | return false unless 0 <= bufferRow <= @editor.getLastBufferRow()
> 192 | @editor.tokenizedBuffer.tokenizedLines[bufferRow]?.isComment() ? false
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 |
194 | # Find a row range for a 'paragraph' around specified bufferRow. A paragraph
Example from repos/atom/atom/src/language-mode.coffee:
271 | unless @editor.isBufferRowCommented(precedingRow)
272 | precedingLine = @buffer.lineForRow(precedingRow)
> 273 | desiredIndentLevel += 1 if increaseIndentRegex?.testSync(precedingLine)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274 | desiredIndentLevel -= 1 if decreaseNextIndentRegex?.testSync(precedingLine)
275 |
Example from repos/atom/atom/src/language-mode.coffee:
272 | precedingLine = @buffer.lineForRow(precedingRow)
273 | desiredIndentLevel += 1 if increaseIndentRegex?.testSync(precedingLine)
> 274 | desiredIndentLevel -= 1 if decreaseNextIndentRegex?.testSync(precedingLine)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
275 |
276 | unless @buffer.isRowBlank(precedingRow)
Example from repos/atom/atom/src/language-mode.coffee:
275 |
276 | unless @buffer.isRowBlank(precedingRow)
> 277 | desiredIndentLevel -= 1 if decreaseIndentRegex?.testSync(line)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278 |
279 | Math.max(desiredIndentLevel, 0)
Example from repos/atom/atom/src/layer-decoration.coffee:
62 |
63 | getPropertiesForMarker: (marker) ->
> 64 | @overridePropertiesByMarker?.get(marker)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65 |
Example from repos/atom/atom/src/main-process/application-menu.coffee:
120 | submenu: [
121 | {label: "Check for Update", metadata: {autoUpdate: true}}
> 122 | {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
| ^^^^^^^^^^^^^^^^^^^^^^^^
123 | {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
124 | {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
Example from repos/atom/atom/src/main-process/application-menu.coffee:
121 | {label: "Check for Update", metadata: {autoUpdate: true}}
122 | {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
> 123 | {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
| ^^^^^^^^^^^^^^^^^^^^^^^
124 | {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
125 | {label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()}
Example from repos/atom/atom/src/main-process/application-menu.coffee:
122 | {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()}
123 | {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()}
> 124 | {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125 | {label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()}
126 | ]
Example from repos/atom/atom/src/main-process/atom-application.coffee:
165 | @windows.splice(@windows.indexOf(window), 1)
166 | if @windows.length is 0
> 167 | @applicationMenu?.enableWindowSpecificItems(false)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168 | if process.platform in ['win32', 'linux']
169 | app.quit()
Example from repos/atom/atom/src/main-process/atom-application.coffee:
174 | addWindow: (window) ->
175 | @windows.push window
> 176 | @applicationMenu?.addWindow(window.browserWindow)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
177 | window.once 'window:loaded', =>
178 | @autoUpdateManager?.emitUpdateAvailableEvent(window)
Example from repos/atom/atom/src/main-process/atom-application.coffee:
176 | @applicationMenu?.addWindow(window.browserWindow)
177 | window.once 'window:loaded', =>
> 178 | @autoUpdateManager?.emitUpdateAvailableEvent(window)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
179 |
180 | unless window.isSpec
Example from repos/atom/atom/src/main-process/atom-application.coffee:
234 | @on 'application:inspect', ({x, y, atomWindow}) ->
235 | atomWindow ?= @focusedWindow()
> 236 | atomWindow?.browserWindow.inspectElement(x, y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
237 |
238 | @on 'application:open-documentation', -> shell.openExternal('http://flight-manual.atom.io/')
Example from repos/atom/atom/src/main-process/atom-application.coffee:
257 | @on 'application:zoom', -> Menu.sendActionToFirstResponder('zoom:')
258 | else
> 259 | @on 'application:minimize', -> @focusedWindow()?.minimize()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
260 | @on 'application:zoom', -> @focusedWindow()?.maximize()
261 |
Example from repos/atom/atom/src/main-process/atom-application.coffee:
258 | else
259 | @on 'application:minimize', -> @focusedWindow()?.minimize()
> 260 | @on 'application:zoom', -> @focusedWindow()?.maximize()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
261 |
262 | @openPathOnEvent('application:about', 'atom://about')
Example from repos/atom/atom/src/main-process/atom-application.coffee:
289 | @disposable.add ipcHelpers.on app, 'activate', (event, hasVisibleWindows) =>
290 | unless hasVisibleWindows
> 291 | event?.preventDefault()
| ^^^^^^^^^^^^^^^^^^^^^
292 | @emit('application:new-window')
293 |
Example from repos/atom/atom/src/main-process/atom-application.coffee:
322 | @disposable.add ipcHelpers.on ipcMain, 'update-application-menu', (event, template, keystrokesByCommand) =>
323 | win = BrowserWindow.fromWebContents(event.sender)
> 324 | @applicationMenu?.update(win, template, keystrokesByCommand)
| ^^^^^^^^^^^^^^^^^^^^^^^^
325 |
326 | @disposable.add ipcHelpers.on ipcMain, 'run-package-specs', (event, packageSpecPath) =>
Example from repos/atom/atom/src/main-process/atom-application.coffee:
346 |
347 | @disposable.add ipcHelpers.respondTo 'window-method', (browserWindow, method, args...) =>
> 348 | @atomWindowForBrowserWindow(browserWindow)?[method](args...)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
349 |
350 | @disposable.add ipcHelpers.on ipcMain, 'pick-folder', (event, responseChannel) =>
Example from repos/atom/atom/src/main-process/atom-application.coffee:
390 |
391 | @disposable.add ipcHelpers.on ipcMain, 'execute-javascript-in-dev-tools', (event, code) ->
> 392 | event.sender.devToolsWebContents?.executeJavaScript(code)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
393 |
394 | @disposable.add ipcHelpers.on ipcMain, 'get-auto-update-manager-state', (event) =>
Example from repos/atom/atom/src/main-process/atom-application.coffee:
499 | # the platform.
500 | getDimensionsForNewWindow: ->
> 501 | return if (@focusedWindow() ? @lastFocusedWindow)?.isMaximized()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
502 | dimensions = (@focusedWindow() ? @lastFocusedWindow)?.getDimensions()
503 | offset = @getWindowOffsetForCurrentPlatform()
Example from repos/atom/atom/src/main-process/atom-application.coffee:
500 | getDimensionsForNewWindow: ->
501 | return if (@focusedWindow() ? @lastFocusedWindow)?.isMaximized()
> 502 | dimensions = (@focusedWindow() ? @lastFocusedWindow)?.getDimensions()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
503 | offset = @getWindowOffsetForCurrentPlatform()
504 | if dimensions? and offset?
Example from repos/atom/atom/src/main-process/atom-window.coffee:
65 | for {pathToOpen} in locationsToOpen when pathToOpen
66 | stat = fs.statSyncNoException(pathToOpen) or null
> 67 | if stat?.isDirectory()
| ^^^^^^^^^^^^^^^^^
68 | pathToOpen
69 | else
Example from repos/atom/atom/src/main-process/atom-window.coffee:
69 | else
70 | parentDirectory = path.dirname(pathToOpen)
> 71 | if stat?.isFile() or fs.existsSync(parentDirectory)
| ^^^^^^^^^^^^
72 | parentDirectory
73 | else
Example from repos/atom/atom/src/main-process/spawner.coffee:
29 | spawnedProcess.on 'close', (code, signal) ->
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
> 31 | error?.code ?= code
| ^^^^^^^^^^^
32 | error?.stdout ?= stdout
33 | callback?(error, stdout)
Example from repos/atom/atom/src/main-process/spawner.coffee:
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
31 | error?.code ?= code
> 32 | error?.stdout ?= stdout
| ^^^^^^^^^^^^^
33 | callback?(error, stdout)
34 | # This is necessary if using Powershell 2 on Windows 7 to get the events to raise
Example from repos/atom/atom/src/module-cache.coffee:
51 | for childPath in fs.listSync(path.join(modulePath, 'node_modules'))
52 | continue if path.basename(childPath) is '.bin'
> 53 | continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | childMetadataPath = path.join(childPath, 'package.json')
Example from repos/atom/atom/src/module-cache.coffee:
104 | for childPath in fs.listSync(path.join(modulePath, 'node_modules'))
105 | continue if path.basename(childPath) is '.bin'
> 106 | continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107 |
108 | loadFolderCompatibility(childPath, rootPath, rootMetadata, moduleCache)
Example from repos/atom/atom/src/module-cache.coffee:
136 | if parentPath is nodeModulesPath
137 | packageName = path.basename(childPath)
> 138 | return false if rootMetadata.packageDependencies?.hasOwnProperty(packageName)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139 |
140 | true
Example from repos/atom/atom/src/module-cache.coffee:
160 | extension = path.extname(resolvedPath)
161 | if extension
> 162 | return resolvedPath if cache.extensions[extension]?.has(resolvedPath)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163 | else
164 | for extension, paths of cache.extensions
Example from repos/atom/atom/src/package-manager.coffee:
205 | enablePackage: (name) ->
206 | pack = @loadPackage(name)
> 207 | pack?.enable()
| ^^^^^^^^^^^^
208 | pack
209 |
Example from repos/atom/atom/src/package-manager.coffee:
217 |
218 | unless @isPackageDisabled(name)
> 219 | pack?.disable()
| ^^^^^^^^^^^^^
220 |
221 | pack
Example from repos/atom/atom/src/package-manager.coffee:
354 |
355 | unobserveDisabledPackages: ->
> 356 | @disabledPackagesSubscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
357 | @disabledPackagesSubscription = null
358 |
Example from repos/atom/atom/src/package-manager.coffee:
367 |
368 | unobservePackagesWithKeymapsDisabled: ->
> 369 | @packagesWithKeymapsDisabledSubscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
370 | @packagesWithKeymapsDisabledSubscription = null
371 |
Example from repos/atom/atom/src/package-manager.coffee:
377 | disabledPackageNames = new Set(@config.get('core.disabledPackages'))
378 | for packageName in keymapsToDisable when not disabledPackageNames.has(packageName)
> 379 | @getLoadedPackage(packageName)?.deactivateKeymaps()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
380 | for packageName in keymapsToEnable when not disabledPackageNames.has(packageName)
381 | @getLoadedPackage(packageName)?.activateKeymaps()
Example from repos/atom/atom/src/package-manager.coffee:
379 | @getLoadedPackage(packageName)?.deactivateKeymaps()
380 | for packageName in keymapsToEnable when not disabledPackageNames.has(packageName)
> 381 | @getLoadedPackage(packageName)?.activateKeymaps()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
382 | null
383 |
Example from repos/atom/atom/src/package-manager.coffee:
437 | preloadedPackage = @preloadedPackages[availablePackage.name]
438 |
> 439 | if disabledPackageNames?.has(availablePackage.name)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
440 | if preloadedPackage?
441 | preloadedPackage.deactivate()
Example from repos/atom/atom/src/package-manager.coffee:
614 |
615 | @resourcePathWithTrailingSlash ?= "#{@resourcePath}#{path.sep}"
> 616 | packagePath?.startsWith(@resourcePathWithTrailingSlash)
| ^^^^^^^^^^^^^^^^^^^^^^^
617 |
618 | loadPackageMetadata: (packagePathOrAvailablePackage, ignoreErrors=false) ->
Example from repos/atom/atom/src/package.coffee:
189 | @mainActivated = true
190 | @activateServices()
> 191 | @activationCommandSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 | @activationHookSubscriptions?.dispose()
193 | catch error
Example from repos/atom/atom/src/package.coffee:
190 | @activateServices()
191 | @activationCommandSubscriptions?.dispose()
> 192 | @activationHookSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 | catch error
194 | @handleError("Failed to activate the #{@name} package", error)
Example from repos/atom/atom/src/package.coffee:
277 | return if not @keymapActivated
278 |
> 279 | @keymapDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
280 | @menuManager.update()
281 |
Example from repos/atom/atom/src/package.coffee:
502 | @activationPromise = null
503 | @resolveActivationPromise = null
> 504 | @activationCommandSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
505 | @activationHookSubscriptions?.dispose()
506 | @configSchemaRegisteredOnActivate = false
Example from repos/atom/atom/src/package.coffee:
503 | @resolveActivationPromise = null
504 | @activationCommandSubscriptions?.dispose()
> 505 | @activationHookSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
506 | @configSchemaRegisteredOnActivate = false
507 | @deactivateResources()
Example from repos/atom/atom/src/package.coffee:
520 | grammar.deactivate() for grammar in @grammars
521 | settings.deactivate() for settings in @settings
> 522 | @stylesheetDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
523 | @activationDisposables?.dispose()
524 | @keymapDisposables?.dispose()
Example from repos/atom/atom/src/package.coffee:
521 | settings.deactivate() for settings in @settings
522 | @stylesheetDisposables?.dispose()
> 523 | @activationDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
524 | @keymapDisposables?.dispose()
525 | @stylesheetsActivated = false
Example from repos/atom/atom/src/package.coffee:
522 | @stylesheetDisposables?.dispose()
523 | @activationDisposables?.dispose()
> 524 | @keymapDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
525 | @stylesheetsActivated = false
526 | @grammarsActivated = false
Example from repos/atom/atom/src/package.coffee:
534 | @handleError("Failed to reload the #{@name} package stylesheets", error)
535 |
> 536 | @stylesheetDisposables?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
537 | @stylesheetDisposables = new CompositeDisposable
538 | @stylesheetsActivated = false
Example from repos/atom/atom/src/pane-axis-element.coffee:
32 |
33 | isPaneResizeHandleElement: (element) ->
> 34 | element?.nodeName.toLowerCase() is 'atom-pane-resize-handle'
| ^^^^^^^^^^^^^^^^^
35 |
36 | childAdded: ({child, index}) ->
Example from repos/atom/atom/src/pane-axis-element.coffee:
62 | @childRemoved({child: oldChild, index})
63 | @childAdded({child: newChild, index})
> 64 | focusedElement?.focus() if document.activeElement is document.body
| ^^^^^^^^^^^^^^^^^^^^^
65 |
66 | flexScaleChanged: (flexScale) -> @style.flexGrow = flexScale
Example from repos/atom/atom/src/pane-container-element.coffee:
16 | rootChanged: (root) ->
17 | focusedElement = document.activeElement if @hasFocus()
> 18 | @firstChild?.remove()
| ^^^^^^^^^^^^^^^^^^^
19 | if root?
20 | view = @views.getView(root)
Example from repos/atom/atom/src/pane-container-element.coffee:
20 | view = @views.getView(root)
21 | @appendChild(view)
> 22 | focusedElement?.focus()
| ^^^^^^^^^^^^^^^^^^^^^
23 |
24 | hasFocus: ->
Example from repos/atom/atom/src/pane-resize-handle-element.coffee:
18 | resizeToFitContent: ->
19 | # clear flex-grow css style of both pane
> 20 | @previousSibling?.model.setFlexScale(1)
| ^^^^^^^^^^^^^^^^^^^^^^^
21 | @nextSibling?.model.setFlexScale(1)
22 |
Example from repos/atom/atom/src/pane-resize-handle-element.coffee:
19 | # clear flex-grow css style of both pane
20 | @previousSibling?.model.setFlexScale(1)
> 21 | @nextSibling?.model.setFlexScale(1)
| ^^^^^^^^^^^^^^^^^^^
22 |
23 | resizeStarted: (e) ->
Example from repos/atom/atom/src/pane.coffee:
333 |
334 | unsubscribeFromItem: (item) ->
> 335 | @subscriptionsPerItem.get(item)?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336 | @subscriptionsPerItem.delete(item)
337 |
Example from repos/atom/atom/src/pane.coffee:
357 | @activeItem = activeItem
358 | @emitter.emit 'did-change-active-item', @activeItem
> 359 | @container?.didChangeActiveItemOnPane(this, @activeItem)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
360 | @activeItem
361 |
Example from repos/atom/atom/src/pane.coffee:
518 |
519 | @emitter.emit 'did-add-item', {item, index, moved}
> 520 | @container?.didAddPaneItem(item, this, index) unless moved
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
521 |
522 | @destroyItem(lastPendingItem) if replacingPendingItem
Example from repos/atom/atom/src/pane.coffee:
571 | @items.splice(index, 1)
572 | @emitter.emit 'did-remove-item', {item, index, destroyed: not moved, moved}
> 573 | @container?.didDestroyPaneItem({item, index, pane: this}) unless moved
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
574 | @destroy() if @items.length is 0 and @config.get('core.destroyEmptyPanes')
575 |
Example from repos/atom/atom/src/pane.coffee:
622 | index = @items.indexOf(item)
623 | if index isnt -1
> 624 | return false if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
625 | @emitter.emit 'will-destroy-item', {item, index}
626 | @container?.willDestroyPaneItem({item, index, pane: this})
Example from repos/atom/atom/src/pane.coffee:
624 | return false if not force and @getContainer()?.getLocation() isnt 'center' and item.isPermanentDockItem?()
625 | @emitter.emit 'will-destroy-item', {item, index}
> 626 | @container?.willDestroyPaneItem({item, index, pane: this})
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
627 | if force or not item?.shouldPromptToSave?()
628 | @removeItem(item, false)
Example from repos/atom/atom/src/pane.coffee:
795 | # Returns a {Boolean}.
796 | isActive: ->
> 797 | @container?.getActivePane() is this
| ^^^^^^^^^^^^^^^^^^^^^^^^^
798 |
799 | # Public: Makes this pane the *active* pane, causing it to gain focus.
Example from repos/atom/atom/src/pane.coffee:
800 | activate: ->
801 | throw new Error("Pane has been destroyed") if @isDestroyed()
> 802 | @container?.didActivatePane(this)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
803 | @emitter.emit 'did-activate'
804 |
Example from repos/atom/atom/src/pane.coffee:
808 | # itself will not be destroyed.
809 | destroy: ->
> 810 | if @container?.isAlive() and @container.getPanes().length is 1
| ^^^^^^^^^^^^^^^^^^^
811 | @destroyItems()
812 | else
Example from repos/atom/atom/src/pane.coffee:
813 | @emitter.emit 'will-destroy'
814 | @alive = false
> 815 | @container?.willDestroyPane(pane: this)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
816 | @container.activateNextPane() if @isActive()
817 | @emitter.emit 'did-destroy'
Example from repos/atom/atom/src/pane.coffee:
818 | @emitter.dispose()
819 | item.destroy?() for item in @items.slice()
> 820 | @container?.didDestroyPane(pane: this)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
821 |
822 | isAlive: -> @alive
Example from repos/atom/atom/src/project.coffee:
33 | destroyed: ->
34 | buffer.destroy() for buffer in @buffers.slice()
> 35 | repository?.destroy() for repository in @repositories.slice()
| ^^^^^^^^^^^^^^^^^^^
36 | @rootDirectories = []
37 | @repositories = []
Example from repos/atom/atom/src/project.coffee:
41 | @emitter = new Emitter
42 |
> 43 | buffer?.destroy() for buffer in @buffers
| ^^^^^^^^^^^^^^^
44 | @buffers = []
45 | @setPaths([])
Example from repos/atom/atom/src/project.coffee:
169 | # * `projectPaths` {Array} of {String} paths.
170 | setPaths: (projectPaths) ->
> 171 | repository?.destroy() for repository in @repositories
| ^^^^^^^^^^^^^^^^^^^
172 | @rootDirectories = []
173 | @repositories = []
Example from repos/atom/atom/src/project.coffee:
220 | [removedDirectory] = @rootDirectories.splice(indexToRemove, 1)
221 | [removedRepository] = @repositories.splice(indexToRemove, 1)
> 222 | removedRepository?.destroy() unless removedRepository in @repositories
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
223 | @emitter.emit "did-change-paths", @getPaths()
224 | true
Example from repos/atom/atom/src/project.coffee:
233 | return unless uri
234 |
> 235 | if uri?.match(/[A-Za-z0-9+-.]+:\/\//) # leave path alone if it has a scheme
| ^^^^^^^^^^
236 | uri
237 | else
Example from repos/atom/atom/src/project.coffee:
329 | # Is the buffer for the given path modified?
330 | isPathModified: (filePath) ->
> 331 | @findBufferForPath(@resolvePath(filePath))?.isModified()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
332 |
333 | findBufferForPath: (filePath) ->
Example from repos/atom/atom/src/project.coffee:
416 | removeBufferAtIndex: (index, options={}) ->
417 | [buffer] = @buffers.splice(index, 1)
> 418 | buffer?.destroy()
| ^^^^^^^^^^^^^^^
419 |
420 | eachBuffer: (args...) ->
Example from repos/atom/atom/src/register-default-commands.coffee:
36 | 'application:new-file': -> ipcRenderer.send('command', 'application:new-file')
37 | 'application:open': ->
> 38 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 | ipcRenderer.send('open-command', 'application:open', defaultPath)
40 | 'application:open-file': ->
Example from repos/atom/atom/src/register-default-commands.coffee:
39 | ipcRenderer.send('open-command', 'application:open', defaultPath)
40 | 'application:open-file': ->
> 41 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 | ipcRenderer.send('open-command', 'application:open-file', defaultPath)
43 | 'application:open-folder': ->
Example from repos/atom/atom/src/register-default-commands.coffee:
42 | ipcRenderer.send('open-command', 'application:open-file', defaultPath)
43 | 'application:open-folder': ->
> 44 | defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 | ipcRenderer.send('open-command', 'application:open-folder', defaultPath)
46 | 'application:open-dev': -> ipcRenderer.send('command', 'application:open-dev')
Example from repos/atom/atom/src/selection.coffee:
480 | bufferRange = @getBufferRange()
481 | @editor.buffer.delete(bufferRange) unless bufferRange.isEmpty()
> 482 | @cursor?.setBufferPosition(bufferRange.start)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
483 |
484 | # Public: Removes the line at the beginning of the selection if the selection
Example from repos/atom/atom/src/selection.coffee:
554 | leadingTabRegex = new RegExp("^( {1,#{@editor.getTabLength()}}|\t)")
555 | for row in [start..end]
> 556 | if matchLength = buffer.lineForRow(row).match(leadingTabRegex)?[0].length
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
557 | buffer.delete [[row, 0], [row, matchLength]]
558 | return
Example from repos/atom/atom/src/selection.coffee:
807 |
808 | finalize: ->
> 809 | @initialScreenRange = null unless @initialScreenRange?.isEqual(@getScreenRange())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
810 | if @isEmpty()
811 | @wordwise = false
Example from repos/atom/atom/src/task.coffee:
149 |
150 | @childProcess.removeAllListeners()
> 151 | @childProcess.stdout?.removeAllListeners()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152 | @childProcess.stderr?.removeAllListeners()
153 | @childProcess.kill()
Example from repos/atom/atom/src/task.coffee:
150 | @childProcess.removeAllListeners()
151 | @childProcess.stdout?.removeAllListeners()
> 152 | @childProcess.stderr?.removeAllListeners()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
153 | @childProcess.kill()
154 | @childProcess = null
Example from repos/atom/atom/src/text-editor.coffee:
264 |
265 | if @getApproximateLongestScreenRow() isnt previousLongestRow
> 266 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
267 |
268 | update: (params) ->
Example from repos/atom/atom/src/text-editor.coffee:
336 | else
337 | @decorateCursorLine()
> 338 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
339 |
340 | when 'placeholderText'
Example from repos/atom/atom/src/text-editor.coffee:
359 | if value isnt @showLineNumbers
360 | @showLineNumbers = value
> 361 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
362 |
363 | when 'showInvisibles'
Example from repos/atom/atom/src/text-editor.coffee:
384 | if value isnt @scrollPastEnd
385 | @scrollPastEnd = value
> 386 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
387 |
388 | when 'autoHeight'
Example from repos/atom/atom/src/text-editor.coffee:
397 | if value isnt @showCursorOnSelection
398 | @showCursorOnSelection = value
> 399 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
400 |
401 | else
Example from repos/atom/atom/src/text-editor.coffee:
411 |
412 | scheduleComponentUpdate: ->
> 413 | @component?.scheduleUpdate()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
414 |
415 | serialize: ->
Example from repos/atom/atom/src/text-editor.coffee:
460 | @disposables.add @displayLayer.onDidChangeSync (e) =>
461 | @mergeIntersectingSelections()
> 462 | @component?.didChangeDisplayLayer(e)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
463 | @emitter.emit 'did-change', e
464 | @disposables.add @displayLayer.onDidReset =>
Example from repos/atom/atom/src/text-editor.coffee:
464 | @disposables.add @displayLayer.onDidReset =>
465 | @mergeIntersectingSelections()
> 466 | @component?.didResetDisplayLayer()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
467 | @emitter.emit 'did-change', {}
468 | @disposables.add @selectionsMarkerLayer.onDidCreateMarker @addSelection.bind(this)
Example from repos/atom/atom/src/text-editor.coffee:
467 | @emitter.emit 'did-change', {}
468 | @disposables.add @selectionsMarkerLayer.onDidCreateMarker @addSelection.bind(this)
> 469 | @disposables.add @selectionsMarkerLayer.onDidUpdate => @component?.didUpdateSelections()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
470 |
471 | destroyed: ->
Example from repos/atom/atom/src/text-editor.coffee:
479 | @emitter.emit 'did-destroy'
480 | @emitter.clear()
> 481 | @component?.element.component = null
| ^^^^^^^^^^^^^^^^^^^
482 | @component = null
483 | @lineNumberGutter.element = null
Example from repos/atom/atom/src/text-editor.coffee:
739 | didAddDecoration: (decoration) ->
740 | if decoration.isType('block')
> 741 | @component?.didAddBlockDecoration(decoration)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
742 |
743 | # Extended: Calls your `callback` when the placeholder text is changed.
Example from repos/atom/atom/src/text-editor.coffee:
1179 | selectionsToMove = [selection]
1180 |
> 1181 | while selection.end.row is selections[0]?.start.row
| ^^^^^^^^^^^^^^^^^^^^
1182 | selectionsToMove.push(selections[0])
1183 | selection.end.row = selections[0].end.row
Example from repos/atom/atom/src/text-editor.coffee:
1241 |
1242 | # if the current selection start row matches the next selections' end row - make them one selection
> 1243 | while selection.start.row is selections[0]?.end.row
| ^^^^^^^^^^^^^^^^^^
1244 | selectionsToMove.push(selections[0])
1245 | selection.start.row = selections[0].start.row
Example from repos/atom/atom/src/text-editor.coffee:
2090 |
2091 | destroyMarker: (id) ->
> 2092 | @getMarker(id)?.destroy()
| ^^^^^^^^^^^^^^^^^^^^^^^
2093 |
2094 | # Essential: Create a marker layer to group related markers.
Example from repos/atom/atom/src/text-editor.coffee:
2866 | # Called by the selection
2867 | selectionRangeChanged: (event) ->
> 2868 | @component?.didChangeSelectionRange()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2869 | @emitter.emit 'did-change-selection-range', event
2870 |
Example from repos/atom/atom/src/text-editor.coffee:
2985 | usesSoftTabs: ->
2986 | for bufferRow in [0..Math.min(1000, @buffer.getLastRow())]
> 2987 | continue if @tokenizedBuffer.tokenizedLines[bufferRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2988 |
2989 | line = @buffer.lineForRow(bufferRow)
Example from repos/atom/atom/src/text-editor.coffee:
3494 | screenRange = @clipScreenRange(screenRange) if options.clip isnt false
3495 | scrollEvent = {screenRange, options}
> 3496 | @component?.didRequestAutoscroll(scrollEvent)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3497 | @emitter.emit "did-request-autoscroll", scrollEvent
3498 |
Example from repos/atom/atom/src/theme-manager.coffee:
143 |
144 | unwatchUserStylesheet: ->
> 145 | @userStylsheetSubscriptions?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146 | @userStylsheetSubscriptions = null
147 | @userStylesheetFile = null
Example from repos/atom/atom/src/theme-manager.coffee:
146 | @userStylsheetSubscriptions = null
147 | @userStylesheetFile = null
> 148 | @userStyleSheetDisposable?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149 | @userStyleSheetDisposable = null
150 |
Example from repos/atom/atom/src/theme-manager.coffee:
247 |
248 | removeStylesheet: (stylesheetPath) ->
> 249 | @styleSheetDisposablesBySourcePath[stylesheetPath]?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
250 |
251 | applyStylesheet: (path, text, priority, skipDeprecatedSelectorsTransformation) ->
Example from repos/atom/atom/src/theme-manager.coffee:
306 |
307 | refreshLessCache: ->
> 308 | @lessCache?.setImportPaths(@getImportPaths())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
309 |
310 | getImportPaths: ->
Example from repos/atom/atom/src/tokenized-buffer.coffee:
94 | @rootScopeDescriptor = new ScopeDescriptor(scopes: [@grammar.scopeName])
95 |
> 96 | @grammarUpdateDisposable?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97 | @grammarUpdateDisposable = @grammar.onDidUpdate => @retokenizeLines()
98 | @disposables.add(@grammarUpdateDisposable)
Example from repos/atom/atom/src/tokenized-buffer.coffee:
225 | nextRow = @buffer.nextNonBlankRow(row)
226 | tokenizedLine = @tokenizedLines[row]
> 227 | if @buffer.isRowBlank(row) or tokenizedLine?.isComment() or not nextRow?
| ^^^^^^^^^^^^^^^^^^^^^^^^
228 | false
229 | else
Example from repos/atom/atom/src/tokenized-buffer.coffee:
239 | else
240 | Boolean(
> 241 | not (@tokenizedLines[previousRow]?.isComment()) and
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242 | @tokenizedLines[row]?.isComment() and
243 | @tokenizedLines[nextRow]?.isComment()
Example from repos/atom/atom/src/tokenized-buffer.coffee:
240 | Boolean(
241 | not (@tokenizedLines[previousRow]?.isComment()) and
> 242 | @tokenizedLines[row]?.isComment() and
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243 | @tokenizedLines[nextRow]?.isComment()
244 | )
Example from repos/atom/atom/src/tokenized-buffer.coffee:
241 | not (@tokenizedLines[previousRow]?.isComment()) and
242 | @tokenizedLines[row]?.isComment() and
> 243 | @tokenizedLines[nextRow]?.isComment()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
244 | )
245 |
Example from repos/atom/atom/src/window-event-handler.coffee:
177 | handleLinkClick: (event) =>
178 | event.preventDefault()
> 179 | uri = event.currentTarget?.getAttribute('href')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180 | if uri and uri[0] isnt '#' and /^https?:\/\//.test(uri)
181 | @applicationDelegate.openExternal(uri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment