Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into wl-rm-safe-clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
50Wliu committed Jan 10, 2018
2 parents d59b779 + 26df68c commit cd84216
Show file tree
Hide file tree
Showing 57 changed files with 5,019 additions and 2,193 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -65,7 +65,7 @@ Atom is intentionally very modular. Nearly every non-editor UI element you inter

![atom-packages](https://cloud.githubusercontent.com/assets/69169/10472281/84fc9792-71d3-11e5-9fd1-19da717df079.png)

To get a sense for the packages that are bundled with Atom, you can go to Settings > Packages within Atom and take a look at the Core Packages section.
To get a sense for the packages that are bundled with Atom, you can go to `Settings` > `Packages` within Atom and take a look at the Core Packages section.

Here's a list of the big ones:

Expand All @@ -80,8 +80,8 @@ Here's a list of the big ones:
* [autocomplete-plus](https://github.com/atom/autocomplete-plus) - autocompletions shown while typing. Some languages have additional packages for autocompletion functionality, such as [autocomplete-html](https://github.com/atom/autocomplete-html).
* [git-diff](https://github.com/atom/git-diff) - Git change indicators shown in the editor's gutter.
* [language-javascript](https://github.com/atom/language-javascript) - all bundled languages are packages too, and each one has a separate package `language-[name]`. Use these for feedback on syntax highlighting issues that only appear for a specific language.
* [one-dark-ui](https://github.com/atom/one-dark-ui) - the default UI styling for anything but the text editor. UI theme packages (i.e. packages with a `-ui` suffix) provide only styling and it's possible that a bundled package is responsible for a UI issue. There are other other bundled UI themes, such as [one-light-ui](https://github.com/atom/one-light-ui).
* [one-dark-syntax](https://github.com/atom/one-dark-syntax) - the default syntax highlighting styles applied for all languages. There are other other bundled syntax themes, such as [solarized-dark-syntax](https://github.com/atom/solarized-dark-syntax). You should use these packages for reporting issues that appear in many languages, but disappear if you change to another syntax theme.
* [one-dark-ui](https://github.com/atom/one-dark-ui) - the default UI styling for anything but the text editor. UI theme packages (i.e. packages with a `-ui` suffix) provide only styling and it's possible that a bundled package is responsible for a UI issue. There are other bundled UI themes, such as [one-light-ui](https://github.com/atom/one-light-ui).
* [one-dark-syntax](https://github.com/atom/one-dark-syntax) - the default syntax highlighting styles applied for all languages. There are other bundled syntax themes, such as [solarized-dark-syntax](https://github.com/atom/solarized-dark-syntax). You should use these packages for reporting issues that appear in many languages, but disappear if you change to another syntax theme.
* [apm](https://github.com/atom/apm) - the `apm` command line tool (Atom Package Manager). You should use this repository for any contributions related to the `apm` tool and to publishing packages.
* [atom.io](https://github.com/atom/atom.io) - the repository for feedback on the [Atom.io website](https://atom.io) and the [Atom.io package API](https://github.com/atom/atom/blob/master/docs/apm-rest-api.md) used by [apm](https://github.com/atom/apm).

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,4 +1,4 @@
Copyright (c) 2011-2017 GitHub Inc.
Copyright (c) 2011-2018 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
14 changes: 14 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Expand Up @@ -27,6 +27,20 @@ We must be able to understand the design of your change from this description. I

<!-- What are the possible side-effects or negative impacts of the code change? -->

### Verification Process

<!--
What process did you follow to verify that your change has the desired effects?
- How did you verify that all new functionality works as expected?
- How did you verify that all changed functionality works as expected?
- How did you verify that the change has not introduced any regressions?
Describe the actions you performed (e.g., buttons you clicked, text you typed, commands you ran, etc.), and describe the results you observed.
-->

### Applicable Issues

<!-- Enter any applicable Issues here -->
2 changes: 2 additions & 0 deletions keymaps/darwin.cson
Expand Up @@ -133,6 +133,8 @@
'cmd-ctrl-left': 'editor:move-selection-left'
'cmd-ctrl-right': 'editor:move-selection-right'
'cmd-shift-V': 'editor:paste-without-reformatting'
'alt-up': 'editor:select-larger-syntax-node'
'alt-down': 'editor:select-smaller-syntax-node'

# Emacs
'alt-f': 'editor:move-to-end-of-word'
Expand Down
21 changes: 11 additions & 10 deletions package.json
Expand Up @@ -70,7 +70,8 @@
"service-hub": "^0.7.4",
"sinon": "1.17.4",
"temp": "^0.8.3",
"text-buffer": "13.10.1",
"text-buffer": "13.11.0",
"tree-sitter": "^0.8.4",
"typescript-simple": "1.0.0",
"underscore-plus": "^1.6.6",
"winreg": "^1.2.1",
Expand Down Expand Up @@ -118,13 +119,13 @@
"keybinding-resolver": "0.38.1",
"line-ending-selector": "0.7.5",
"link": "0.31.4",
"markdown-preview": "0.159.18",
"markdown-preview": "0.159.20",
"metrics": "1.2.6",
"notifications": "0.70.2",
"open-on-github": "1.3.1",
"package-generator": "1.3.0",
"settings-view": "0.253.2",
"snippets": "1.2.0",
"settings-view": "0.253.4",
"snippets": "1.3.0",
"spell-check": "0.72.5",
"status-bar": "1.8.15",
"styleguide": "0.49.10",
Expand All @@ -136,18 +137,18 @@
"welcome": "0.36.6",
"whitespace": "0.37.5",
"wrap-guide": "0.40.3",
"language-c": "0.58.1",
"language-c": "0.59.0",
"language-clojure": "0.22.5",
"language-coffee-script": "0.49.3",
"language-csharp": "0.14.4",
"language-css": "0.42.8",
"language-gfm": "0.90.3",
"language-git": "0.19.1",
"language-go": "0.44.4",
"language-go": "0.45.0",
"language-html": "0.48.5",
"language-hyperlink": "0.16.3",
"language-java": "0.27.6",
"language-javascript": "0.127.7",
"language-javascript": "0.128.0",
"language-json": "0.19.1",
"language-less": "0.34.1",
"language-make": "0.22.3",
Expand All @@ -156,17 +157,17 @@
"language-perl": "0.38.1",
"language-php": "0.43.0",
"language-property-list": "0.9.1",
"language-python": "0.45.6",
"language-python": "0.47.0",
"language-ruby": "0.71.4",
"language-ruby-on-rails": "0.25.3",
"language-sass": "0.61.4",
"language-shellscript": "0.25.4",
"language-shellscript": "0.26.0",
"language-source": "0.9.0",
"language-sql": "0.25.9",
"language-text": "0.7.3",
"language-todo": "0.29.3",
"language-toml": "0.18.1",
"language-typescript": "0.2.3",
"language-typescript": "0.3.0",
"language-xml": "0.35.2",
"language-yaml": "0.31.1"
},
Expand Down
2 changes: 2 additions & 0 deletions script/build
Expand Up @@ -28,6 +28,7 @@ const argv = yargs

const checkChromedriverVersion = require('./lib/check-chromedriver-version')
const cleanOutputDirectory = require('./lib/clean-output-directory')
const cleanPackageLock = require('./lib/clean-package-lock')
const codeSignOnMac = require('./lib/code-sign-on-mac')
const codeSignOnWindows = require('./lib/code-sign-on-windows')
const compressArtifacts = require('./lib/compress-artifacts')
Expand Down Expand Up @@ -58,6 +59,7 @@ const CONFIG = require('./config')
let binariesPromise = Promise.resolve()

if (!argv.existingBinaries) {
cleanPackageLock()
checkChromedriverVersion()
cleanOutputDirectory()
copyAssets()
Expand Down
18 changes: 18 additions & 0 deletions script/lib/clean-package-lock.js
@@ -0,0 +1,18 @@
// This module exports a function that deletes all `package-lock.json` files that do
// not exist under a `node_modules` directory.

'use strict'

const CONFIG = require('../config')
const fs = require('fs-extra')
const glob = require('glob')
const path = require('path')

module.exports = function () {
console.log('Deleting problematic package-lock.json files')
let paths = glob.sync(path.join(CONFIG.repositoryRootPath, '**', 'package-lock.json'), {ignore: path.join('**', 'node_modules', '**')})

for (let path of paths) {
fs.unlinkSync(path)
}
}
4 changes: 3 additions & 1 deletion script/lib/generate-startup-snapshot.js
Expand Up @@ -57,7 +57,9 @@ module.exports = function (packagedAppPath) {
relativePath === path.join('..', 'node_modules', 'spelling-manager', 'node_modules', 'natural', 'lib', 'natural', 'index.js') ||
relativePath === path.join('..', 'node_modules', 'tar', 'tar.js') ||
relativePath === path.join('..', 'node_modules', 'temp', 'lib', 'temp.js') ||
relativePath === path.join('..', 'node_modules', 'tmp', 'lib', 'tmp.js')
relativePath === path.join('..', 'node_modules', 'tmp', 'lib', 'tmp.js') ||
relativePath === path.join('..', 'node_modules', 'tree-sitter', 'index.js') ||
relativePath === path.join('..', 'node_modules', 'winreg', 'lib', 'registry.js')
)
}
}).then((snapshotScript) => {
Expand Down
16 changes: 10 additions & 6 deletions spec/atom-environment-spec.js
@@ -1,4 +1,4 @@
const {it, fit, ffit, fffit, beforeEach, afterEach} = require('./async-spec-helpers')
const {it, fit, ffit, beforeEach, afterEach, conditionPromise} = require('./async-spec-helpers')
const _ = require('underscore-plus')
const path = require('path')
const temp = require('temp').track()
Expand Down Expand Up @@ -518,27 +518,31 @@ describe('AtomEnvironment', () => {
})
})

it('prompts the user to restore the state in a new window, discarding it and adding folder to current window', () => {
spyOn(atom, 'confirm').andReturn(1)
it('prompts the user to restore the state in a new window, discarding it and adding folder to current window', async () => {
jasmine.useRealClock()
spyOn(atom, 'confirm').andCallFake((options, callback) => callback(1))
spyOn(atom.project, 'addPath')
spyOn(atom.workspace, 'open')
const state = Symbol()

atom.attemptRestoreProjectStateForPaths(state, [__dirname], [__filename])
expect(atom.confirm).toHaveBeenCalled()
expect(atom.project.addPath.callCount).toBe(1)
await conditionPromise(() => atom.project.addPath.callCount === 1)

expect(atom.project.addPath).toHaveBeenCalledWith(__dirname)
expect(atom.workspace.open.callCount).toBe(1)
expect(atom.workspace.open).toHaveBeenCalledWith(__filename)
})

it('prompts the user to restore the state in a new window, opening a new window', () => {
spyOn(atom, 'confirm').andReturn(0)
it('prompts the user to restore the state in a new window, opening a new window', async () => {
jasmine.useRealClock()
spyOn(atom, 'confirm').andCallFake((options, callback) => callback(0))
spyOn(atom, 'open')
const state = Symbol()

atom.attemptRestoreProjectStateForPaths(state, [__dirname], [__filename])
expect(atom.confirm).toHaveBeenCalled()
await conditionPromise(() => atom.open.callCount === 1)
expect(atom.open).toHaveBeenCalledWith({
pathsToOpen: [__dirname, __filename],
newWindow: true,
Expand Down
12 changes: 6 additions & 6 deletions spec/command-installer-spec.js
Expand Up @@ -35,9 +35,9 @@ describe('CommandInstaller on #darwin', () => {

installer.installShellCommandsInteractively()

expect(appDelegate.confirm).toHaveBeenCalledWith({
expect(appDelegate.confirm.mostRecentCall.args[0]).toEqual({
message: 'Failed to install shell commands',
detailedMessage: 'an error'
detail: 'an error'
})

appDelegate.confirm.reset()
Expand All @@ -46,9 +46,9 @@ describe('CommandInstaller on #darwin', () => {

installer.installShellCommandsInteractively()

expect(appDelegate.confirm).toHaveBeenCalledWith({
expect(appDelegate.confirm.mostRecentCall.args[0]).toEqual({
message: 'Failed to install shell commands',
detailedMessage: 'another error'
detail: 'another error'
})
})

Expand All @@ -61,9 +61,9 @@ describe('CommandInstaller on #darwin', () => {

installer.installShellCommandsInteractively()

expect(appDelegate.confirm).toHaveBeenCalledWith({
expect(appDelegate.confirm.mostRecentCall.args[0]).toEqual({
message: 'Commands installed.',
detailedMessage: 'The shell commands `atom` and `apm` are installed.'
detail: 'The shell commands `atom` and `apm` are installed.'
})
})

Expand Down
38 changes: 34 additions & 4 deletions spec/command-registry-spec.js
@@ -1,5 +1,6 @@
const CommandRegistry = require('../src/command-registry');
const _ = require('underscore-plus');
const {it, fit, ffit, fffit, beforeEach, afterEach} = require('./async-spec-helpers');

describe("CommandRegistry", () => {
let registry, parent, child, grandchild;
Expand Down Expand Up @@ -357,12 +358,41 @@ describe("CommandRegistry", () => {
expect(called).toBe(true);
});

it("returns a boolean indicating whether any listeners matched the command", () => {
it("returns a promise if any listeners matched the command", () => {
registry.add('.grandchild', 'command', () => {});

expect(registry.dispatch(grandchild, 'command')).toBe(true);
expect(registry.dispatch(grandchild, 'bogus')).toBe(false);
expect(registry.dispatch(parent, 'command')).toBe(false);
expect(registry.dispatch(grandchild, 'command').constructor.name).toBe("Promise");
expect(registry.dispatch(grandchild, 'bogus')).toBe(null);
expect(registry.dispatch(parent, 'command')).toBe(null);
});

it("returns a promise that resolves when the listeners resolve", async () => {
jasmine.useRealClock();
registry.add('.grandchild', 'command', () => 1);
registry.add('.grandchild', 'command', () => Promise.resolve(2));
registry.add('.grandchild', 'command', () => new Promise((resolve) => {
setTimeout(() => { resolve(3); }, 1);
}));

const values = await registry.dispatch(grandchild, 'command');
expect(values).toEqual([3, 2, 1]);
});

it("returns a promise that rejects when a listener is rejected", async () => {
jasmine.useRealClock();
registry.add('.grandchild', 'command', () => 1);
registry.add('.grandchild', 'command', () => Promise.resolve(2));
registry.add('.grandchild', 'command', () => new Promise((resolve, reject) => {
setTimeout(() => { reject(3); }, 1);
}));

let value;
try {
value = await registry.dispatch(grandchild, 'command');
} catch (err) {
value = err;
}
expect(value).toBe(3);
});
});

Expand Down
23 changes: 23 additions & 0 deletions spec/config-spec.coffee
Expand Up @@ -106,6 +106,15 @@ describe "Config", ->
atom.config.set("foo.bar.baz", 1, scopeSelector: ".source.coffee", source: "some-package")
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee"])).toBe 100

describe "when the first component of the scope descriptor matches a legacy scope alias", ->
it "falls back to properties defined for the legacy scope if no value is found for the original scope descriptor", ->
atom.config.addLegacyScopeAlias('javascript', '.source.js')
atom.config.set('foo', 100, scopeSelector: '.source.js')
atom.config.set('foo', 200, scopeSelector: 'javascript for_statement')

expect(atom.config.get('foo', scope: ['javascript', 'for_statement', 'identifier'])).toBe(200)
expect(atom.config.get('foo', scope: ['javascript', 'function', 'identifier'])).toBe(100)

describe ".getAll(keyPath, {scope, sources, excludeSources})", ->
it "reads all of the values for a given key-path", ->
expect(atom.config.set("foo", 41)).toBe true
Expand All @@ -130,6 +139,20 @@ describe "Config", ->
{scopeSelector: '*', value: 40}
]

describe "when the first component of the scope descriptor matches a legacy scope alias", ->
it "includes the values defined for the legacy scope", ->
atom.config.addLegacyScopeAlias('javascript', '.source.js')

expect(atom.config.set('foo', 41)).toBe true
expect(atom.config.set('foo', 42, scopeSelector: 'javascript')).toBe true
expect(atom.config.set('foo', 43, scopeSelector: '.source.js')).toBe true

expect(atom.config.getAll('foo', scope: ['javascript'])).toEqual([
{scopeSelector: 'javascript', value: 42},
{scopeSelector: '.js.source', value: 43},
{scopeSelector: '*', value: 41}
])

describe ".set(keyPath, value, {source, scopeSelector})", ->
it "allows a key path's value to be written", ->
expect(atom.config.set("foo.bar.baz", 42)).toBe true
Expand Down
@@ -0,0 +1 @@
exports.isFakeTreeSitterParser = true
@@ -0,0 +1,14 @@
name: 'Some Language'

id: 'some-language'

type: 'tree-sitter'

parser: './fake-parser'

fileTypes: [
'somelang'
]

scopes:
'class > identifier': 'entity.name.type.class'

0 comments on commit cd84216

Please sign in to comment.