mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge pull request #12782 from Ingramz/remove-unused-variables-obvious
Remove unused variables (obvious ones)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
_ = require 'underscore-plus'
|
||||
{screen, ipcRenderer, remote, shell, systemPreferences, webFrame} = require 'electron'
|
||||
{screen, ipcRenderer, remote, shell, webFrame} = require 'electron'
|
||||
ipcHelpers = require './ipc-helpers'
|
||||
{Disposable} = require 'event-kit'
|
||||
{getWindowLoadSettings, setWindowLoadSettings} = require './window-load-settings-helpers'
|
||||
|
||||
@@ -9,10 +9,9 @@ fs = require 'fs-plus'
|
||||
{mapSourcePosition} = require 'source-map-support'
|
||||
Model = require './model'
|
||||
WindowEventHandler = require './window-event-handler'
|
||||
StylesElement = require './styles-element'
|
||||
StateStore = require './state-store'
|
||||
StorageFolder = require './storage-folder'
|
||||
{getWindowLoadSettings, setWindowLoadSettings} = require './window-load-settings-helpers'
|
||||
{getWindowLoadSettings} = require './window-load-settings-helpers'
|
||||
registerDefaultCommands = require './register-default-commands'
|
||||
|
||||
DeserializerManager = require './deserializer-manager'
|
||||
@@ -51,7 +50,6 @@ PanelElement = require './panel-element'
|
||||
PaneContainerElement = require './pane-container-element'
|
||||
PaneAxisElement = require './pane-axis-element'
|
||||
PaneElement = require './pane-element'
|
||||
TextEditorElement = require './text-editor-element'
|
||||
{createGutterView} = require './gutter-component-helpers'
|
||||
|
||||
# Essential: Atom global for dealing with packages, themes, menus, and the window.
|
||||
|
||||
@@ -24,7 +24,7 @@ class BlockDecorationsComponent
|
||||
@domNode.style.width = @newState.width + "px"
|
||||
@oldState.width = @newState.width
|
||||
|
||||
for id, blockDecorationState of @oldState.blockDecorations
|
||||
for id of @oldState.blockDecorations
|
||||
unless @newState.blockDecorations.hasOwnProperty(id)
|
||||
blockDecorationNode = @blockDecorationNodesById[id]
|
||||
blockDecorationNode.previousSibling.remove()
|
||||
@@ -33,7 +33,7 @@ class BlockDecorationsComponent
|
||||
delete @blockDecorationNodesById[id]
|
||||
delete @oldState.blockDecorations[id]
|
||||
|
||||
for id, blockDecorationState of @newState.blockDecorations
|
||||
for id of @newState.blockDecorations
|
||||
if @oldState.blockDecorations.hasOwnProperty(id)
|
||||
@updateBlockDecorationNode(id)
|
||||
else
|
||||
@@ -42,7 +42,6 @@ class BlockDecorationsComponent
|
||||
|
||||
measureBlockDecorations: ->
|
||||
for decorationId, blockDecorationNode of @blockDecorationNodesById
|
||||
style = getComputedStyle(blockDecorationNode)
|
||||
decoration = @newState.blockDecorations[decorationId].decoration
|
||||
topRuler = blockDecorationNode.previousSibling
|
||||
bottomRuler = blockDecorationNode.nextSibling
|
||||
|
||||
@@ -214,7 +214,6 @@ class CommandRegistry
|
||||
immediatePropagationStopped = false
|
||||
matched = false
|
||||
currentTarget = event.target
|
||||
{preventDefault, stopPropagation, stopImmediatePropagation, abortKeyBinding} = event
|
||||
|
||||
dispatchedEvent = new CustomEvent(event.type, {bubbles: true, detail: event.detail})
|
||||
Object.defineProperty dispatchedEvent, 'eventPhase', value: Event.BUBBLING_PHASE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
_ = require 'underscore-plus'
|
||||
fs = require 'fs-plus'
|
||||
{CompositeDisposable, Disposable, Emitter} = require 'event-kit'
|
||||
{Emitter} = require 'event-kit'
|
||||
CSON = require 'season'
|
||||
path = require 'path'
|
||||
async = require 'async'
|
||||
@@ -561,7 +561,7 @@ class Config
|
||||
# * `scopeDescriptor` The {ScopeDescriptor} with which the value is associated
|
||||
# * `value` The value for the key-path
|
||||
getAll: (keyPath, options) ->
|
||||
{scope, sources} = options if options?
|
||||
{scope} = options if options?
|
||||
result = []
|
||||
|
||||
if scope?
|
||||
@@ -1045,7 +1045,6 @@ class Config
|
||||
resetSettingsForSchemaChange: (source=@getUserConfigPath()) ->
|
||||
@transact =>
|
||||
@settings = @makeValueConformToSchema(null, @settings, suppressException: true)
|
||||
priority = @priorityForSource(source)
|
||||
selectorsAndSettings = @scopedSettingsStore.propertiesForSource(source)
|
||||
@scopedSettingsStore.removePropertiesForSource(source)
|
||||
for scopeSelector, settings of selectorsAndSettings
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
_ = require 'underscore-plus'
|
||||
path = require 'path'
|
||||
CSON = require 'season'
|
||||
fs = require 'fs-plus'
|
||||
|
||||
@@ -682,7 +682,6 @@ class Cursor extends Model
|
||||
{row, column} = start
|
||||
scanRange = [[row-1, column], [0, 0]]
|
||||
position = new Point(0, 0)
|
||||
zero = new Point(0, 0)
|
||||
@editor.backwardsScanInBufferRange EmptyLineRegExp, scanRange, ({range, stop}) ->
|
||||
position = range.start.traverse(Point(1, 0))
|
||||
stop() unless position.isEqual(start)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{basename, join} = require 'path'
|
||||
{join} = require 'path'
|
||||
|
||||
_ = require 'underscore-plus'
|
||||
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
_ = require 'underscore-plus'
|
||||
{Emitter} = require 'event-kit'
|
||||
FirstMate = require 'first-mate'
|
||||
Token = require './token'
|
||||
fs = require 'fs-plus'
|
||||
|
||||
@@ -18,7 +18,7 @@ class GutterContainerComponent
|
||||
@domNode.style.display = 'flex'
|
||||
|
||||
destroy: ->
|
||||
for {name, component} in @gutterComponents
|
||||
for {component} in @gutterComponents
|
||||
component.destroy?()
|
||||
return
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = ({blobStore}) ->
|
||||
require './window'
|
||||
{getWindowLoadSettings} = require './window-load-settings-helpers'
|
||||
{ipcRenderer} = require 'electron'
|
||||
{resourcePath, isSpec, devMode, env} = getWindowLoadSettings()
|
||||
{resourcePath, devMode, env} = getWindowLoadSettings()
|
||||
require '../src/electron-shims'
|
||||
|
||||
updateProcessEnv(env)
|
||||
|
||||
@@ -253,7 +253,6 @@ class LanguageMode
|
||||
iterator.next()
|
||||
scopeDescriptor = new ScopeDescriptor(scopes: iterator.getScopes())
|
||||
|
||||
patterns =
|
||||
increaseIndentRegex = @increaseIndentRegexForScopeDescriptor(scopeDescriptor)
|
||||
decreaseIndentRegex = @decreaseIndentRegexForScopeDescriptor(scopeDescriptor)
|
||||
decreaseNextIndentRegex = @decreaseNextIndentRegexForScopeDescriptor(scopeDescriptor)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
idCounter = 0
|
||||
nextId = -> idCounter++
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
TiledComponent = require './tiled-component'
|
||||
LineNumbersTileComponent = require './line-numbers-tile-component'
|
||||
WrapperDiv = document.createElement('div')
|
||||
DOMElementPool = require './dom-element-pool'
|
||||
|
||||
module.exports =
|
||||
class LineNumberGutterComponent extends TiledComponent
|
||||
|
||||
@@ -96,7 +96,7 @@ class LineNumbersTileComponent
|
||||
screenRowForNode: (node) -> parseInt(node.dataset.screenRow)
|
||||
|
||||
buildLineNumberNode: (lineNumberState) ->
|
||||
{screenRow, bufferRow, softWrapped, top, decorationClasses, zIndex, blockDecorationsHeight} = lineNumberState
|
||||
{screenRow, bufferRow, softWrapped, blockDecorationsHeight} = lineNumberState
|
||||
|
||||
className = @buildLineNumberClassName(lineNumberState)
|
||||
lineNumberNode = @domElementPool.buildElement("div", className)
|
||||
|
||||
@@ -15,8 +15,6 @@ DummyLineNode.children[1].textContent = '我'
|
||||
DummyLineNode.children[2].textContent = 'ハ'
|
||||
DummyLineNode.children[3].textContent = '세'
|
||||
|
||||
RangeForMeasurement = document.createRange()
|
||||
|
||||
module.exports =
|
||||
class LinesComponent extends TiledComponent
|
||||
placeholderTextDiv: null
|
||||
@@ -77,7 +75,6 @@ class LinesComponent extends TiledComponent
|
||||
|
||||
measureLineHeightAndDefaultCharWidth: ->
|
||||
@domNode.appendChild(DummyLineNode)
|
||||
textNode = DummyLineNode.firstChild.childNodes[0]
|
||||
|
||||
lineHeightInPixels = DummyLineNode.getBoundingClientRect().height
|
||||
defaultCharWidth = DummyLineNode.children[0].getBoundingClientRect().width
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
HighlightsComponent = require './highlights-component'
|
||||
AcceptFilter = {acceptNode: -> NodeFilter.FILTER_ACCEPT}
|
||||
TokenTextEscapeRegex = /[&"'<>]/g
|
||||
MaxTokenLength = 20000
|
||||
ZERO_WIDTH_NBSP = '\ufeff'
|
||||
|
||||
cloneObject = (object) ->
|
||||
@@ -201,7 +196,6 @@ class LinesTileComponent
|
||||
lineNode.classList.add(decorationClass)
|
||||
|
||||
textNodes = []
|
||||
lineLength = 0
|
||||
startIndex = 0
|
||||
openScopeNode = lineNode
|
||||
for tagCode in tagCodes when tagCode isnt 0
|
||||
|
||||
@@ -18,7 +18,6 @@ class LinesYardstick
|
||||
screenPositionForPixelPosition: (pixelPosition) ->
|
||||
targetTop = pixelPosition.top
|
||||
targetLeft = pixelPosition.left
|
||||
defaultCharWidth = @model.getDefaultCharWidth()
|
||||
row = @lineTopIndex.rowForPixelPosition(targetTop)
|
||||
targetLeft = 0 if targetTop < 0 or targetLeft < 0
|
||||
targetLeft = Infinity if row > @model.getLastScreenRow()
|
||||
|
||||
@@ -63,7 +63,7 @@ class AtomApplication
|
||||
exit: (status) -> app.exit(status)
|
||||
|
||||
constructor: (options) ->
|
||||
{@resourcePath, @devResourcePath, @version, @devMode, @safeMode, @socketPath, @logFile, @setPortable, @userDataDir, timeout, clearWindowState} = options
|
||||
{@resourcePath, @devResourcePath, @version, @devMode, @safeMode, @socketPath, @logFile, @setPortable, @userDataDir} = options
|
||||
@socketPath = null if options.test
|
||||
@pidsToOpenWindows = {}
|
||||
@windows = []
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{app, protocol} = require 'electron'
|
||||
{protocol} = require 'electron'
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class AtomWindow
|
||||
isSpec: null
|
||||
|
||||
constructor: (@atomApplication, @fileRecoveryService, settings={}) ->
|
||||
{@resourcePath, initialPaths, pathToOpen, locationsToOpen, @isSpec, @headless, @safeMode, @devMode} = settings
|
||||
{@resourcePath, pathToOpen, locationsToOpen, @isSpec, @headless, @safeMode, @devMode} = settings
|
||||
locationsToOpen ?= [{pathToOpen}] if pathToOpen
|
||||
locationsToOpen ?= []
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{Emitter, Disposable} = require 'event-kit'
|
||||
{Emitter} = require 'event-kit'
|
||||
Notification = require '../src/notification'
|
||||
|
||||
# Public: A notification manager used to create {Notification}s to be shown
|
||||
|
||||
@@ -284,7 +284,7 @@ class PackageManager
|
||||
packagePaths.push(packagePath) if fs.isDirectorySync(packagePath)
|
||||
|
||||
packagesPath = path.join(@resourcePath, 'node_modules')
|
||||
for packageName, packageVersion of @getPackageDependencies()
|
||||
for packageName of @getPackageDependencies()
|
||||
packagePath = path.join(packagesPath, packageName)
|
||||
packagePaths.push(packagePath) if fs.isDirectorySync(packagePath)
|
||||
|
||||
|
||||
@@ -422,8 +422,6 @@ class Package
|
||||
@settingsActivated = false
|
||||
|
||||
reloadStylesheets: ->
|
||||
oldSheets = _.clone(@stylesheets)
|
||||
|
||||
try
|
||||
@loadStylesheets()
|
||||
catch error
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{find, flatten} = require 'underscore-plus'
|
||||
{find} = require 'underscore-plus'
|
||||
{Emitter, CompositeDisposable} = require 'event-kit'
|
||||
Gutter = require './gutter'
|
||||
Model = require './model'
|
||||
Pane = require './pane'
|
||||
ItemRegistry = require './item-registry'
|
||||
|
||||
@@ -21,7 +21,7 @@ class Pane extends Model
|
||||
focused: false
|
||||
|
||||
@deserialize: (state, {deserializers, applicationDelegate, config, notifications}) ->
|
||||
{items, itemStackIndices, activeItemIndex, activeItemURI, activeItemUri} = state
|
||||
{items, activeItemIndex, activeItemURI, activeItemUri} = state
|
||||
activeItemURI ?= activeItemUri
|
||||
items = items.map (itemState) -> deserializers.deserialize(itemState)
|
||||
state.activeItem = items[activeItemIndex]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
path = require 'path'
|
||||
url = require 'url'
|
||||
|
||||
_ = require 'underscore-plus'
|
||||
fs = require 'fs-plus'
|
||||
@@ -8,8 +7,6 @@ TextBuffer = require 'text-buffer'
|
||||
|
||||
DefaultDirectoryProvider = require './default-directory-provider'
|
||||
Model = require './model'
|
||||
TextEditor = require './text-editor'
|
||||
Task = require './task'
|
||||
GitRepositoryProvider = require './git-repository-provider'
|
||||
|
||||
# Extended: Represents a project that's opened in Atom.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{ipcRenderer} = require 'electron'
|
||||
Grim = require 'grim'
|
||||
|
||||
module.exports = ({commandRegistry, commandInstaller, config, notificationManager, project, clipboard}) ->
|
||||
commandRegistry.add 'atom-workspace',
|
||||
|
||||
@@ -5,8 +5,6 @@ async = require "async"
|
||||
module.exports = (rootPaths, regexSource, options) ->
|
||||
callback = @async()
|
||||
|
||||
rootPath = rootPaths[0]
|
||||
|
||||
PATHS_COUNTER_SEARCHED_CHUNK = 50
|
||||
pathsSearched = 0
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
CSON = require 'season'
|
||||
{CompositeDisposable} = require 'event-kit'
|
||||
|
||||
module.exports =
|
||||
class ScopedProperties
|
||||
|
||||
@@ -512,7 +512,7 @@ class Selection extends Model
|
||||
joinMarker = @editor.markBufferRange(selectedRange, invalidate: 'never')
|
||||
|
||||
rowCount = Math.max(1, selectedRange.getRowCount() - 1)
|
||||
for row in [0...rowCount]
|
||||
for [0...rowCount]
|
||||
@cursor.setBufferPosition([selectedRange.start.row])
|
||||
@cursor.moveToEndOfLine()
|
||||
|
||||
@@ -656,7 +656,7 @@ class Selection extends Model
|
||||
# * `autoIndent` If `true`, the line is indented to an automatically-inferred
|
||||
# level. Otherwise, {TextEditor::getTabText} is inserted.
|
||||
indent: ({autoIndent}={}) ->
|
||||
{row, column} = @cursor.getBufferPosition()
|
||||
{row} = @cursor.getBufferPosition()
|
||||
|
||||
if @isEmpty()
|
||||
@cursor.skipLeadingWhitespace()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
_ = require 'underscore-plus'
|
||||
scrollbarStyle = require 'scrollbar-style'
|
||||
{Range, Point} = require 'text-buffer'
|
||||
{CompositeDisposable} = require 'event-kit'
|
||||
@@ -343,8 +342,6 @@ class TextEditorComponent
|
||||
@scopedConfigDisposables = new CompositeDisposable
|
||||
@disposables.add(@scopedConfigDisposables)
|
||||
|
||||
scope = @editor.getRootScopeDescriptor()
|
||||
|
||||
focused: ->
|
||||
if @mounted
|
||||
@presenter.setFocused(true)
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
{Emitter, CompositeDisposable} = require 'event-kit'
|
||||
Path = require 'path'
|
||||
{defaults} = require 'underscore-plus'
|
||||
TextBuffer = require 'text-buffer'
|
||||
TextEditor = require './text-editor'
|
||||
TextEditorComponent = require './text-editor-component'
|
||||
StylesElement = require './styles-element'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{CompositeDisposable, Disposable, Emitter} = require 'event-kit'
|
||||
{CompositeDisposable, Emitter} = require 'event-kit'
|
||||
{Point, Range} = require 'text-buffer'
|
||||
_ = require 'underscore-plus'
|
||||
Decoration = require './decoration'
|
||||
@@ -886,13 +886,11 @@ class TextEditorPresenter
|
||||
|
||||
setHorizontalScrollbarHeight: (horizontalScrollbarHeight) ->
|
||||
unless @measuredHorizontalScrollbarHeight is horizontalScrollbarHeight
|
||||
oldHorizontalScrollbarHeight = @measuredHorizontalScrollbarHeight
|
||||
@measuredHorizontalScrollbarHeight = horizontalScrollbarHeight
|
||||
@emitDidUpdateState()
|
||||
|
||||
setVerticalScrollbarWidth: (verticalScrollbarWidth) ->
|
||||
unless @measuredVerticalScrollbarWidth is verticalScrollbarWidth
|
||||
oldVerticalScrollbarWidth = @measuredVerticalScrollbarWidth
|
||||
@measuredVerticalScrollbarWidth = verticalScrollbarWidth
|
||||
@emitDidUpdateState()
|
||||
|
||||
@@ -922,7 +920,6 @@ class TextEditorPresenter
|
||||
|
||||
setContentFrameWidth: (contentFrameWidth) ->
|
||||
if @contentFrameWidth isnt contentFrameWidth or @editorWidthInChars?
|
||||
oldContentFrameWidth = @contentFrameWidth
|
||||
@contentFrameWidth = contentFrameWidth
|
||||
@editorWidthInChars = null
|
||||
@updateScrollbarDimensions()
|
||||
@@ -1122,7 +1119,7 @@ class TextEditorPresenter
|
||||
@updateHighlightState(decorationId, properties, screenRange)
|
||||
|
||||
for tileId, tileState of @state.content.tiles
|
||||
for id, highlight of tileState.highlights
|
||||
for id of tileState.highlights
|
||||
delete tileState.highlights[id] unless @visibleHighlights[tileId]?[id]?
|
||||
|
||||
return
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
path = require 'path'
|
||||
_ = require 'underscore-plus'
|
||||
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
|
||||
{Emitter, CompositeDisposable} = require 'event-kit'
|
||||
{File} = require 'pathwatcher'
|
||||
fs = require 'fs-plus'
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
StartDotRegex = /^\.?/
|
||||
WhitespaceRegex = /\S/
|
||||
|
||||
# Represents a single unit of text as selected by a grammar.
|
||||
module.exports =
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
_ = require 'underscore-plus'
|
||||
{CompositeDisposable, Emitter} = require 'event-kit'
|
||||
{Point, Range} = require 'text-buffer'
|
||||
{ScopeSelector} = require 'first-mate'
|
||||
Model = require './model'
|
||||
TokenizedLine = require './tokenized-line'
|
||||
TokenIterator = require './token-iterator'
|
||||
Token = require './token'
|
||||
ScopeDescriptor = require './scope-descriptor'
|
||||
TokenizedBufferIterator = require './tokenized-buffer-iterator'
|
||||
NullGrammar = require './null-grammar'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
_ = require 'underscore-plus'
|
||||
{isPairedCharacter, isCJKCharacter} = require './text-utils'
|
||||
Token = require './token'
|
||||
CommentScopeRegex = /(\b|\.)comment/
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{find} = require 'underscore-plus'
|
||||
Grim = require 'grim'
|
||||
{Disposable} = require 'event-kit'
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
path = require 'path'
|
||||
{Disposable, CompositeDisposable} = require 'event-kit'
|
||||
fs = require 'fs-plus'
|
||||
listen = require './delegated-listener'
|
||||
|
||||
# Handles low-level events related to the @window.
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
{remote} = require 'electron'
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
windowLoadSettings = null
|
||||
|
||||
exports.getWindowLoadSettings = ->
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{ipcRenderer} = require 'electron'
|
||||
path = require 'path'
|
||||
fs = require 'fs-plus'
|
||||
{Disposable, CompositeDisposable} = require 'event-kit'
|
||||
Grim = require 'grim'
|
||||
{CompositeDisposable} = require 'event-kit'
|
||||
scrollbarStyle = require 'scrollbar-style'
|
||||
|
||||
module.exports =
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
_ = require 'underscore-plus'
|
||||
url = require 'url'
|
||||
path = require 'path'
|
||||
{join} = path
|
||||
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
|
||||
fs = require 'fs-plus'
|
||||
{Directory} = require 'pathwatcher'
|
||||
@@ -9,7 +8,6 @@ DefaultDirectorySearcher = require './default-directory-searcher'
|
||||
Model = require './model'
|
||||
TextEditor = require './text-editor'
|
||||
PaneContainer = require './pane-container'
|
||||
Pane = require './pane'
|
||||
Panel = require './panel'
|
||||
PanelContainer = require './panel-container'
|
||||
Task = require './task'
|
||||
|
||||
Reference in New Issue
Block a user