Merge branch 'master' into aw/custom-line-number-gutter

This commit is contained in:
Ash Wilson
2018-07-31 07:54:57 -04:00
9 changed files with 506 additions and 27 deletions

View File

@@ -27,7 +27,7 @@ install:
- source /tmp/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use --delete-prefix $NODE_VERSION
- npm install -g npm@5.3.0
- npm install -g npm@6.1.0
- script/build --create-debian-package --create-rpm-package --compress-artifacts
script:

View File

@@ -77,6 +77,12 @@ artifacts:
name: atom-windows.zip
- path: out\RELEASES
name: RELEASES
- path: out\AtomSetup-x64.exe
name: AtomSetup-x64.exe
- path: out\atom-x64-windows.zip
name: atom-x64-windows.zip
- path: out\RELEASES-x64
name: RELEASES-x64
- path: out\atom-*-delta.nupkg
name: atom-delta.nupkg
- path: out\atom-*-full.nupkg

436
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "atom",
"version": "1.30.0-dev",
"version": "1.31.0-dev",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -25,25 +25,176 @@
}
},
"@atom/watcher": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@atom/watcher/-/watcher-1.0.3.tgz",
"integrity": "sha512-lsov8mAgNWnFBuWVY25TOdUjtlOyPdrFfJKVXYRdJw5i2j+DT4eBeReKyiGWXiT18vt9yC1A50w9WuEFHDvvhw==",
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@atom/watcher/-/watcher-1.0.8.tgz",
"integrity": "sha512-53un+vGSaY7Fsbvmg8gerYOA3ISipMWR3qiYR9hZWqSfvFsksXJfGrmFsfbBj3uqGRQ3gPTi6wpxcFSWjbWVFQ==",
"requires": {
"event-kit": "^2.4.0",
"fs-extra": "^4.0.0",
"nan": "2.6.2"
"event-kit": "^2.5.0",
"fs-extra": "^6.0.0",
"nan": "^2.10.0",
"node-pre-gyp": "^0.10.0"
},
"dependencies": {
"abbrev": {
"version": "1.1.1",
"bundled": true
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
},
"aproba": {
"version": "1.2.0",
"bundled": true
},
"are-we-there-yet": {
"version": "1.1.4",
"bundled": true,
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
}
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
},
"brace-expansion": {
"version": "1.1.8",
"bundled": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"chownr": {
"version": "1.0.1",
"bundled": true
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
},
"core-util-is": {
"version": "1.0.2",
"bundled": true
},
"debug": {
"version": "2.6.9",
"bundled": true,
"requires": {
"ms": "2.0.0"
}
},
"deep-extend": {
"version": "0.6.0",
"bundled": true
},
"delegates": {
"version": "1.0.0",
"bundled": true
},
"detect-libc": {
"version": "1.0.3",
"bundled": true
},
"fs-extra": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz",
"integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz",
"integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==",
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"fs-minipass": {
"version": "1.2.5",
"bundled": true,
"requires": {
"minipass": "^2.2.1"
}
},
"fs.realpath": {
"version": "1.0.0",
"bundled": true
},
"gauge": {
"version": "2.7.4",
"bundled": true,
"requires": {
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.0",
"object-assign": "^4.1.0",
"signal-exit": "^3.0.0",
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wide-align": "^1.1.0"
}
},
"glob": {
"version": "7.1.1",
"bundled": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.2",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"has-unicode": {
"version": "2.0.1",
"bundled": true
},
"iconv-lite": {
"version": "0.4.19",
"bundled": true
},
"ignore-walk": {
"version": "3.0.1",
"bundled": true,
"requires": {
"minimatch": "^3.0.4"
}
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true
},
"ini": {
"version": "1.3.5",
"bundled": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"requires": {
"number-is-nan": "^1.0.0"
}
},
"isarray": {
"version": "1.0.0",
"bundled": true
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
@@ -52,10 +203,267 @@
"graceful-fs": "^4.1.6"
}
},
"nan": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz",
"integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U="
"minimatch": {
"version": "3.0.4",
"bundled": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
},
"minipass": {
"version": "2.3.3",
"bundled": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
},
"dependencies": {
"safe-buffer": {
"version": "5.1.2",
"bundled": true
},
"yallist": {
"version": "3.0.2",
"bundled": true
}
}
},
"minizlib": {
"version": "1.1.0",
"bundled": true,
"requires": {
"minipass": "^2.2.1"
}
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"requires": {
"minimist": "0.0.8"
}
},
"ms": {
"version": "2.0.0",
"bundled": true
},
"needle": {
"version": "2.2.1",
"bundled": true,
"requires": {
"debug": "^2.1.2",
"iconv-lite": "^0.4.4",
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
"version": "0.10.0",
"bundled": true,
"requires": {
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
"needle": "^2.2.0",
"nopt": "^4.0.1",
"npm-packlist": "^1.1.6",
"npmlog": "^4.0.2",
"rc": "^1.1.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
},
"dependencies": {
"nopt": {
"version": "4.0.1",
"bundled": true,
"requires": {
"abbrev": "1",
"osenv": "^0.1.4"
}
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
},
"tar": {
"version": "4.4.4",
"bundled": true,
"requires": {
"chownr": "^1.0.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.3.3",
"minizlib": "^1.1.0",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.2"
}
},
"yallist": {
"version": "3.0.2",
"bundled": true
}
}
},
"npm-bundled": {
"version": "1.0.3",
"bundled": true
},
"npm-packlist": {
"version": "1.1.10",
"bundled": true,
"requires": {
"ignore-walk": "^3.0.1",
"npm-bundled": "^1.0.1"
}
},
"npmlog": {
"version": "4.1.2",
"bundled": true,
"requires": {
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
"gauge": "~2.7.3",
"set-blocking": "~2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
},
"object-assign": {
"version": "4.1.1",
"bundled": true
},
"once": {
"version": "1.4.0",
"bundled": true,
"requires": {
"wrappy": "1"
}
},
"os-homedir": {
"version": "1.0.2",
"bundled": true
},
"os-tmpdir": {
"version": "1.0.2",
"bundled": true
},
"osenv": {
"version": "0.1.5",
"bundled": true,
"requires": {
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.0"
}
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true
},
"process-nextick-args": {
"version": "1.0.7",
"bundled": true
},
"rc": {
"version": "1.2.8",
"bundled": true,
"requires": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"bundled": true
}
}
},
"readable-stream": {
"version": "2.3.3",
"bundled": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~1.0.6",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.0.3",
"util-deprecate": "~1.0.1"
}
},
"rimraf": {
"version": "2.6.1",
"bundled": true,
"requires": {
"glob": "^7.0.5"
}
},
"safe-buffer": {
"version": "5.1.1",
"bundled": true
},
"sax": {
"version": "1.2.4",
"bundled": true
},
"semver": {
"version": "5.3.0",
"bundled": true
},
"set-blocking": {
"version": "2.0.0",
"bundled": true
},
"signal-exit": {
"version": "3.0.2",
"bundled": true
},
"string-width": {
"version": "1.0.2",
"bundled": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
},
"string_decoder": {
"version": "1.0.3",
"bundled": true,
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"strip-json-comments": {
"version": "2.0.1",
"bundled": true
},
"util-deprecate": {
"version": "1.0.2",
"bundled": true
},
"wide-align": {
"version": "1.1.2",
"bundled": true,
"requires": {
"string-width": "^1.0.2"
}
},
"wrappy": {
"version": "1.0.2",
"bundled": true
}
}
},

View File

@@ -16,7 +16,7 @@
"dependencies": {
"@atom/nsfw": "^1.0.18",
"@atom/source-map-support": "^0.3.4",
"@atom/watcher": "1.0.3",
"@atom/watcher": "1.0.8",
"about": "https://www.atom.io/api/packages/about/versions/1.10.0/tarball",
"archive-view": "https://www.atom.io/api/packages/archive-view/versions/0.65.1/tarball",
"async": "0.2.6",
@@ -159,7 +159,7 @@
"temp": "^0.8.3",
"text-buffer": "13.14.5",
"timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball",
"tree-sitter": "0.13.0",
"tree-sitter": "0.13.2",
"tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.222.0/tarball",
"typescript-simple": "1.0.0",
"underscore-plus": "^1.6.8",

View File

@@ -25,7 +25,7 @@
"minidump": "0.9.0",
"mkdirp": "0.5.1",
"normalize-package-data": "2.3.5",
"npm": "5.3.0",
"npm": "6.1.0",
"passwd-user": "2.1.0",
"pegjs": "0.9.0",
"publish-release": "^1.6.0",

View File

@@ -212,7 +212,7 @@ describe('TooltipManager', () => {
})
})
)
describe('when a user types', () =>
it('hides the tooltips', () => {
const disposable = manager.add(element, { title: 'Title' })

View File

@@ -314,6 +314,39 @@ describe('TreeSitterLanguageMode', () => {
])
})
it('applies rules when specified', async () => {
const grammar = new TreeSitterGrammar(atom.grammars, jsGrammarPath, {
parser: 'tree-sitter-javascript',
scopes: {
'identifier': [
{match: '^(exports|document|window|global)$', scopes: 'global'},
{match: '^[A-Z_]+$', scopes: 'constant'},
{match: '^[A-Z]', scopes: 'constructor'},
'variable'
],
}
})
buffer.setText(`exports.object = Class(SOME_CONSTANT, x)`)
const languageMode = new TreeSitterLanguageMode({buffer, grammar})
buffer.setLanguageMode(languageMode)
await nextHighlightingUpdate(languageMode)
expectTokensToEqual(editor, [
[
{text: 'exports', scopes: ['global']},
{text: '.object = ', scopes: []},
{text: 'Class', scopes: ['constructor']},
{text: '(', scopes: []},
{text: 'SOME_CONSTANT', scopes: ['constant']},
{text: ', ', scopes: []},
{text: 'x', scopes: ['variable']},
{text: ')', scopes: []},
]
])
})
it('handles nodes that start before their first child and end after their last child', async () => {
const grammar = new TreeSitterGrammar(atom.grammars, rubyGrammarPath, {
parser: 'tree-sitter-ruby',

View File

@@ -22,10 +22,7 @@ class TreeSitterGrammar {
const scopeSelectors = {}
for (const key in params.scopes || {}) {
scopeSelectors[key] = params.scopes[key]
.split('.')
.map(s => `syntax--${s}`)
.join(' ')
scopeSelectors[key] = toSyntaxClasses(params.scopes[key])
}
this.scopeMap = new SyntaxScopeMap(scopeSelectors)
@@ -74,6 +71,18 @@ class TreeSitterGrammar {
}
}
const toSyntaxClasses = scopes =>
typeof scopes === 'string'
? scopes
.split('.')
.map(s => `syntax--${s}`)
.join(' ')
: Array.isArray(scopes)
? scopes.map(toSyntaxClasses)
: scopes.match
? {match: new RegExp(scopes.match), scopes: toSyntaxClasses(scopes.scopes)}
: Object.assign({}, scopes, {scopes: toSyntaxClasses(scopes.scopes)})
const NODE_NAME_REGEX = /[\w_]+/
function matcherForSpec (spec) {

View File

@@ -870,7 +870,6 @@ class LayerHighlightIterator {
}
// Private methods
_moveUp (atLastChild) {
let result = false
const {endIndex} = this.treeCursor
@@ -928,13 +927,37 @@ class LayerHighlightIterator {
}
_currentScopeId () {
const name = this.languageLayer.grammar.scopeMap.get(
const rules = this.languageLayer.grammar.scopeMap.get(
this.containingNodeTypes,
this.containingNodeChildIndices,
this.treeCursor.nodeIsNamed
)
if (name) {
return this.languageLayer.languageMode.grammar.idForScope(name)
const scopes = applyLeafRules(rules, this.treeCursor)
if (scopes) {
return this.languageLayer.languageMode.grammar.idForScope(scopes)
}
}
}
const applyLeafRules = (rules, cursor) => {
if (!rules || typeof rules === 'string') return rules
if (Array.isArray(rules)) {
for (let i = 0, {length} = rules; i !== length; ++i) {
const result = applyLeafRules(rules[i], cursor)
if (result) return result
}
return undefined
}
if (typeof rules === 'object') {
if (rules.exact) {
return cursor.nodeText === rules.exact
? applyLeafRules(rules.scopes, cursor)
: undefined
}
if (rules.match) {
return rules.match.test(cursor.nodeText)
? applyLeafRules(rules.scopes, cursor)
: undefined
}
}
}