Comparar commits
84 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| a6e59bbbe0 | |||
| d61c015de7 | |||
| 78b4efe1dd | |||
| df79038bcc | |||
| 5a1c6bdf4a | |||
| ba6abea216 | |||
| 1e740d95ab | |||
| 6f5b296471 | |||
| 9a5be7e70c | |||
| 4edb856848 | |||
| 74358f3e79 | |||
| 0ecb46504c | |||
| 474be40154 | |||
| 06f496cd13 | |||
| 27835013fe | |||
| fd593e94be | |||
| 6df60cb29e | |||
| 920ffd91a5 | |||
| 7e194541a0 | |||
| ccf0e6168a | |||
| 8258ec6d45 | |||
| db2e6dd97c | |||
| ce29060d2d | |||
| 7d1c23b561 | |||
| 9e2799db27 | |||
| 040f6deb1e | |||
| 33d2debf5f | |||
| 6de40e21c7 | |||
| 6169caa1fb | |||
| b4e25137a2 | |||
| 05aaace387 | |||
| a32daecf5f | |||
| 6db43d85c4 | |||
| 53e06b8680 | |||
| 9ab2500970 | |||
| 697e70d47c | |||
| ffd1f8520c | |||
| 9132859757 | |||
| 6af2e1649c | |||
| 0962918a82 | |||
| 6b963a562f | |||
| db41b022c2 | |||
| d4084b305b | |||
| b81c1f408f | |||
| 97bdb84122 | |||
| 87e8720269 | |||
| 160c32384c | |||
| 33299ec774 | |||
| d4cc549a01 | |||
| 76a5da8be8 | |||
| 0b0cbe11dc | |||
| 86d730a3a9 | |||
| 99ff482afe | |||
| 84be87324e | |||
| d1ecafc69f | |||
| 235f602002 | |||
| 1ee4240b7e | |||
| a46c4ed30e | |||
| 023b9d18e1 | |||
| 5b992d1397 | |||
| 1ad25f4a56 | |||
| 4baea35c23 | |||
| 63335f6b60 | |||
| f691c20d68 | |||
| 45ca1c6762 | |||
| 528267b7d7 | |||
| 5cdeb7bc18 | |||
| 36d28235fa | |||
| f7ecc3e2a3 | |||
| 89a5469151 | |||
| 77e8f5c9ac | |||
| 1fc597ca22 | |||
| 5c62eb0253 | |||
| c378ef0649 | |||
| 12982027f2 | |||
| 36a9e3f76e | |||
| a9d215970f | |||
| 0daee2c2c2 | |||
| c538857cfa | |||
| 6716e544f0 | |||
| 2f3a9c9e35 | |||
| 3d1baaf3f3 | |||
| b819f681aa | |||
| e30b2f1c73 |
+1
-1
@@ -6,6 +6,6 @@
|
||||
"url": "https://github.com/atom/atom.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"atom-package-manager": "0.123.0"
|
||||
"atom-package-manager": "0.128"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"grunt-peg": "~1.1.0",
|
||||
"grunt-shell": "~0.3.1",
|
||||
"harmony-collections": "~0.3.8",
|
||||
"legal-eagle": "~0.8.0",
|
||||
"legal-eagle": "~0.9.0",
|
||||
"minidump": "~0.8",
|
||||
"npm": "~1.4.5",
|
||||
"rcedit": "~0.3.0",
|
||||
|
||||
@@ -8,14 +8,35 @@ module.exports = (grunt) ->
|
||||
prebuiltConfigurations = [
|
||||
['atom-dark-ui', 'atom-dark-syntax']
|
||||
['atom-dark-ui', 'atom-light-syntax']
|
||||
['atom-dark-ui', 'one-dark-syntax']
|
||||
['atom-dark-ui', 'one-light-syntax']
|
||||
['atom-dark-ui', 'solarized-dark-syntax']
|
||||
['atom-dark-ui', 'base16-tomorrow-dark-theme']
|
||||
['atom-dark-ui', 'base16-tomorrow-light-theme']
|
||||
|
||||
['atom-light-ui', 'atom-light-syntax']
|
||||
['atom-light-ui', 'atom-dark-syntax']
|
||||
['atom-light-ui', 'one-dark-syntax']
|
||||
['atom-light-ui', 'one-light-syntax']
|
||||
['atom-light-ui', 'solarized-dark-syntax']
|
||||
['atom-light-ui', 'base16-tomorrow-dark-theme']
|
||||
['atom-light-ui', 'base16-tomorrow-light-theme']
|
||||
|
||||
['one-dark-ui', 'one-dark-syntax']
|
||||
['one-dark-ui', 'one-light-syntax']
|
||||
['one-dark-ui', 'atom-dark-syntax']
|
||||
['one-dark-ui', 'atom-light-syntax']
|
||||
['one-dark-ui', 'solarized-dark-syntax']
|
||||
['one-dark-ui', 'base16-tomorrow-dark-theme']
|
||||
['one-dark-ui', 'base16-tomorrow-light-theme']
|
||||
|
||||
['one-light-ui', 'one-light-syntax']
|
||||
['one-light-ui', 'one-dark-syntax']
|
||||
['one-light-ui', 'atom-light-syntax']
|
||||
['one-light-ui', 'atom-dark-syntax']
|
||||
['one-light-ui', 'solarized-dark-syntax']
|
||||
['one-light-ui', 'base16-tomorrow-dark-theme']
|
||||
['one-light-ui', 'base16-tomorrow-light-theme']
|
||||
]
|
||||
|
||||
directory = path.join(grunt.config.get('atom.appDir'), 'less-compile-cache')
|
||||
|
||||
@@ -45,7 +45,7 @@ the editor to see it in action!
|
||||
|
||||
[atomio]: https://atom.io
|
||||
[CSS]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
|
||||
[LESS]: http://lesscss.org
|
||||
[Less]: http://lesscss.org
|
||||
[plist]: http://en.wikipedia.org/wiki/Property_list
|
||||
[R]: http://en.wikipedia.org/wiki/R_(programming_language)
|
||||
[TextMate]: http://macromates.com
|
||||
|
||||
@@ -6,7 +6,7 @@ theme.
|
||||
### Differences
|
||||
|
||||
TextMate themes use [plist][plist] files while Atom themes use [CSS][CSS] or
|
||||
[LESS][LESS] to style the UI and syntax in the editor.
|
||||
[Less][Less] to style the UI and syntax in the editor.
|
||||
|
||||
The utility that converts the theme first parses the theme's plist file and
|
||||
then creates comparable CSS rules and properties that will style Atom similarly.
|
||||
@@ -62,7 +62,7 @@ __Syntax Theme__ dropdown menu to enable your new theme.
|
||||
|
||||
[atomio]: https://atom.io
|
||||
[CSS]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
|
||||
[LESS]: http://lesscss.org
|
||||
[Less]: http://lesscss.org
|
||||
[plist]: http://en.wikipedia.org/wiki/Property_list
|
||||
[TextMate]: http://macromates.com
|
||||
[TextMateThemes]: http://wiki.macromates.com/Themes/UserSubmittedThemes
|
||||
|
||||
@@ -123,8 +123,8 @@ like you.
|
||||
|
||||
Style sheets for your package should be placed in the _styles_ directory.
|
||||
Any style sheets in this directory will be loaded and attached to the DOM when
|
||||
your package is activated. Style sheets can be written as CSS or [LESS], but
|
||||
LESS is recommended.
|
||||
your package is activated. Style sheets can be written as CSS or [Less], but
|
||||
Less is recommended.
|
||||
|
||||
Ideally, you won't need much in the way of styling. We've provided a standard
|
||||
set of components which define both the colors and UI elements for any package
|
||||
@@ -418,7 +418,7 @@ all the other available commands.
|
||||
[underscore]: http://underscorejs.org/
|
||||
[jasmine]: http://jasmine.github.io
|
||||
[cson]: https://github.com/atom/season
|
||||
[LESS]: http://lesscss.org
|
||||
[Less]: http://lesscss.org
|
||||
[ui-variables]: https://github.com/atom/atom-dark-ui/blob/master/styles/ui-variables.less
|
||||
[first-package]: your-first-package.html
|
||||
[convert-bundle]: converting-a-text-mate-bundle.html
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Creating a Theme
|
||||
|
||||
Atom's interface is rendered using HTML, and it's styled via [LESS] which is a
|
||||
superset of CSS. Don't worry if you haven't heard of LESS before; it's just like
|
||||
Atom's interface is rendered using HTML, and it's styled via [Less] which is a
|
||||
superset of CSS. Don't worry if you haven't heard of Less before; it's just like
|
||||
CSS, but with a few handy extensions.
|
||||
|
||||
Atom supports two types of themes: _UI_ and _syntax_. UI themes style
|
||||
@@ -17,7 +17,7 @@ section on the left hand side.
|
||||
Themes are pretty straightforward but it's still helpful to be familiar with
|
||||
a few things before starting:
|
||||
|
||||
* LESS is a superset of CSS, but it has some really handy features like
|
||||
* Less is a superset of CSS, but it has some really handy features like
|
||||
variables. If you aren't familiar with its syntax, take a few minutes
|
||||
to [familiarize yourself][less-tutorial].
|
||||
* You may also want to review the concept of a _[package.json]_, too. This file
|
||||
@@ -131,7 +131,7 @@ _styleguide_, or use the shortcut `cmd-ctrl-shift-g`.
|
||||
![styleguide-img]
|
||||
|
||||
[atomio]: http://atom.io/packages
|
||||
[LESS]: http://lesscss.org/
|
||||
[Less]: http://lesscss.org/
|
||||
[git]: http://git-scm.com/
|
||||
[atom]: https://atom.io/
|
||||
[package.json]: ./creating-a-package.html#package-json
|
||||
|
||||
@@ -174,12 +174,12 @@ atom-text-editor.is-focused .cursor {
|
||||
}
|
||||
```
|
||||
|
||||
Unfamiliar with LESS? Read more about it [here][LESS].
|
||||
Unfamiliar with Less? Read more about it [here][Less].
|
||||
|
||||
This file can also be named _styles.css_ and contain CSS.
|
||||
|
||||
[creating-a-package]: creating-a-package.md
|
||||
[create-theme]: creating-a-theme.md
|
||||
[LESS]: http://www.lesscss.org
|
||||
[Less]: http://www.lesscss.org
|
||||
[CSON]: https://github.com/atom/season
|
||||
[CoffeeScript]: http://coffeescript.org/
|
||||
|
||||
@@ -100,6 +100,21 @@ When an error is thrown in Atom, the developer tools are automatically shown wit
|
||||
|
||||
If you can reproduce the error, use this approach to get the full stack trace. The stack trace might point to a problem in your [Init script][init script or stylesheet] or a specific package you installed, which you can then disable and report an issue on its GitHub repository.
|
||||
|
||||
## Check that you have a build toolchain installed
|
||||
|
||||
If you are having issues installing a package using `apm install`, this could be
|
||||
because the package has dependencies on libraries that contain native code
|
||||
and so you will need to have a C++ compiler and Python installed to be able to
|
||||
install it.
|
||||
|
||||
You can run `apm install --check` to see if [apm][apm] can build native code on
|
||||
your machine.
|
||||
|
||||
Check out the pre-requisites in the [build instructions][build-instructions] for
|
||||
your platform for more details.
|
||||
|
||||
[apm]: https://github.com/atom/apm
|
||||
[build-instructions]: https://github.com/atom/atom/tree/master/docs/build-instructions
|
||||
[submitting issues]: https://github.com/atom/atom/blob/master/CONTRIBUTING.md#submitting-issues
|
||||
[building atom]: https://github.com/atom/atom#building
|
||||
[atom releases]: https://github.com/atom/atom/releases
|
||||
|
||||
+18
-14
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "0.175.0",
|
||||
"version": "0.177.0",
|
||||
"description": "A hackable text editor for the 21st Century.",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
@@ -17,7 +17,7 @@
|
||||
"url": "http://github.com/atom/atom/raw/master/LICENSE.md"
|
||||
}
|
||||
],
|
||||
"atomShellVersion": "0.20.5",
|
||||
"atomShellVersion": "0.20.7",
|
||||
"dependencies": {
|
||||
"async": "0.2.6",
|
||||
"atom-keymap": "^2.5.2",
|
||||
@@ -29,7 +29,7 @@
|
||||
"delegato": "^1",
|
||||
"emissary": "^1.3.1",
|
||||
"event-kit": "^1.0.1",
|
||||
"first-mate": "^2.2.4",
|
||||
"first-mate": "^2.2.5",
|
||||
"fs-plus": "^2.3.2",
|
||||
"fstream": "0.1.24",
|
||||
"fuzzaldrin": "^2.1",
|
||||
@@ -39,7 +39,7 @@
|
||||
"jasmine-json": "~0.0",
|
||||
"jasmine-tagged": "^1.1.2",
|
||||
"jquery": "^2.1.1",
|
||||
"less-cache": "0.19.0",
|
||||
"less-cache": "git+https://github.com/atom/less-cache.git#018b1739ae03ee35aae9827d7d7b16d0799c5d42",
|
||||
"marked": "^0.3",
|
||||
"mixto": "^1",
|
||||
"mkdirp": "0.3.5",
|
||||
@@ -56,7 +56,7 @@
|
||||
"scandal": "1.0.3",
|
||||
"scoped-property-store": "^0.16.2",
|
||||
"scrollbar-style": "^1.0.2",
|
||||
"season": "^5.0.5",
|
||||
"season": "^5.1.1",
|
||||
"semver": "2.2.1",
|
||||
"serializable": "^1",
|
||||
"service-hub": "^0.2.0",
|
||||
@@ -75,6 +75,10 @@
|
||||
"atom-light-ui": "0.40.0",
|
||||
"base16-tomorrow-dark-theme": "0.25.0",
|
||||
"base16-tomorrow-light-theme": "0.8.0",
|
||||
"one-dark-ui": "0.2.0",
|
||||
"one-dark-syntax": "0.2.0",
|
||||
"one-light-syntax": "0.2.0",
|
||||
"one-light-ui": "0.1.0",
|
||||
"solarized-dark-syntax": "0.32.0",
|
||||
"solarized-light-syntax": "0.19.0",
|
||||
"archive-view": "0.44.0",
|
||||
@@ -85,38 +89,38 @@
|
||||
"bookmarks": "0.35.0",
|
||||
"bracket-matcher": "0.69.0",
|
||||
"command-palette": "0.34.0",
|
||||
"deprecation-cop": "0.32.0",
|
||||
"deprecation-cop": "0.33.0",
|
||||
"dev-live-reload": "0.39.0",
|
||||
"encoding-selector": "0.17.0",
|
||||
"exception-reporting": "0.21.0",
|
||||
"find-and-replace": "0.156.0",
|
||||
"fuzzy-finder": "0.65.0",
|
||||
"git-diff": "0.49.0",
|
||||
"git-diff": "0.50.0",
|
||||
"go-to-line": "0.30.0",
|
||||
"grammar-selector": "0.44.0",
|
||||
"image-view": "0.47.0",
|
||||
"incompatible-packages": "0.21.0",
|
||||
"keybinding-resolver": "0.27.0",
|
||||
"link": "0.29.0",
|
||||
"markdown-preview": "0.124.0",
|
||||
"markdown-preview": "0.126.0",
|
||||
"metrics": "0.41.0",
|
||||
"notifications": "0.25.0",
|
||||
"notifications": "0.26.0",
|
||||
"open-on-github": "0.32.0",
|
||||
"package-generator": "0.37.0",
|
||||
"release-notes": "0.46.0",
|
||||
"release-notes": "0.47.0",
|
||||
"settings-view": "0.174.0",
|
||||
"snippets": "0.70.0",
|
||||
"spell-check": "0.51.0",
|
||||
"status-bar": "0.57.0",
|
||||
"status-bar": "0.58.0",
|
||||
"styleguide": "0.42.0",
|
||||
"symbols-view": "0.79.0",
|
||||
"tabs": "0.64.0",
|
||||
"timecop": "0.27.0",
|
||||
"tree-view": "0.148.0",
|
||||
"timecop": "0.28.0",
|
||||
"tree-view": "0.149.0",
|
||||
"update-package-dependencies": "0.7.0",
|
||||
"welcome": "0.21.0",
|
||||
"whitespace": "0.28.0",
|
||||
"wrap-guide": "0.30.0",
|
||||
"wrap-guide": "0.31.0",
|
||||
"language-c": "0.37.0",
|
||||
"language-clojure": "0.10.0",
|
||||
"language-coffee-script": "0.39.0",
|
||||
|
||||
+3
-3
@@ -48,9 +48,9 @@ function bootstrap() {
|
||||
var dedupeNpmCommand = npmPath + npmFlags + 'dedupe';
|
||||
|
||||
if (process.argv.indexOf('--no-quiet') === -1) {
|
||||
buildInstallCommand += ' --quiet';
|
||||
apmInstallCommand += ' --quiet';
|
||||
moduleInstallCommand += ' --quiet';
|
||||
buildInstallCommand += ' --loglevel error';
|
||||
apmInstallCommand += ' --loglevel error';
|
||||
moduleInstallCommand += ' --loglevel error';
|
||||
dedupeApmCommand += ' --quiet';
|
||||
dedupeNpmCommand += ' --quiet';
|
||||
buildInstallOptions.ignoreStdout = true;
|
||||
|
||||
@@ -1393,6 +1393,14 @@ describe "Config", ->
|
||||
atom.config.set('foo.bar.aColor', false)
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 255, blue: 255, alpha: 1}
|
||||
|
||||
it "returns a clone of the Color when returned in a parent object", ->
|
||||
color1 = atom.config.get('foo.bar').aColor
|
||||
color2 = atom.config.get('foo.bar').aColor
|
||||
expect(color1.toRGBAString()).toBe 'rgba(255, 255, 255, 1)'
|
||||
expect(color2.toRGBAString()).toBe 'rgba(255, 255, 255, 1)'
|
||||
expect(color1).not.toBe color2
|
||||
expect(color1).toEqual color2
|
||||
|
||||
describe 'when the `enum` key is used', ->
|
||||
beforeEach ->
|
||||
schema =
|
||||
|
||||
@@ -9,5 +9,3 @@ module.exports =
|
||||
two:
|
||||
type: 'integer'
|
||||
default: 2
|
||||
|
||||
activate: -> # no-op
|
||||
|
||||
@@ -213,6 +213,11 @@ jasmine.snapshotDeprecations = ->
|
||||
jasmine.restoreDeprecationsSnapshot = ->
|
||||
Grim.deprecations = deprecationsSnapshot
|
||||
|
||||
jasmine.useRealClock = ->
|
||||
jasmine.unspy(window, 'setTimeout')
|
||||
jasmine.unspy(window, 'clearTimeout')
|
||||
jasmine.unspy(_._, 'now')
|
||||
|
||||
addCustomMatchers = (spec) ->
|
||||
spec.addMatchers
|
||||
toBeInstanceOf: (expected) ->
|
||||
@@ -298,13 +303,13 @@ window.waitsForPromise = (args...) ->
|
||||
window.waitsFor timeout, (moveOn) ->
|
||||
promise = fn()
|
||||
if shouldReject
|
||||
promise.fail(moveOn)
|
||||
promise.done ->
|
||||
promise.catch(moveOn)
|
||||
promise.then ->
|
||||
jasmine.getEnv().currentSpec.fail("Expected promise to be rejected, but it was resolved")
|
||||
moveOn()
|
||||
else
|
||||
promise.done(moveOn)
|
||||
promise.fail (error) ->
|
||||
promise.then(moveOn)
|
||||
promise.catch (error) ->
|
||||
jasmine.getEnv().currentSpec.fail("Expected promise to be resolved, but it was rejected with #{jasmine.pp(error)}")
|
||||
moveOn()
|
||||
|
||||
|
||||
@@ -155,6 +155,25 @@ describe "TextEditor", ->
|
||||
expect(editor2.getSoftTabs()).toBe true
|
||||
expect(editor2.getEncoding()).toBe 'macroman'
|
||||
|
||||
it "uses scoped `core.fileEncoding` values", ->
|
||||
editor1 = null
|
||||
editor2 = null
|
||||
|
||||
atom.config.set('core.fileEncoding', 'utf16le')
|
||||
atom.config.set('core.fileEncoding', 'macroman', scopeSelector: '.js')
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('a').then (o) -> editor1 = o
|
||||
|
||||
runs ->
|
||||
expect(editor1.getEncoding()).toBe 'utf16le'
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('test.js').then (o) -> editor2 = o
|
||||
|
||||
runs ->
|
||||
expect(editor2.getEncoding()).toBe 'macroman'
|
||||
|
||||
describe "title", ->
|
||||
describe ".getTitle()", ->
|
||||
it "uses the basename of the buffer's path as its title, or 'untitled' if the path is undefined", ->
|
||||
@@ -2630,12 +2649,20 @@ describe "TextEditor", ->
|
||||
atom.config.set("editor.autoIndentOnPaste", true)
|
||||
|
||||
describe "when only whitespace precedes the cursor", ->
|
||||
it "auto-indents the lines spanned by the pasted text", ->
|
||||
atom.clipboard.write("console.log(x);\nconsole.log(y);\n")
|
||||
editor.setCursorBufferPosition([5, 2])
|
||||
it "auto-indents the lines spanned by the pasted text, based on the first pasted line", ->
|
||||
expect(editor.indentationForBufferRow(5)).toBe(3)
|
||||
|
||||
atom.clipboard.write("a(x);\n b(x);\n c(x);\n", indentBasis: 0)
|
||||
editor.setCursorBufferPosition([5, 0])
|
||||
editor.pasteText()
|
||||
expect(editor.lineTextForBufferRow(5)).toBe(" console.log(x);")
|
||||
expect(editor.lineTextForBufferRow(6)).toBe(" console.log(y);")
|
||||
|
||||
# Adjust the indentation of the pasted block
|
||||
expect(editor.indentationForBufferRow(5)).toBe(3)
|
||||
expect(editor.indentationForBufferRow(6)).toBe(4)
|
||||
expect(editor.indentationForBufferRow(7)).toBe(5)
|
||||
|
||||
# Preserve the indentation of the next row
|
||||
expect(editor.indentationForBufferRow(8)).toBe(3)
|
||||
|
||||
describe "when non-whitespace characters precede the cursor", ->
|
||||
it "does not auto-indent the first line being pasted", ->
|
||||
@@ -2732,9 +2759,9 @@ describe "TextEditor", ->
|
||||
editor.setSelectedBufferRange([[1, 2], [1, Infinity]])
|
||||
editor.pasteText()
|
||||
expect(editor.lineTextForBufferRow(1)).toBe(" if (items.length <= 1) return items;")
|
||||
expect(editor.lineTextForBufferRow(2)).toBe(" ")
|
||||
expect(editor.lineTextForBufferRow(2)).toBe("")
|
||||
expect(editor.lineTextForBufferRow(3)).toBe(" if (items.length <= 1) return items;")
|
||||
expect(editor.getCursorBufferPosition()).toEqual([2, 2])
|
||||
expect(editor.getCursorBufferPosition()).toEqual([2, 0])
|
||||
|
||||
describe "when there is no selection", ->
|
||||
it "pastes the line above the cursor and retains the cursor's column", ->
|
||||
|
||||
+5
-14
@@ -3,7 +3,6 @@ ipc = require 'ipc'
|
||||
os = require 'os'
|
||||
path = require 'path'
|
||||
remote = require 'remote'
|
||||
screen = require 'screen'
|
||||
shell = require 'shell'
|
||||
|
||||
_ = require 'underscore-plus'
|
||||
@@ -280,8 +279,6 @@ class Atom extends Model
|
||||
deprecate "The atom.syntax global is deprecated. Use atom.grammars instead."
|
||||
@grammars
|
||||
|
||||
@subscribe @packages.onDidActivateInitialPackages => @watchThemes()
|
||||
|
||||
Project = require './project'
|
||||
TextBuffer = require 'text-buffer'
|
||||
@deserializers.add(TextBuffer)
|
||||
@@ -547,6 +544,7 @@ class Atom extends Model
|
||||
if @isValidDimensions(dimensions)
|
||||
dimensions
|
||||
else
|
||||
screen = remote.require 'screen'
|
||||
{width, height} = screen.getPrimaryDisplay().workAreaSize
|
||||
{x: 0, y: 0, width: Math.min(1024, width), height}
|
||||
|
||||
@@ -580,7 +578,10 @@ class Atom extends Model
|
||||
|
||||
@watchProjectPath()
|
||||
|
||||
@packages.activate()
|
||||
@packages.activate().then =>
|
||||
maximize = dimensions?.maximized and process.platform isnt 'darwin'
|
||||
@displayWindow({maximize})
|
||||
|
||||
@keymaps.loadUserKeymap()
|
||||
@requireUserInitScript() unless safeMode
|
||||
|
||||
@@ -589,9 +590,6 @@ class Atom extends Model
|
||||
@setAutoHideMenuBar(newValue)
|
||||
@setAutoHideMenuBar(true) if @config.get('core.autoHideMenuBar')
|
||||
|
||||
maximize = dimensions?.maximized and process.platform isnt 'darwin'
|
||||
@displayWindow({maximize})
|
||||
|
||||
unloadEditorWindow: ->
|
||||
return if not @project
|
||||
|
||||
@@ -720,13 +718,6 @@ class Atom extends Model
|
||||
loadThemes: ->
|
||||
@themes.load()
|
||||
|
||||
watchThemes: ->
|
||||
@themes.onDidChangeActiveThemes =>
|
||||
# Only reload stylesheets from non-theme packages
|
||||
for pack in @packages.getActivePackages() when pack.getType() isnt 'theme'
|
||||
pack.reloadStylesheets?()
|
||||
null
|
||||
|
||||
# Notify the browser project of the window's current project path
|
||||
watchProjectPath: ->
|
||||
onProjectPathChanged = =>
|
||||
|
||||
@@ -10,7 +10,6 @@ module.exports =
|
||||
class AtomWindow
|
||||
_.extend @prototype, EventEmitter.prototype
|
||||
|
||||
@iconPath: path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
|
||||
@includeShellLoadTime: true
|
||||
|
||||
browserWindow: null
|
||||
@@ -26,7 +25,6 @@ class AtomWindow
|
||||
@browserWindow = new BrowserWindow
|
||||
show: false
|
||||
title: 'Atom'
|
||||
icon: @constructor.iconPath
|
||||
'web-preferences':
|
||||
'direct-write': false
|
||||
'subpixel-font-scaling': false
|
||||
|
||||
@@ -13,16 +13,6 @@ process.on 'uncaughtException', (error={}) ->
|
||||
nslog(error.message) if error.message?
|
||||
nslog(error.stack) if error.stack?
|
||||
|
||||
# Patch fs.statSyncNoException/fs.lstatSyncNoException to fail for non-strings
|
||||
# https://github.com/atom/atom-shell/issues/843
|
||||
{lstatSyncNoException, statSyncNoException} = fs
|
||||
fs.statSyncNoException = (pathToStat) ->
|
||||
return false unless pathToStat and typeof pathToStat is 'string'
|
||||
statSyncNoException(pathToStat)
|
||||
fs.lstatSyncNoException = (pathToStat) ->
|
||||
return false unless pathToStat and typeof pathToStat is 'string'
|
||||
lstatSyncNoException(pathToStat)
|
||||
|
||||
start = ->
|
||||
if process.platform is 'win32'
|
||||
SquirrelUpdate = require './squirrel-update'
|
||||
|
||||
@@ -28,22 +28,23 @@ class BufferedProcess
|
||||
# * `options` An {Object} with the following keys:
|
||||
# * `command` The {String} command to execute.
|
||||
# * `args` The {Array} of arguments to pass to the command (optional).
|
||||
# * `options` The options {Object} to pass to Node's `ChildProcess.spawn`
|
||||
# method (optional).
|
||||
# * `stdout` The callback {Function} that receives a single argument which
|
||||
# contains the standard output from the command. The callback is
|
||||
# called as data is received but it's buffered to ensure only
|
||||
# complete lines are passed until the source stream closes. After
|
||||
# the source stream has closed all remaining data is sent in a
|
||||
# final call (optional).
|
||||
# * `stderr` The callback {Function} that receives a single argument which
|
||||
# contains the standard error output from the command. The
|
||||
# callback is called as data is received but it's buffered to
|
||||
# ensure only complete lines are passed until the source stream
|
||||
# closes. After the source stream has closed all remaining data
|
||||
# is sent in a final call (optional).
|
||||
# * `exit` The callback {Function} which receives a single argument
|
||||
# containing the exit status (optional).
|
||||
# * `options` {Object} (optional) The options {Object} to pass to Node's
|
||||
# `ChildProcess.spawn` method.
|
||||
# * `stdout` {Function} (optional) The callback that receives a single
|
||||
# argument which contains the standard output from the command. The
|
||||
# callback is called as data is received but it's buffered to ensure only
|
||||
# complete lines are passed until the source stream closes. After the
|
||||
# source stream has closed all remaining data is sent in a final call.
|
||||
# * `data` {String}
|
||||
# * `stderr` {Function} (optional) The callback that receives a single
|
||||
# argument which contains the standard error output from the command. The
|
||||
# callback is called as data is received but it's buffered to ensure only
|
||||
# complete lines are passed until the source stream closes. After the
|
||||
# source stream has closed all remaining data is sent in a final call.
|
||||
# * `data` {String}
|
||||
# * `exit` {Function} (optional) The callback which receives a single
|
||||
# argument containing the exit status.
|
||||
# * `code` {Number}
|
||||
constructor: ({command, args, options, stdout, stderr, exit}={}) ->
|
||||
@emitter = new Emitter
|
||||
options ?= {}
|
||||
|
||||
@@ -7,6 +7,10 @@ fs = require 'fs-plus'
|
||||
|
||||
cacheDir = path.join(fs.absolute('~/.atom'), 'compile-cache')
|
||||
|
||||
stats =
|
||||
hits: 0
|
||||
misses: 0
|
||||
|
||||
# Use separate compile cache when sudo'ing as root to avoid permission issues
|
||||
if process.env.USER is 'root' and process.env.SUDO_USER and process.env.SUDO_USER isnt process.env.USER
|
||||
cacheDir = path.join(cacheDir, 'root')
|
||||
@@ -21,7 +25,10 @@ getCachePath = (coffee) ->
|
||||
getCachedJavaScript = (cachePath) ->
|
||||
if fs.isFileSync(cachePath)
|
||||
try
|
||||
fs.readFileSync(cachePath, 'utf8')
|
||||
cachedJavaScript = fs.readFileSync(cachePath, 'utf8')
|
||||
stats.hits++
|
||||
return cachedJavaScript
|
||||
return
|
||||
|
||||
convertFilePath = (filePath) ->
|
||||
if process.platform is 'win32'
|
||||
@@ -30,6 +37,7 @@ convertFilePath = (filePath) ->
|
||||
|
||||
compileCoffeeScript = (coffee, filePath, cachePath) ->
|
||||
{js, v3SourceMap} = CoffeeScript.compile(coffee, filename: filePath, sourceMap: true)
|
||||
stats.misses++
|
||||
# Include source map in the web page environment.
|
||||
if btoa? and JSON? and unescape? and encodeURIComponent?
|
||||
js = "#{js}\n//# sourceMappingURL=data:application/json;base64,#{btoa unescape encodeURIComponent v3SourceMap}\n//# sourceURL=#{convertFilePath(filePath)}"
|
||||
@@ -60,3 +68,7 @@ module.exports =
|
||||
compileCoffeeScript(coffee, filePath, cachePath)
|
||||
else if extension is '.cson'
|
||||
CSON.readFileSync(filePath)
|
||||
|
||||
getCacheMisses: -> stats.misses
|
||||
|
||||
getCacheHits: -> stats.hits
|
||||
|
||||
+14
-10
@@ -900,16 +900,10 @@ class Config
|
||||
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
|
||||
|
||||
if value?
|
||||
if value instanceof Color
|
||||
value = value.clone()
|
||||
else
|
||||
value = _.deepClone(value)
|
||||
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
value = @deepClone(value)
|
||||
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
else
|
||||
if defaultValue instanceof Color
|
||||
value = defaultValue.clone()
|
||||
else
|
||||
value = _.deepClone(defaultValue)
|
||||
value = @deepClone(defaultValue)
|
||||
|
||||
value
|
||||
|
||||
@@ -959,6 +953,16 @@ class Config
|
||||
catch e
|
||||
console.warn("'#{keyPath}' could not set the default. Attempted default: #{JSON.stringify(defaults)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")
|
||||
|
||||
deepClone: (object) ->
|
||||
if object instanceof Color
|
||||
object.clone()
|
||||
else if _.isArray(object)
|
||||
object.map (value) => @deepClone(value)
|
||||
else if isPlainObject(object)
|
||||
_.mapObject object, (key, value) => [key, @deepClone(value)]
|
||||
else
|
||||
object
|
||||
|
||||
# `schema` will look something like this
|
||||
#
|
||||
# ```coffee
|
||||
@@ -1164,7 +1168,7 @@ Config.addSchemaEnforcers
|
||||
throw new Error("Validation failed at #{keyPath}, #{JSON.stringify(value)} is not one of #{JSON.stringify(possibleValues)}")
|
||||
|
||||
isPlainObject = (value) ->
|
||||
_.isObject(value) and not _.isArray(value) and not _.isFunction(value) and not _.isString(value)
|
||||
_.isObject(value) and not _.isArray(value) and not _.isFunction(value) and not _.isString(value) and not (value instanceof Color)
|
||||
|
||||
splitKeyPath = (keyPath) ->
|
||||
return [] unless keyPath?
|
||||
|
||||
@@ -30,6 +30,10 @@ class LessCompileCache
|
||||
setImportPaths: (importPaths=[]) ->
|
||||
@cache.setImportPaths(importPaths.concat(@lessSearchPaths))
|
||||
|
||||
clearFooters: -> @cache.clearFooters()
|
||||
|
||||
setFooter: (filePath, footer) -> @cache.setFooter(filePath, footer)
|
||||
|
||||
read: (stylesheetPath) ->
|
||||
@cache.readFileSync(stylesheetPath)
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class PackageManager
|
||||
#
|
||||
# Return a {String} folder path or undefined if it could not be resolved.
|
||||
resolvePackagePath: (name) ->
|
||||
return name if fs.isDirectorySync(name)
|
||||
return fs.absolute(name) if fs.isDirectorySync(name)
|
||||
|
||||
packagePath = fs.resolve(@packageDirPaths..., name)
|
||||
return packagePath if fs.isDirectorySync(packagePath)
|
||||
@@ -376,6 +376,7 @@ class PackageManager
|
||||
packages = @getLoadedPackagesForTypes(types)
|
||||
promises = promises.concat(activator.activatePackages(packages))
|
||||
Q.all(promises).then =>
|
||||
@initialPackageActivationComplete = true
|
||||
@emit 'activated'
|
||||
@emitter.emit 'did-activate-initial-packages'
|
||||
|
||||
|
||||
+21
-7
@@ -9,6 +9,7 @@ EmitterMixin = require('emissary').Emitter
|
||||
Q = require 'q'
|
||||
{deprecate} = require 'grim'
|
||||
|
||||
Color = require './color'
|
||||
ModuleCache = require './module-cache'
|
||||
ScopedProperties = require './scoped-properties'
|
||||
|
||||
@@ -123,7 +124,6 @@ class Package
|
||||
try
|
||||
@loadKeymaps()
|
||||
@loadMenus()
|
||||
@loadStylesheets()
|
||||
@settingsPromise = @loadSettings()
|
||||
@requireMainModule() unless @hasActivationCommands()
|
||||
|
||||
@@ -155,9 +155,8 @@ class Package
|
||||
activateNow: ->
|
||||
try
|
||||
@activateConfig()
|
||||
@activateStylesheets()
|
||||
if @requireMainModule()
|
||||
@mainModule.activate(atom.packages.getPackageState(@name) ? {})
|
||||
@mainModule.activate?(atom.packages.getPackageState(@name) ? {})
|
||||
@mainActivated = true
|
||||
catch e
|
||||
console.warn "Failed to activate package named '#{@name}'", e.stack
|
||||
@@ -185,6 +184,7 @@ class Package
|
||||
@stylesheetDisposables = new CompositeDisposable
|
||||
|
||||
priority = @getStyleSheetPriority()
|
||||
@loadStylesheets()
|
||||
for [sourcePath, source] in @stylesheets
|
||||
if match = path.basename(sourcePath).match(/[^.]*\.([^.]*)\./)
|
||||
context = match[1]
|
||||
@@ -236,8 +236,9 @@ class Package
|
||||
fs.listSync(menusDirPath, ['cson', 'json'])
|
||||
|
||||
loadStylesheets: ->
|
||||
@stylesheets = @getStylesheetPaths().map (stylesheetPath) ->
|
||||
[stylesheetPath, atom.themes.loadStylesheet(stylesheetPath, true)]
|
||||
@stylesheets = @getStylesheetPaths().map (stylesheetPath) =>
|
||||
stylesheet = atom.themes.loadStylesheet(stylesheetPath, {importFallbackVariables: true})
|
||||
[stylesheetPath, stylesheet]
|
||||
|
||||
getStylesheetsPath: ->
|
||||
if fs.isDirectorySync(path.join(@path, 'stylesheets'))
|
||||
@@ -257,6 +258,21 @@ class Package
|
||||
else
|
||||
fs.listSync(stylesheetDirPath, ['css', 'less'])
|
||||
|
||||
getStylesheetFooter: ->
|
||||
return unless @isTheme()
|
||||
|
||||
footer = ''
|
||||
for key, value of atom.config.get(@name)
|
||||
if typeof value is 'object' and not (value instanceof Color)
|
||||
value = Color.parse(value)
|
||||
value = value?.toRGBAString?() ? value
|
||||
switch typeof value
|
||||
when 'string'
|
||||
footer += "\n@#{key}: #{value};" if value
|
||||
when 'number'
|
||||
footer += "\n@#{key}: #{value};" if isFinite(value)
|
||||
footer
|
||||
|
||||
loadGrammarsSync: ->
|
||||
return if @grammarsLoaded
|
||||
|
||||
@@ -352,8 +368,6 @@ class Package
|
||||
@settingsActivated = false
|
||||
|
||||
reloadStylesheets: ->
|
||||
oldSheets = _.clone(@stylesheets)
|
||||
@loadStylesheets()
|
||||
@stylesheetDisposables?.dispose()
|
||||
@stylesheetDisposables = new CompositeDisposable
|
||||
@stylesheetsActivated = false
|
||||
|
||||
@@ -280,7 +280,6 @@ class Project extends Model
|
||||
# Still needed when deserializing a tokenized buffer
|
||||
buildBufferSync: (absoluteFilePath) ->
|
||||
buffer = new TextBuffer({filePath: absoluteFilePath})
|
||||
buffer.setEncoding(atom.config.get('core.fileEncoding'))
|
||||
@addBuffer(buffer)
|
||||
buffer.loadSync()
|
||||
buffer
|
||||
@@ -298,7 +297,6 @@ class Project extends Model
|
||||
throw error
|
||||
|
||||
buffer = new TextBuffer({filePath: absoluteFilePath})
|
||||
buffer.setEncoding(atom.config.get('core.fileEncoding'))
|
||||
@addBuffer(buffer)
|
||||
buffer.load()
|
||||
.then((buffer) -> buffer)
|
||||
|
||||
+14
-8
@@ -362,7 +362,7 @@ class Selection extends Model
|
||||
precedingText = @editor.getTextInRange([[oldBufferRange.start.row, 0], oldBufferRange.start])
|
||||
startLevel = @editor.indentLevelForLine(precedingText)
|
||||
|
||||
if options.indentBasis? and not options.autoIndent
|
||||
if options.indentBasis?
|
||||
text = @adjustIndent(text, startLevel - options.indentBasis)
|
||||
|
||||
newBufferRange = @editor.buffer.setTextInRange(oldBufferRange, text, pick(options, 'undo', 'normalizeLineEndings'))
|
||||
@@ -375,8 +375,16 @@ class Selection extends Model
|
||||
if options.autoIndent
|
||||
precedingText = @editor.getTextInBufferRange([[newBufferRange.start.row, 0], newBufferRange.start])
|
||||
unless NonWhitespaceRegExp.test(precedingText)
|
||||
@editor.autoIndentBufferRow(newBufferRange.getRows()[0])
|
||||
@editor.autoIndentBufferRow(row) for row, i in newBufferRange.getRows() when i > 0
|
||||
rowsToIndent = newBufferRange.getRows()
|
||||
firstRow = rowsToIndent.shift()
|
||||
rowsToIndent.pop() if text.endsWith("\n")
|
||||
suggestedIndent = @editor.suggestedIndentForBufferRow(firstRow)
|
||||
actualIndent = @editor.indentationForBufferRow(firstRow)
|
||||
@editor.setIndentationForBufferRow(firstRow, suggestedIndent)
|
||||
indentChange = suggestedIndent - actualIndent
|
||||
for row in rowsToIndent
|
||||
newIndent = @editor.indentationForBufferRow(row) + indentChange
|
||||
@editor.setIndentationForBufferRow(row, newIndent)
|
||||
else if options.autoIndentNewline and text == '\n'
|
||||
currentIndentation = @editor.indentationForBufferRow(newBufferRange.start.row)
|
||||
@editor.autoIndentBufferRow(newBufferRange.end.row, preserveLeadingWhitespace: true, skipBlankLines: false)
|
||||
@@ -595,14 +603,12 @@ class Selection extends Model
|
||||
@editor.createFold(range.start.row, range.end.row)
|
||||
@cursor.setBufferPosition([range.end.row + 1, 0])
|
||||
|
||||
# Public: Increases the indentation level of
|
||||
#
|
||||
|
||||
# * `indentIncrease` The beginning indent level.
|
||||
# Private: Increase the indentation level of the given text by given number
|
||||
# of levels. Leaves the first line unchanged.
|
||||
adjustIndent: (text, indentIncrease) ->
|
||||
lines = text.split('\n')
|
||||
for line, i in lines when i > 0
|
||||
if indentIncrease == 0
|
||||
if indentIncrease == 0 or line is ''
|
||||
continue
|
||||
else if indentIncrease > 0
|
||||
lines[i] = @editor.buildIndentString(indentIncrease) + line
|
||||
|
||||
@@ -224,7 +224,7 @@ TextEditorComponent = React.createClass
|
||||
@props.editor.setVisible(true)
|
||||
@performedInitialMeasurement = true
|
||||
@updatesPaused = false
|
||||
@forceUpdate() if @updateRequestedWhilePaused and @canUpdate()
|
||||
@forceUpdate() if @canUpdate()
|
||||
|
||||
requestUpdate: ->
|
||||
return unless @canUpdate()
|
||||
|
||||
@@ -105,6 +105,8 @@ class TextEditor extends Model
|
||||
|
||||
@languageMode = new LanguageMode(this)
|
||||
|
||||
@setEncoding(atom.config.get('core.fileEncoding', scope: @getRootScopeDescriptor()))
|
||||
|
||||
@subscribe @$scrollTop, (scrollTop) =>
|
||||
@emit 'scroll-top-changed', scrollTop
|
||||
@emitter.emit 'did-change-scroll-top', scrollTop
|
||||
|
||||
+68
-28
@@ -197,7 +197,7 @@ class ThemeManager
|
||||
]
|
||||
themeNames = _.intersection(themeNames, builtInThemeNames)
|
||||
if themeNames.length is 0
|
||||
themeNames = ['atom-dark-syntax', 'atom-dark-ui']
|
||||
themeNames = ['atom-dark-ui', 'atom-dark-syntax']
|
||||
else if themeNames.length is 1
|
||||
if _.endsWith(themeNames[0], '-ui')
|
||||
themeNames.unshift('atom-dark-syntax')
|
||||
@@ -266,7 +266,7 @@ class ThemeManager
|
||||
"""
|
||||
atom.notifications.addError(message, dismissable: true)
|
||||
|
||||
userStylesheetContents = @loadStylesheet(userStylesheetPath, true)
|
||||
userStylesheetContents = @loadStylesheet(userStylesheetPath, importFallbackVariables: true)
|
||||
@userStyleSheetDisposable = atom.styles.addStyleSheet(userStylesheetContents, sourcePath: userStylesheetPath, priority: 2)
|
||||
|
||||
loadBaseStylesheets: ->
|
||||
@@ -287,16 +287,14 @@ class ThemeManager
|
||||
else
|
||||
fs.resolveOnLoadPath(stylesheetPath, ['css', 'less'])
|
||||
|
||||
loadStylesheet: (stylesheetPath, importFallbackVariables) ->
|
||||
loadStylesheet: (stylesheetPath, options) ->
|
||||
if path.extname(stylesheetPath) is '.less'
|
||||
@loadLessStylesheet(stylesheetPath, importFallbackVariables)
|
||||
@loadLessStylesheet(stylesheetPath, options)
|
||||
else
|
||||
fs.readFileSync(stylesheetPath, 'utf8')
|
||||
|
||||
loadLessStylesheet: (lessStylesheetPath, importFallbackVariables=false) ->
|
||||
unless @lessCache?
|
||||
LessCompileCache = require './less-compile-cache'
|
||||
@lessCache = new LessCompileCache({@resourcePath, importPaths: @getImportPaths()})
|
||||
loadLessStylesheet: (lessStylesheetPath, {variables, importFallbackVariables}={}) ->
|
||||
@createLessCache()
|
||||
|
||||
try
|
||||
if importFallbackVariables
|
||||
@@ -335,26 +333,7 @@ class ThemeManager
|
||||
|
||||
# atom.config.observe runs the callback once, then on subsequent changes.
|
||||
atom.config.observe 'core.themes', =>
|
||||
@deactivateThemes()
|
||||
|
||||
@refreshLessCache() # Update cache for packages in core.themes config
|
||||
|
||||
promises = []
|
||||
for themeName in @getEnabledThemeNames()
|
||||
if @packageManager.resolvePackagePath(themeName)
|
||||
promises.push(@packageManager.activatePackage(themeName))
|
||||
else
|
||||
console.warn("Failed to activate theme '#{themeName}' because it isn't installed.")
|
||||
|
||||
Q.all(promises).then =>
|
||||
@addActiveThemeClasses()
|
||||
@refreshLessCache() # Update cache again now that @getActiveThemes() is populated
|
||||
@loadUserStylesheet()
|
||||
@reloadBaseStylesheets()
|
||||
@initialLoadComplete = true
|
||||
@emit 'reloaded'
|
||||
@emitter.emit 'did-change-active-themes'
|
||||
deferred.resolve()
|
||||
@reloadStylesheets -> deferred.resolve()
|
||||
|
||||
deferred.promise
|
||||
|
||||
@@ -364,6 +343,44 @@ class ThemeManager
|
||||
@packageManager.deactivatePackage(pack.name) for pack in @getActiveThemes()
|
||||
null
|
||||
|
||||
reloadPackageStylesheets: ->
|
||||
for pack in @packageManager.getActivePackages()
|
||||
pack.reloadStylesheets() if pack.getType() isnt 'theme'
|
||||
|
||||
reloadStylesheets: (callback) ->
|
||||
@deactivateThemes()
|
||||
|
||||
@refreshLessCache() # Update cache for packages in core.themes config
|
||||
@lessCache?.clearFooters()
|
||||
|
||||
loadedThemes = []
|
||||
for themeName in @getEnabledThemeNames()
|
||||
unless @packageManager.resolvePackagePath(themeName)
|
||||
console.warn("Failed to activate theme '#{themeName}' because it isn't installed.")
|
||||
continue
|
||||
|
||||
if theme = @packageManager.loadPackage(themeName)
|
||||
@setFooterForTheme(theme)
|
||||
loadedThemes.push(theme)
|
||||
|
||||
promises = []
|
||||
for theme in loadedThemes
|
||||
promises.push(@packageManager.activatePackage(theme.name))
|
||||
|
||||
Q.all(promises).then =>
|
||||
@addActiveThemeClasses()
|
||||
@refreshLessCache() # Update cache again now that @getActiveThemes() is populated
|
||||
@loadUserStylesheet()
|
||||
@reloadBaseStylesheets()
|
||||
if @packageManager.initialPackageActivationComplete
|
||||
@reloadPackageStylesheets()
|
||||
else
|
||||
@packageManager.onDidActivateInitialPackages => @reloadPackageStylesheets()
|
||||
@initialLoadComplete = true
|
||||
@emit 'reloaded'
|
||||
@emitter.emit 'did-change-active-themes'
|
||||
callback?()
|
||||
|
||||
isInitialLoadComplete: -> @initialLoadComplete
|
||||
|
||||
addActiveThemeClasses: ->
|
||||
@@ -378,9 +395,32 @@ class ThemeManager
|
||||
workspaceElement.classList.remove("theme-#{pack.name}")
|
||||
return
|
||||
|
||||
createLessCache: ->
|
||||
unless @lessCache?
|
||||
LessCompileCache = require './less-compile-cache'
|
||||
@lessCache = new LessCompileCache({@resourcePath, importPaths: @getImportPaths()})
|
||||
@lessCache
|
||||
|
||||
refreshLessCache: ->
|
||||
@lessCache?.setImportPaths(@getImportPaths())
|
||||
|
||||
setFooterForTheme: (theme) ->
|
||||
footer = theme.getStylesheetFooter()
|
||||
return unless footer
|
||||
|
||||
stylesheetPaths = []
|
||||
try
|
||||
stylesheetPaths = theme.getStylesheetPaths()
|
||||
|
||||
try
|
||||
stylesPath = path.join(theme.path, 'styles')
|
||||
stylesheetPaths = stylesheetPaths.concat(fs.listSync(stylesPath, ['less']))
|
||||
|
||||
for stylesheetPath in stylesheetPaths
|
||||
@createLessCache().setFooter(stylesheetPath, footer)
|
||||
|
||||
return
|
||||
|
||||
getImportPaths: ->
|
||||
activeThemes = @getActiveThemes()
|
||||
if activeThemes.length > 0
|
||||
|
||||
@@ -21,12 +21,21 @@ class ThemePackage extends Package
|
||||
console.warn "Failed to load theme named '#{@name}'", error.stack ? error
|
||||
this
|
||||
|
||||
watchThemeConfig: ->
|
||||
@configDisposable = atom.config.onDidChange @name, =>
|
||||
atom.themes.reloadStylesheets()
|
||||
|
||||
activate: ->
|
||||
return @activationDeferred.promise if @activationDeferred?
|
||||
|
||||
@activationDeferred = Q.defer()
|
||||
@measure 'activateTime', =>
|
||||
@loadStylesheets()
|
||||
@activateNow()
|
||||
@reloadStylesheets()
|
||||
@watchThemeConfig()
|
||||
|
||||
@activationDeferred.promise
|
||||
|
||||
deactivate: ->
|
||||
@configDisposable?.dispose()
|
||||
super
|
||||
|
||||
@@ -5,23 +5,6 @@ window.onload = function() {
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
// Patch fs.statSyncNoException/fs.lstatSyncNoException to fail for non-strings
|
||||
// https://github.com/atom/atom-shell/issues/843
|
||||
var statSyncNoException = fs.statSyncNoException;
|
||||
var lstatSyncNoException = fs.lstatSyncNoException;
|
||||
fs.statSyncNoException = function(pathToStat) {
|
||||
if (pathToStat && typeof pathToStat === 'string')
|
||||
return statSyncNoException(pathToStat);
|
||||
else
|
||||
return false;
|
||||
};
|
||||
fs.lstatSyncNoException = function(pathToStat) {
|
||||
if (pathToStat && typeof pathToStat === 'string')
|
||||
return lstatSyncNoException(pathToStat);
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
// Skip "?loadSettings=".
|
||||
var rawLoadSettings = decodeURIComponent(location.search.substr(14));
|
||||
var loadSettings;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário