mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Merge remote-tracking branch 'origin/master' into wl-async-context-menu
This commit is contained in:
@@ -114,4 +114,4 @@
|
||||
| [TODO](https://github.com/atom/language-todo) | [](https://travis-ci.org/atom/language-todo) | [](https://ci.appveyor.com/project/Atom/language-todo/branch/master) |
|
||||
| [TOML](https://github.com/atom/language-toml) | [](https://travis-ci.org/atom/language-toml) | [](https://ci.appveyor.com/project/Atom/language-toml/branch/master) |
|
||||
| [XML](https://github.com/atom/language-xml) | [](https://travis-ci.org/atom/language-xml) | [](https://ci.appveyor.com/project/Atom/language-xml/branch/master) |
|
||||
| [YAML](https://github/atom/language-yaml) | [](https://travis-ci.org/atom/language-yaml) | [](https://ci.appveyor.com/project/Atom/language-yaml/branch/master) |
|
||||
| [YAML](https://github.com/atom/language-yaml) | [](https://travis-ci.org/atom/language-yaml) | [](https://ci.appveyor.com/project/Atom/language-yaml/branch/master) |
|
||||
|
||||
@@ -1 +1 @@
|
||||
See the [Hacking on Atom Core](http://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-linux) section in the [Atom Flight Manual](http://flight-manual.atom.io).
|
||||
See the [Hacking on Atom Core](https://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-linux) section in the [Atom Flight Manual](https://flight-manual.atom.io).
|
||||
|
||||
@@ -1 +1 @@
|
||||
See the [Hacking on Atom Core](http://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-mac) section in the [Atom Flight Manual](http://flight-manual.atom.io).
|
||||
See the [Hacking on Atom Core](https://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-mac) section in the [Atom Flight Manual](https://flight-manual.atom.io).
|
||||
|
||||
@@ -1 +1 @@
|
||||
See the [Hacking on Atom Core](http://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-windows) section in the [Atom Flight Manual](http://flight-manual.atom.io).
|
||||
See the [Hacking on Atom Core](https://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-windows) section in the [Atom Flight Manual](https://flight-manual.atom.io).
|
||||
|
||||
@@ -1 +1 @@
|
||||
See http://flight-manual.atom.io/hacking-atom/sections/contributing-to-official-atom-packages/
|
||||
See https://flight-manual.atom.io/hacking-atom/sections/contributing-to-official-atom-packages/
|
||||
|
||||
10
package.json
10
package.json
@@ -70,7 +70,7 @@
|
||||
"service-hub": "^0.7.4",
|
||||
"sinon": "1.17.4",
|
||||
"temp": "^0.8.3",
|
||||
"text-buffer": "13.8.5",
|
||||
"text-buffer": "13.8.6",
|
||||
"typescript-simple": "1.0.0",
|
||||
"underscore-plus": "^1.6.6",
|
||||
"winreg": "^1.2.1",
|
||||
@@ -101,13 +101,13 @@
|
||||
"background-tips": "0.27.1",
|
||||
"bookmarks": "0.44.4",
|
||||
"bracket-matcher": "0.88.0",
|
||||
"command-palette": "0.42.0",
|
||||
"command-palette": "0.42.1",
|
||||
"dalek": "0.2.1",
|
||||
"deprecation-cop": "0.56.9",
|
||||
"dev-live-reload": "0.48.1",
|
||||
"encoding-selector": "0.23.7",
|
||||
"exception-reporting": "0.41.5",
|
||||
"find-and-replace": "0.214.0",
|
||||
"find-and-replace": "0.215.0",
|
||||
"fuzzy-finder": "1.7.3",
|
||||
"github": "0.8.2",
|
||||
"git-diff": "1.3.6",
|
||||
@@ -122,7 +122,7 @@
|
||||
"metrics": "1.2.6",
|
||||
"notifications": "0.69.2",
|
||||
"open-on-github": "1.3.0",
|
||||
"package-generator": "1.2.0",
|
||||
"package-generator": "1.3.0",
|
||||
"settings-view": "0.253.0",
|
||||
"snippets": "1.1.9",
|
||||
"spell-check": "0.72.3",
|
||||
@@ -131,7 +131,7 @@
|
||||
"symbols-view": "0.118.1",
|
||||
"tabs": "0.109.1",
|
||||
"timecop": "0.36.2",
|
||||
"tree-view": "0.222.0",
|
||||
"tree-view": "0.221.3",
|
||||
"update-package-dependencies": "0.13.0",
|
||||
"welcome": "0.36.5",
|
||||
"whitespace": "0.37.5",
|
||||
|
||||
18
script/test
18
script/test
@@ -3,6 +3,7 @@
|
||||
'use strict'
|
||||
|
||||
require('colors')
|
||||
const argv = require('yargs').argv
|
||||
const assert = require('assert')
|
||||
const async = require('async')
|
||||
const childProcess = require('child_process')
|
||||
@@ -150,17 +151,26 @@ function runBenchmarkTests (callback) {
|
||||
let testSuitesToRun = testSuitesForPlatform(process.platform)
|
||||
|
||||
function testSuitesForPlatform (platform) {
|
||||
let suites = [];
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites)
|
||||
suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites)
|
||||
break
|
||||
case 'win32':
|
||||
return (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests]
|
||||
suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests]
|
||||
break
|
||||
case 'linux':
|
||||
return [runCoreMainProcessTests]
|
||||
suites = [runCoreMainProcessTests]
|
||||
break
|
||||
default:
|
||||
console.log(`Unrecognized platform: ${platform}`)
|
||||
return []
|
||||
}
|
||||
|
||||
if (argv.skipMainProcessTests) {
|
||||
suites = suites.filter(suite => suite !== runCoreMainProcessTests);
|
||||
}
|
||||
|
||||
return suites;
|
||||
}
|
||||
|
||||
async.series(testSuitesToRun, function (err, exitCodes) {
|
||||
|
||||
@@ -13,6 +13,14 @@ describe('GitRepositoryProvider', () => {
|
||||
provider = new GitRepositoryProvider(atom.project, atom.config, atom.confirm)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
if (provider) {
|
||||
Object.keys(provider.pathToRepository).forEach(key => {
|
||||
provider.pathToRepository[key].destroy()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
describe('.repositoryForDirectory(directory)', () => {
|
||||
describe('when specified a Directory with a Git repository', () => {
|
||||
it('resolves with a GitRepository', async () => {
|
||||
|
||||
@@ -115,12 +115,12 @@ describe('TextEditor', () => {
|
||||
editor.update({showCursorOnSelection: false})
|
||||
editor.setSelectedBufferRange([[1, 2], [3, 4]])
|
||||
editor.addSelectionForBufferRange([[5, 6], [7, 8]], {reversed: true})
|
||||
editor.foldBufferRow(4)
|
||||
expect(editor.isFoldedAtBufferRow(4)).toBeTruthy()
|
||||
editor.setScrollTopRow(3)
|
||||
expect(editor.getScrollTopRow()).toBe(3)
|
||||
editor.setScrollLeftColumn(4)
|
||||
expect(editor.getScrollLeftColumn()).toBe(4)
|
||||
editor.foldBufferRow(4)
|
||||
expect(editor.isFoldedAtBufferRow(4)).toBeTruthy()
|
||||
|
||||
const editor2 = editor.copy()
|
||||
const element2 = editor2.getElement()
|
||||
@@ -7028,19 +7028,15 @@ describe('TextEditor', () => {
|
||||
})
|
||||
|
||||
describe('.unfoldAll()', () => {
|
||||
it('unfolds every folded line and autoscrolls', async () => {
|
||||
it('unfolds every folded line', async () => {
|
||||
editor = await atom.workspace.open('sample.js', {autoIndent: false})
|
||||
const autoscrollEvents = []
|
||||
editor.onDidRequestAutoscroll(event => autoscrollEvents.push(event))
|
||||
|
||||
const initialScreenLineCount = editor.getScreenLineCount()
|
||||
editor.foldBufferRow(0)
|
||||
editor.foldBufferRow(1)
|
||||
expect(editor.getScreenLineCount()).toBeLessThan(initialScreenLineCount)
|
||||
expect(autoscrollEvents.length).toBe(1)
|
||||
editor.unfoldAll()
|
||||
expect(editor.getScreenLineCount()).toBe(initialScreenLineCount)
|
||||
expect(autoscrollEvents.length).toBe(2)
|
||||
})
|
||||
|
||||
it('unfolds every folded line with comments', async () => {
|
||||
@@ -7058,11 +7054,8 @@ describe('TextEditor', () => {
|
||||
describe('.foldAll()', () => {
|
||||
it('folds every foldable line', async () => {
|
||||
editor = await atom.workspace.open('sample.js', {autoIndent: false})
|
||||
const autoscrollEvents = []
|
||||
editor.onDidRequestAutoscroll(event => autoscrollEvents.push(event))
|
||||
|
||||
editor.foldAll()
|
||||
expect(autoscrollEvents.length).toBe(1)
|
||||
const [fold1, fold2, fold3] = editor.unfoldAll()
|
||||
expect([fold1.start.row, fold1.end.row]).toEqual([0, 12])
|
||||
expect([fold2.start.row, fold2.end.row]).toEqual([1, 9])
|
||||
@@ -7093,11 +7086,7 @@ describe('TextEditor', () => {
|
||||
|
||||
describe('when bufferRow can be folded', () => {
|
||||
it('creates a fold based on the syntactic region starting at the given row', () => {
|
||||
const autoscrollEvents = []
|
||||
editor.onDidRequestAutoscroll(event => autoscrollEvents.push(event))
|
||||
|
||||
editor.foldBufferRow(1)
|
||||
expect(autoscrollEvents.length).toBe(1)
|
||||
const [fold] = editor.unfoldAll()
|
||||
expect([fold.start.row, fold.end.row]).toEqual([1, 9])
|
||||
})
|
||||
@@ -7144,14 +7133,10 @@ describe('TextEditor', () => {
|
||||
describe('.foldCurrentRow()', () => {
|
||||
it('creates a fold at the location of the last cursor', async () => {
|
||||
editor = await atom.workspace.open()
|
||||
|
||||
editor.setText('\nif (x) {\n y()\n}')
|
||||
editor.setCursorBufferPosition([1, 0])
|
||||
expect(editor.getScreenLineCount()).toBe(4)
|
||||
const autoscrollEvents = []
|
||||
editor.onDidRequestAutoscroll(event => autoscrollEvents.push(event))
|
||||
editor.foldCurrentRow()
|
||||
expect(autoscrollEvents.length).toBe(1)
|
||||
expect(editor.getScreenLineCount()).toBe(3)
|
||||
})
|
||||
|
||||
@@ -7168,26 +7153,21 @@ describe('TextEditor', () => {
|
||||
describe('.foldAllAtIndentLevel(indentLevel)', () => {
|
||||
it('folds blocks of text at the given indentation level', async () => {
|
||||
editor = await atom.workspace.open('sample.js', {autoIndent: false})
|
||||
const autoscrollEvents = []
|
||||
editor.onDidRequestAutoscroll(event => autoscrollEvents.push(event))
|
||||
|
||||
editor.foldAllAtIndentLevel(0)
|
||||
expect(editor.lineTextForScreenRow(0)).toBe(`var quicksort = function () {${editor.displayLayer.foldCharacter}`)
|
||||
expect(editor.getLastScreenRow()).toBe(0)
|
||||
expect(autoscrollEvents.length).toBe(1)
|
||||
|
||||
editor.foldAllAtIndentLevel(1)
|
||||
expect(editor.lineTextForScreenRow(0)).toBe('var quicksort = function () {')
|
||||
expect(editor.lineTextForScreenRow(1)).toBe(` var sort = function(items) {${editor.displayLayer.foldCharacter}`)
|
||||
expect(editor.getLastScreenRow()).toBe(4)
|
||||
expect(autoscrollEvents.length).toBe(2)
|
||||
|
||||
editor.foldAllAtIndentLevel(2)
|
||||
expect(editor.lineTextForScreenRow(0)).toBe('var quicksort = function () {')
|
||||
expect(editor.lineTextForScreenRow(1)).toBe(' var sort = function(items) {')
|
||||
expect(editor.lineTextForScreenRow(2)).toBe(' if (items.length <= 1) return items;')
|
||||
expect(editor.getLastScreenRow()).toBe(9)
|
||||
expect(autoscrollEvents.length).toBe(3)
|
||||
})
|
||||
|
||||
it('folds every foldable range at a given indentLevel', async () => {
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
// Converts a query string parameter for a line or column number
|
||||
// to a zero-based line or column number for the Atom API.
|
||||
function getLineColNumber (numStr) {
|
||||
const num = parseInt(numStr || 0, 10)
|
||||
return Math.max(num - 1, 0)
|
||||
}
|
||||
|
||||
function openFile (atom, {query}) {
|
||||
const {filename, line, column} = query
|
||||
|
||||
atom.workspace.open(filename, {
|
||||
initialLine: parseInt(line || 0, 10),
|
||||
initialColumn: parseInt(column || 0, 10),
|
||||
initialLine: getLineColNumber(line),
|
||||
initialColumn: getLineColNumber(column),
|
||||
searchAllPanes: true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -219,18 +219,40 @@ module.exports = ({commandRegistry, commandInstaller, config, notificationManage
|
||||
'editor:toggle-soft-wrap': -> @toggleSoftWrapped()
|
||||
'editor:fold-all': -> @foldAll()
|
||||
'editor:unfold-all': -> @unfoldAll()
|
||||
'editor:fold-current-row': -> @foldCurrentRow()
|
||||
'editor:unfold-current-row': -> @unfoldCurrentRow()
|
||||
'editor:fold-current-row': ->
|
||||
@foldCurrentRow()
|
||||
@scrollToCursorPosition()
|
||||
'editor:unfold-current-row': ->
|
||||
@unfoldCurrentRow()
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-selection': -> @foldSelectedLines()
|
||||
'editor:fold-at-indent-level-1': -> @foldAllAtIndentLevel(0)
|
||||
'editor:fold-at-indent-level-2': -> @foldAllAtIndentLevel(1)
|
||||
'editor:fold-at-indent-level-3': -> @foldAllAtIndentLevel(2)
|
||||
'editor:fold-at-indent-level-4': -> @foldAllAtIndentLevel(3)
|
||||
'editor:fold-at-indent-level-5': -> @foldAllAtIndentLevel(4)
|
||||
'editor:fold-at-indent-level-6': -> @foldAllAtIndentLevel(5)
|
||||
'editor:fold-at-indent-level-7': -> @foldAllAtIndentLevel(6)
|
||||
'editor:fold-at-indent-level-8': -> @foldAllAtIndentLevel(7)
|
||||
'editor:fold-at-indent-level-9': -> @foldAllAtIndentLevel(8)
|
||||
'editor:fold-at-indent-level-1': ->
|
||||
@foldAllAtIndentLevel(0)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-2': ->
|
||||
@foldAllAtIndentLevel(1)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-3': ->
|
||||
@foldAllAtIndentLevel(2)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-4': ->
|
||||
@foldAllAtIndentLevel(3)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-5': ->
|
||||
@foldAllAtIndentLevel(4)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-6': ->
|
||||
@foldAllAtIndentLevel(5)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-7': ->
|
||||
@foldAllAtIndentLevel(6)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-8': ->
|
||||
@foldAllAtIndentLevel(7)
|
||||
@scrollToCursorPosition()
|
||||
'editor:fold-at-indent-level-9': ->
|
||||
@foldAllAtIndentLevel(8)
|
||||
@scrollToCursorPosition()
|
||||
'editor:log-cursor-scope': -> showCursorScope(@getCursorScope(), notificationManager)
|
||||
'editor:copy-path': -> copyPathToClipboard(this, project, clipboard, false)
|
||||
'editor:copy-project-path': -> copyPathToClipboard(this, project, clipboard, true)
|
||||
|
||||
@@ -3750,19 +3750,13 @@ class TextEditor {
|
||||
foldCurrentRow () {
|
||||
const {row} = this.getCursorBufferPosition()
|
||||
const range = this.tokenizedBuffer.getFoldableRangeContainingPoint(Point(row, Infinity))
|
||||
if (range) {
|
||||
const result = this.displayLayer.foldBufferRange(range)
|
||||
this.scrollToCursorPosition()
|
||||
return result
|
||||
}
|
||||
if (range) return this.displayLayer.foldBufferRange(range)
|
||||
}
|
||||
|
||||
// Essential: Unfold the most recent cursor's row by one level.
|
||||
unfoldCurrentRow () {
|
||||
const {row} = this.getCursorBufferPosition()
|
||||
const result = this.displayLayer.destroyFoldsContainingBufferPositions([Point(row, Infinity)], false)
|
||||
this.scrollToCursorPosition()
|
||||
return result
|
||||
return this.displayLayer.destroyFoldsContainingBufferPositions([Point(row, Infinity)], false)
|
||||
}
|
||||
|
||||
// Essential: Fold the given row in buffer coordinates based on its indentation
|
||||
@@ -3780,7 +3774,6 @@ class TextEditor {
|
||||
const existingFolds = this.displayLayer.foldsIntersectingBufferRange(Range(foldableRange.start, foldableRange.start))
|
||||
if (existingFolds.length === 0) {
|
||||
this.displayLayer.foldBufferRange(foldableRange)
|
||||
this.scrollToCursorPosition()
|
||||
} else {
|
||||
const firstExistingFoldRange = this.displayLayer.bufferRangeForFold(existingFolds[0])
|
||||
if (firstExistingFoldRange.start.isLessThan(position)) {
|
||||
@@ -3798,9 +3791,7 @@ class TextEditor {
|
||||
// * `bufferRow` A {Number}
|
||||
unfoldBufferRow (bufferRow) {
|
||||
const position = Point(bufferRow, Infinity)
|
||||
const result = this.displayLayer.destroyFoldsContainingBufferPositions([position])
|
||||
this.scrollToCursorPosition()
|
||||
return result
|
||||
return this.displayLayer.destroyFoldsContainingBufferPositions([position])
|
||||
}
|
||||
|
||||
// Extended: For each selection, fold the rows it intersects.
|
||||
@@ -3816,7 +3807,6 @@ class TextEditor {
|
||||
for (let range of this.tokenizedBuffer.getFoldableRanges(this.getTabLength())) {
|
||||
this.displayLayer.foldBufferRange(range)
|
||||
}
|
||||
this.scrollToCursorPosition()
|
||||
}
|
||||
|
||||
// Extended: Unfold all existing folds.
|
||||
@@ -3834,7 +3824,6 @@ class TextEditor {
|
||||
for (let range of this.tokenizedBuffer.getFoldableRangesAtIndentLevel(level, this.getTabLength())) {
|
||||
this.displayLayer.foldBufferRange(range)
|
||||
}
|
||||
this.scrollToCursorPosition()
|
||||
}
|
||||
|
||||
// Extended: Determine whether the given row in buffer coordinates is foldable.
|
||||
@@ -3862,14 +3851,11 @@ class TextEditor {
|
||||
// Extended: Fold the given buffer row if it isn't currently folded, and unfold
|
||||
// it otherwise.
|
||||
toggleFoldAtBufferRow (bufferRow) {
|
||||
let result
|
||||
if (this.isFoldedAtBufferRow(bufferRow)) {
|
||||
result = this.unfoldBufferRow(bufferRow)
|
||||
return this.unfoldBufferRow(bufferRow)
|
||||
} else {
|
||||
result = this.foldBufferRow(bufferRow)
|
||||
return this.foldBufferRow(bufferRow)
|
||||
}
|
||||
this.scrollToCursorPosition()
|
||||
return result
|
||||
}
|
||||
|
||||
// Extended: Determine whether the most recently added cursor's row is folded.
|
||||
@@ -3908,9 +3894,7 @@ class TextEditor {
|
||||
//
|
||||
// Returns the new {Fold}.
|
||||
foldBufferRowRange (startRow, endRow) {
|
||||
const result = this.foldBufferRange(Range(Point(startRow, Infinity), Point(endRow, Infinity)))
|
||||
this.scrollToCursorPosition()
|
||||
return result
|
||||
return this.foldBufferRange(Range(Point(startRow, Infinity), Point(endRow, Infinity)))
|
||||
}
|
||||
|
||||
foldBufferRange (range) {
|
||||
|
||||
Reference in New Issue
Block a user