Fix errors

This commit is contained in:
Garen Torikian
2013-04-11 02:29:48 -05:00
parent e0e4936756
commit bb8f5bb40c
9 changed files with 46 additions and 29 deletions

View File

@@ -2,12 +2,17 @@ fsUtils = require 'fs-utils'
Theme = require 'theme'
CSON = require 'cson'
# Internal: Represents a theme that Atom can use.
module.exports =
class AtomTheme extends Theme
# Internal: Given a path, this loads it as a stylesheet.
#
# stylesheetPath - A {String} to a stylesheet
loadStylesheet: (stylesheetPath)->
@stylesheets[stylesheetPath] = window.loadStylesheet(stylesheetPath)
# Internal: Loads the stylesheets found in a `package.cson` file.
load: ->
if fsUtils.extension(@path) in ['.css', '.less']
@loadStylesheet(@path)

View File

@@ -11,6 +11,10 @@ vendoredThemesDirPath = fsUtils.join(resourcePath, "vendor/themes")
userThemesDirPath = fsUtils.join(configDirPath, "themes")
userPackagesDirPath = fsUtils.join(configDirPath, "packages")
# Public: Handles all of Atom's configuration details.
#
# This includes loading and setting options, as well as reading from the
# user's configuration file.
module.exports =
class Config
configDirPath: configDirPath

View File

@@ -298,7 +298,7 @@ class Cursor
# Public: Gets the word located under the cursor.
#
# options - An object with properties based on {Cursor.getBeginningOfCurrentWordBufferPosition}.
# options - An object with properties based on {#getBeginningOfCurrentWordBufferPosition}.
#
# Returns a {String}.
getCurrentWordBufferRange: (options={}) ->
@@ -308,7 +308,7 @@ class Cursor
# Public: Retrieves the range for the current line.
#
# options - A hash with the same keys as {EditSession.bufferRangeForBufferRow}
# options - A hash with the same keys as {EditSession#bufferRangeForBufferRow}
#
# Returns a {Range}.
getCurrentLineBufferRange: (options) ->

View File

@@ -262,7 +262,7 @@ class DisplayBuffer
#
# bufferPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {LineMap#clipScreenPosition}.
#
# Returns a {Point}.
screenPositionForBufferPosition: (position, options) ->
@@ -271,7 +271,7 @@ class DisplayBuffer
#
# screenPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {LineMap#clipScreenPosition}.
#
# Returns a {Point}.
bufferPositionForScreenPosition: (position, options) ->

View File

@@ -10,7 +10,7 @@ Range = require 'range'
_ = require 'underscore'
fsUtils = require 'fs-utils'
# Public: `EditSession`s manage the states between file {Buffers}, and the project as a whole.
# Public: `EditSession`s manage the states between file {Buffer}s, and the project as a whole.
module.exports =
class EditSession
registerDeserializer(this)
@@ -168,7 +168,7 @@ class EditSession
# Public: Retrieves that character used to indicate a tab.
#
# If soft tabs are enabled, this is a space (`" "`) times the {.getTabLength} value.
# If soft tabs are enabled, this is a space (`" "`) times the {#getTabLength} value.
# Otherwise, it's a tab (`\t`).
#
# Returns a {String}.
@@ -294,7 +294,7 @@ class EditSession
#
# bufferPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {LineMap#clipScreenPosition}.
#
# Returns a {Point}.
screenPositionForBufferPosition: (bufferPosition, options) -> @displayBuffer.screenPositionForBufferPosition(bufferPosition, options)
@@ -303,7 +303,7 @@ class EditSession
#
# screenPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {LineMap#clipScreenPosition}.
#
# Returns a {Point}.
bufferPositionForScreenPosition: (screenPosition, options) -> @displayBuffer.bufferPositionForScreenPosition(screenPosition, options)
@@ -368,7 +368,7 @@ class EditSession
# Public: Inserts text at the current cursor positions.
#
# text - A {String} representing the text to insert.
# options - A set of options equivalent to {Selection.insertText}.
# options - A set of options equivalent to {Selection#insertText}.
insertText: (text, options={}) ->
options.autoIndent ?= @shouldAutoIndent()
@mutateSelectedText (selection) -> selection.insertText(text, options)
@@ -394,7 +394,7 @@ class EditSession
# Public: Indents the current line.
#
# options - A set of options equivalent to {Selection.indent}.
# options - A set of options equivalent to {Selection#indent}.
indent: (options={})->
options.autoIndent ?= @shouldAutoIndent()
@mutateSelectedText (selection) -> selection.indent(options)
@@ -437,7 +437,7 @@ class EditSession
autoIndentSelectedRows: ->
@mutateSelectedText (selection) -> selection.autoIndentSelectedRows()
# Given a buffer range, this converts all `\t` characters to the appopriate {.getTabText} value.
# Given a buffer range, this converts all `\t` characters to the appopriate {#getTabText} value.
#
# bufferRange - The {Range} to perform the replace in
normalizeTabsInBufferRange: (bufferRange) ->
@@ -469,7 +469,7 @@ class EditSession
# Public: Pastes the text in the clipboard.
#
# options - A set of options equivalent to {Selection.insertText}.
# options - A set of options equivalent to {Selection#insertText}.
pasteText: (options={}) ->
options.normalizeIndent ?= true
options.autoIndent ?= @shouldAutoIndentPastedText()
@@ -1051,7 +1051,7 @@ class EditSession
# Public: Moves every cursor to a given screen position.
#
# position - An {Array} of two numbers: the screen row, and the screen column.
# options - An object with properties based on {Cursor.changePosition}
# options - An object with properties based on {Cursor#changePosition}
#
setCursorScreenPosition: (position, options) ->
@moveCursors (cursor) -> cursor.setScreenPosition(position, options)
@@ -1071,7 +1071,7 @@ class EditSession
# Public: Moves every cursor to a given buffer position.
#
# position - An {Array} of two numbers: the buffer row, and the buffer column.
# options - An object with properties based on {Cursor.changePosition}
# options - An object with properties based on {Cursor#changePosition}
#
setCursorBufferPosition: (position, options) ->
@moveCursors (cursor) -> cursor.setBufferPosition(position, options)
@@ -1119,7 +1119,7 @@ class EditSession
@getCursor().getCurrentParagraphBufferRange()
# Public: Gets the word located under the cursor.
#
# options - An object with properties based on {Cursor.getBeginningOfCurrentWordBufferPosition}.
# options - An object with properties based on {Cursor#getBeginningOfCurrentWordBufferPosition}.
#
# Returns a {String}.
getWordUnderCursor: (options) ->

View File

@@ -234,7 +234,7 @@ class Editor extends View
# Public: Sets the cursor based on a given screen position.
#
# position - An {Array} of two numbers: the screen row, and the screen column.
# options - An object with properties based on {Cursor.changePosition}.
# options - An object with properties based on {Cursor#changePosition}.
#
setCursorScreenPosition: (position, options) -> @activeEditSession.setCursorScreenPosition(position, options)
# Public: Duplicates the current line.
@@ -248,7 +248,7 @@ class Editor extends View
# Public: Sets the cursor based on a given buffer position.
#
# position - An {Array} of two numbers: the buffer row, and the buffer column.
# options - An object with properties based on {Cursor.changePosition}.
# options - An object with properties based on {Cursor#changePosition}.
#
setCursorBufferPosition: (position, options) -> @activeEditSession.setCursorBufferPosition(position, options)
# Public: Gets the current buffer position.
@@ -258,7 +258,7 @@ class Editor extends View
getCurrentParagraphBufferRange: -> @activeEditSession.getCurrentParagraphBufferRange()
# Public: Gets the word located under the cursor.
#
# options - An object with properties based on {Cursor.getBeginningOfCurrentWordBufferPosition}.
# options - An object with properties based on {Cursor#getBeginningOfCurrentWordBufferPosition}.
#
# Returns a {String}.
getWordUnderCursor: (options) -> @activeEditSession.getWordUnderCursor(options)
@@ -336,7 +336,7 @@ class Editor extends View
# Public: Inserts text at the current cursor positions.
#
# text - A {String} representing the text to insert.
# options - A set of options equivalent to {Selection.insertText}.
# options - A set of options equivalent to {Selection#insertText}.
insertText: (text, options) -> @activeEditSession.insertText(text, options)
# Public: Inserts a new line at the current cursor positions.
insertNewline: -> @activeEditSession.insertNewline()
@@ -347,7 +347,7 @@ class Editor extends View
insertNewlineAbove: -> @activeEditSession.insertNewlineAbove()
# Public: Indents the current line.
#
# options - A set of options equivalent to {Selection.indent}.
# options - A set of options equivalent to {Selection#indent}.
indent: (options) -> @activeEditSession.indent(options)
# Public: TODO
autoIndent: (options) -> @activeEditSession.autoIndentSelectedRows()
@@ -361,7 +361,7 @@ class Editor extends View
copySelection: -> @activeEditSession.copySelectedText()
# Public: Pastes the text in the clipboard.
#
# options - A set of options equivalent to {Selection.insertText}.
# options - A set of options equivalent to {Selection#insertText}.
paste: (options) -> @activeEditSession.pasteText(options)
# Public: Undos the last {Buffer} change.
undo: -> @activeEditSession.undo()
@@ -433,7 +433,7 @@ class Editor extends View
#
# bufferPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {LineMap#clipScreenPosition}.
#
# Returns a {Point}.
screenPositionForBufferPosition: (position, options) -> @activeEditSession.screenPositionForBufferPosition(position, options)
@@ -442,7 +442,7 @@ class Editor extends View
#
# screenPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {LineMap#clipScreenPosition}.
#
# Returns a {Point}.
bufferPositionForScreenPosition: (position, options) -> @activeEditSession.bufferPositionForScreenPosition(position, options)
@@ -776,7 +776,7 @@ class Editor extends View
#
# bufferPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - A hash matching the options available to {.scrollToPixelPosition}
# options - A hash matching the options available to {#scrollToPixelPosition}
scrollToBufferPosition: (bufferPosition, options) ->
@scrollToPixelPosition(@pixelPositionForBufferPosition(bufferPosition), options)
@@ -784,7 +784,7 @@ class Editor extends View
#
# screenPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - A hash matching the options available to {.scrollToPixelPosition}
# options - A hash matching the options available to {#scrollToPixelPosition}
scrollToScreenPosition: (screenPosition, options) ->
@scrollToPixelPosition(@pixelPositionForScreenPosition(screenPosition), options)
@@ -792,7 +792,7 @@ class Editor extends View
#
# bufferPosition - An object that represents a pixel position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - A hash matching the options available to {.scrollVertically}
# options - A hash matching the options available to {#scrollVertically}
scrollToPixelPosition: (pixelPosition, options) ->
return unless @attached
@scrollVertically(pixelPosition, options)

View File

@@ -158,7 +158,7 @@ class Git
relativize: (path) ->
@getRepo().relativize(path)
# Public: Retrieves a shortened version of {.getHead}.
# Public: Retrieves a shortened version of {#getHead}.
#
# This removes the leading segments of `refs/heads`, `refs/tags`, or `refs/remotes`.
# It also shortenes the SHA-1 of a detached `HEAD` to 7 characters.

View File

@@ -81,7 +81,7 @@ class LineMap
#
# bufferPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {#clipScreenPosition}.
#
# Returns a {Point}.
screenPositionForBufferPosition: (bufferPosition, options={}) ->
@@ -120,7 +120,7 @@ class LineMap
#
# screenPosition - An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# options - The same options available to {LineMap.clipScreenPosition}.
# options - The same options available to {#clipScreenPosition}.
#
# Returns a {Point}.
bufferPositionForScreenPosition: (screenPosition, options) ->
@@ -138,6 +138,7 @@ class LineMap
bufferRow += screenLine.bufferRows
[bufferRow, screenLine]
# Public: Given a buffer range, this converts it into a screen position.
#
# bufferRange - The {Range} to convert

View File

@@ -1,6 +1,13 @@
{View} = require 'space-pen'
# Public: Represents a view that scrolls.
#
# This `View` subclass listens to events such as `page-up`, `page-down`,
# `move-to-top`, and `move-to-bottom`.
module.exports =
class ScrollView extends View
# Internal: The constructor.
initialize: ->
@on 'core:page-up', => @pageUp()
@on 'core:page-down', => @pageDown()