mirror of
https://github.com/atom/atom.git
synced 2026-02-11 07:05:11 -05:00
Merge branch 'master' of github.com:github/atom
This commit is contained in:
@@ -55,6 +55,15 @@ windowAdditions =
|
||||
return if $("head style[path='#{fullPath}']").length
|
||||
$('head').append "<style path='#{fullPath}'>#{content}</style>"
|
||||
|
||||
requireExtension: (name) ->
|
||||
extensionPath = require.resolve name
|
||||
extension = rootView.activateExtension require(extensionPath)
|
||||
|
||||
extensionKeymapPath = fs.join(fs.directory(extensionPath), "keymap.coffee")
|
||||
require extensionKeymapPath if fs.exists(extensionKeymapPath)
|
||||
|
||||
extension
|
||||
|
||||
reload: ->
|
||||
if rootView.getModifiedBuffers().length > 0
|
||||
message = "There are unsaved buffers, reload anyway?"
|
||||
|
||||
1
src/extensions/autocomplete/index.coffee
Normal file
1
src/extensions/autocomplete/index.coffee
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require 'autocomplete/autocomplete.coffee'
|
||||
@@ -4,7 +4,7 @@ PEG = require 'pegjs'
|
||||
module.exports =
|
||||
class CommandInterpreter
|
||||
constructor: ->
|
||||
@parser = PEG.buildParser(fs.read(require.resolve 'command-interpreter/commands.pegjs'))
|
||||
@parser = PEG.buildParser(fs.read(require.resolve 'command-panel/commands.pegjs'))
|
||||
|
||||
eval: (editor, string) ->
|
||||
compositeCommand = @parser.parse(string)
|
||||
@@ -1,7 +1,7 @@
|
||||
{View} = require 'space-pen'
|
||||
CommandInterpreter = require 'command-interpreter'
|
||||
RegexAddress = require 'command-interpreter/regex-address'
|
||||
CompositeCommand = require 'command-interpreter/composite-command'
|
||||
CommandInterpreter = require 'command-panel/command-interpreter'
|
||||
RegexAddress = require 'command-panel/commands/regex-address'
|
||||
CompositeCommand = require 'command-panel/commands/composite-command'
|
||||
Editor = require 'editor'
|
||||
{SyntaxError} = require('pegjs').parser
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
var CompositeCommand = require('command-interpreter/composite-command')
|
||||
var Substitution = require('command-interpreter/substitution');
|
||||
var LineAddress = require('command-interpreter/line-address');
|
||||
var AddressRange = require('command-interpreter/address-range');
|
||||
var EofAddress = require('command-interpreter/eof-address');
|
||||
var CurrentSelectionAddress = require('command-interpreter/current-selection-address')
|
||||
var RegexAddress = require('command-interpreter/regex-address')
|
||||
var SelectAllMatches = require('command-interpreter/select-all-matches')
|
||||
var CompositeCommand = require('command-panel/commands/composite-command')
|
||||
var Substitution = require('command-panel/commands/substitution');
|
||||
var LineAddress = require('command-panel/commands/line-address');
|
||||
var AddressRange = require('command-panel/commands/address-range');
|
||||
var EofAddress = require('command-panel/commands/eof-address');
|
||||
var CurrentSelectionAddress = require('command-panel/commands/current-selection-address')
|
||||
var RegexAddress = require('command-panel/commands/regex-address')
|
||||
var SelectAllMatches = require('command-panel/commands/select-all-matches')
|
||||
}
|
||||
|
||||
start = expressions:(expression+) {
|
||||
@@ -1,4 +1,4 @@
|
||||
Address = require 'command-interpreter/address'
|
||||
Address = require 'command-panel/commands/address'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
@@ -1,4 +1,4 @@
|
||||
Command = require 'command-interpreter/command'
|
||||
Command = require 'command-panel/commands/command'
|
||||
|
||||
module.exports =
|
||||
class Address extends Command
|
||||
@@ -1,4 +1,4 @@
|
||||
Address = require 'command-interpreter/address'
|
||||
Address = require 'command-panel/commands/address'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
@@ -1,4 +1,4 @@
|
||||
Address = require 'command-interpreter/address'
|
||||
Address = require 'command-panel/commands/address'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
@@ -1,4 +1,4 @@
|
||||
Address = require 'command-interpreter/address'
|
||||
Address = require 'command-panel/commands/address'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
@@ -1,4 +1,4 @@
|
||||
Address = require 'command-interpreter/address'
|
||||
Address = require 'command-panel/commands/address'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
@@ -1,4 +1,4 @@
|
||||
Command = require 'command-interpreter/command'
|
||||
Command = require 'command-panel/commands/command'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
@@ -1,4 +1,4 @@
|
||||
Command = require 'command-interpreter/command'
|
||||
Command = require 'command-panel/commands/command'
|
||||
|
||||
module.exports =
|
||||
class Substitution extends Command
|
||||
1
src/extensions/command-panel/index.coffee
Normal file
1
src/extensions/command-panel/index.coffee
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require 'command-panel/command-panel'
|
||||
1
src/extensions/fuzzy-finder/index.coffee
Normal file
1
src/extensions/fuzzy-finder/index.coffee
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require 'fuzzy-finder/fuzzy-finder'
|
||||
@@ -171,7 +171,7 @@ class TreeView extends View
|
||||
newPath = @rootView.project.resolve(newPath)
|
||||
directoryPath = fs.directory(newPath)
|
||||
try
|
||||
fs.makeDirectory(directoryPath) unless fs.exists(directoryPath)
|
||||
fs.makeTree(directoryPath) unless fs.exists(directoryPath)
|
||||
fs.move(oldPath, newPath)
|
||||
catch e
|
||||
dialog.showError("Error: " + e.message + " Try a different path:")
|
||||
@@ -208,15 +208,15 @@ class TreeView extends View
|
||||
endsWithDirectorySeperator = /\/$/.test(relativePath)
|
||||
path = @rootView.project.resolve(relativePath)
|
||||
try
|
||||
if endsWithDirectorySeperator
|
||||
fs.makeDirectory(path)
|
||||
if fs.exists(path)
|
||||
pathType = if fs.isFile(path) then "file" else "directory"
|
||||
dialog.showError("Error: A #{pathType} already exists at path '#{path}'. Try a different path:")
|
||||
false
|
||||
else if endsWithDirectorySeperator
|
||||
fs.makeTree(path)
|
||||
else
|
||||
if fs.exists(path)
|
||||
dialog.showError("Error: A file already exists at path '#{path}'. Try a different path:")
|
||||
false
|
||||
else
|
||||
fs.write(path, "")
|
||||
@rootView.open(path)
|
||||
fs.write(path, "")
|
||||
@rootView.open(path)
|
||||
catch e
|
||||
dialog.showError("Error: " + e.message + " Try a different path:")
|
||||
return false
|
||||
|
||||
@@ -21,7 +21,9 @@ module.exports =
|
||||
# parent directory if the file is a directory. A terminal directory
|
||||
# separator is ignored.
|
||||
directory: (path) ->
|
||||
path.replace(new RegExp("/#{@base(path)}\/?$"), '')
|
||||
parentPath = path.replace(new RegExp("/#{@base(path)}\/?$"), '')
|
||||
return "" if path == parentPath
|
||||
parentPath
|
||||
|
||||
# Returns true if the file specified by path exists
|
||||
exists: (path) ->
|
||||
@@ -75,6 +77,15 @@ module.exports =
|
||||
read: (path) ->
|
||||
$native.read(path)
|
||||
|
||||
# Returns an array of path components. If the path is absolute, the first
|
||||
# component will be an indicator of the root of the file system; for file
|
||||
# systems with drives (such as Windows), this is the drive identifier with a
|
||||
# colon, like "c:"; on Unix, this is an empty string "". The intent is that
|
||||
# calling "join.apply" with the result of "split" as arguments will
|
||||
# reconstruct the path.
|
||||
split: (path) ->
|
||||
path.split("/")
|
||||
|
||||
# Open, write, flush, and close a file, writing the given content.
|
||||
write: (path, content) ->
|
||||
$native.write(path, content)
|
||||
@@ -82,6 +93,14 @@ module.exports =
|
||||
makeDirectory: (path) ->
|
||||
$native.makeDirectory(path)
|
||||
|
||||
# Creates the directory specified by "path" including any missing parent
|
||||
# directories.
|
||||
makeTree: (path) ->
|
||||
return unless path
|
||||
if not @exists(path)
|
||||
@makeTree(@directory(path))
|
||||
@makeDirectory(path)
|
||||
|
||||
traverseTree: (rootPath, fn) ->
|
||||
recurse = null
|
||||
prune = -> recurse = false
|
||||
|
||||
@@ -106,12 +106,15 @@ __exists = (path) ->
|
||||
|
||||
__coffeeCache = (filePath) ->
|
||||
{CoffeeScript} = require 'coffee-script'
|
||||
cacheKey = 'coffee.' + $native.md5ForPath(filePath)
|
||||
if compiled = localStorage.getItem(cacheKey)
|
||||
compiled
|
||||
tmpPath = "/tmp/atom-compiled-scripts"
|
||||
cacheFilePath = [tmpPath, $native.md5ForPath(filePath)].join("/")
|
||||
|
||||
console.log cacheFilePath
|
||||
if __exists(cacheFilePath)
|
||||
__read(cacheFilePath)
|
||||
else
|
||||
compiled = CoffeeScript.compile(__read(filePath), filename: filePath)
|
||||
localStorage.setItem(cacheKey, compiled)
|
||||
$native.write(cacheFilePath, compiled)
|
||||
compiled
|
||||
|
||||
__read = (path) ->
|
||||
|
||||
Reference in New Issue
Block a user