├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── lib └── fold-functions.coffee ├── menus └── fold-functions.cson ├── package.json └── spec ├── files ├── js-sample.js ├── php-closure.php └── php-oop.php └── fold-functions-spec.coffee /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | debug.log 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | 3 | notifications: 4 | email: 5 | on_success: never 6 | on_failure: change 7 | 8 | script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh' 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | This is an open source project intended to help people develop with the [Atom Editor](http://atom.io). Issues and pull requests are encouraged to make it better! 4 | 5 | If you feel like contributing to this project, please checkout the issue queue or pull request queue. There may be items to review or test, items that need more information to help complete. 6 | 7 | ## Submitting Issues 8 | 9 | Issues can be used for bugs, feature requests, and to discuss ideas in general. 10 | 11 | * Issues can be added here: https://github.com/robballou/atom-fold-functions/issues 12 | * Please search for existing issues before submitting a new issue. 13 | * Provide screenshots/GIFs to help provide context. 14 | * If an issue seems centered around a grammar or a bit of code, please share that information. 15 | 16 | ## Submitting pull requests 17 | 18 | Pull requests are welcome! [Checkout this article](https://help.github.com/articles/using-pull-requests/) about how to use pull requests. If a pull request fixes an issue, please make sure the issue description mentions the issue number. 19 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Rob Ballou 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fold Functions 2 | 3 | ![build status](https://travis-ci.org/robballou/atom-fold-functions.svg) 4 | 5 | Folds functions within your code. Currently comes with a toggle, fold, and unfold option that will look for functions marked with 'meta.function'. Handy because it won't fold things like comments associated with functions. 6 | 7 | ![screenshot](http://robballou.com/i/fold.gif) 8 | 9 | *Note: this currently folds only those functions it finds at a single indentation (e.g. it will fold the top level functions)* 10 | 11 | Heavily inspired/influenced by [Fold Comments](https://atom.io/packages/fold-comments). This package uses the "scopes" defined by a language instead of things like ctags. 12 | 13 | ## Autofolding 14 | 15 | You can turn on the auto-folding feature with the following in your configuration file: 16 | 17 | ```coffescript 18 | "fold-functions": 19 | autofold: true 20 | shortfileCutoff: 42 21 | autofoldGrammars: [] 22 | autofoldIgnoreGrammars: ['SQL', 'CSV', 'JSON', 'CSON', 'Plain Text'] 23 | skipAutofoldWhenNotFirstLine: true 24 | skipAutofoldWhenOnlyOneFunction: true 25 | ``` 26 | 27 | By default, this is setup to ignore files that are under 42 lines. This can be configured by changing the `shortfileCutoff` option to a larger or smaller number. If you wish to fold all files, even short ones, you can change this option to `0`. 28 | 29 | Autofolding also has the following options: 30 | 31 | 1. `autofoldGrammars` allows you to specify grammar names for grammars you *want* to autofold. An empty list (which is the default), means everything is fair game to fold. That is except... 32 | 2. `autofoldIgnoreGrammars` allows you to specify grammar names for grammars you *do not want to autofold*. This fires after `autofoldGrammars` and does have a default value (see above). 33 | 3. `skipAutofoldWhenNotFirstLine` will stop autofolding if the line cursor is not the first line in the buffer. This will help with searching finding a line and folding it out-of-sight. 34 | 4. `skipAutofoldWhenOnlyOneFunction` will stop autofolding if there is only one top-level function in a file. Handy for JavaScript! 35 | 36 | ## Configurable Scopes (NEW!) 37 | 38 | This module uses level language scopes to define what constitutes a function. Since this varies greatly by language, the package now exposes options for specifying scopes including *by language*! 39 | 40 | ```coffescript 41 | "*": 42 | "fold-functions": 43 | foldScopes: ['meta.function'] 44 | "source.php": 45 | "fold-functions": 46 | foldScopes: ['meta.something'] 47 | ``` 48 | 49 | By default, this package folds on: 50 | 51 | ```coffescript 52 | [ 53 | 'meta.function', 54 | 'meta.method', 55 | 'storage.type.arrow', 56 | 'entity.name.function', 57 | 'support.function' 58 | ] 59 | ``` 60 | -------------------------------------------------------------------------------- /lib/fold-functions.coffee: -------------------------------------------------------------------------------- 1 | {CompositeDisposable} = require 'atom' 2 | 3 | module.exports = AtomFoldFunctions = 4 | modalPanel: null 5 | subscriptions: null 6 | indentLevel: null 7 | 8 | config: 9 | autofold: 10 | type: 'boolean' 11 | default: false 12 | shortfileCutoff: 13 | type: 'integer' 14 | default: 42 15 | autofoldGrammars: 16 | type: 'array' 17 | default: [] 18 | autofoldIgnoreGrammars: 19 | type: 'array' 20 | default: ['SQL', 'CSV', 'JSON', 'CSON', 'Plain Text'] 21 | skipAutofoldWhenNotFirstLine: 22 | type: 'boolean' 23 | default: false 24 | skipAutofoldWhenOnlyOneFunction: 25 | type: 'boolean' 26 | default: false 27 | debug: 28 | type: 'boolean' 29 | default: false 30 | foldScopes: 31 | type: 'array' 32 | default: [ 33 | 'meta.function', 34 | 'meta.method', 35 | 'storage.type.arrow', 36 | 'entity.name.function', 37 | 'support.function' 38 | ] 39 | 40 | activate: (state) -> 41 | # Events subscribed to in atom's system can be easily cleaned up with a 42 | # CompositeDisposable 43 | @subscriptions = new CompositeDisposable 44 | 45 | # Register command that toggles this view 46 | @subscriptions.add atom.commands.add 'atom-workspace', 47 | 'fold-functions:toggle': => @toggle() 48 | 49 | @subscriptions.add atom.commands.add 'atom-workspace', 50 | 'fold-functions:fold': => @fold() 51 | 52 | @subscriptions.add atom.commands.add 'atom-workspace', 53 | 'fold-functions:unfold': => @unfold() 54 | 55 | @subscriptions.add atom.commands.add 'atom-workspace', 56 | 'fold-functions:scopes': => @scopes() 57 | 58 | if atom.config.get('fold-functions.autofold') 59 | atom.workspace.observeTextEditors (editor) => 60 | editor.tokenizedBuffer.onDidTokenize => @autofold(editor) 61 | # editor.onDidChangeGrammar => @autofold(editor) 62 | 63 | deactivate: -> 64 | @subscriptions.dispose() 65 | 66 | autofold: (editor) -> 67 | @debugMessage('fold functions: autofold') 68 | if not editor 69 | editor = atom.workspace.getActiveTextEditor() 70 | 71 | # just in case there really is not an editor, don't try to autofold... 72 | if not editor 73 | @debugMessage('fold functions: no editor, not autofolding...') 74 | return false 75 | 76 | grammar = editor.getGrammar() 77 | autofold = false 78 | 79 | # the grammar is not white listed (and there are things whitelisted) 80 | autofoldGrammars = atom.config.get('fold-functions.autofoldGrammars') 81 | if autofoldGrammars and autofoldGrammars.length > 0 and grammar.name not in autofoldGrammars 82 | @debugMessage('fold functions: autofold grammar not whitelisted', grammar.name) 83 | return false 84 | 85 | # the grammar is not in the ignore grammar list 86 | autofoldIgnoreGrammars = atom.config.get('fold-functions.autofoldIgnoreGrammars') 87 | if autofoldIgnoreGrammars and autofoldIgnoreGrammars.length > 0 and grammar.name in autofoldIgnoreGrammars 88 | @debugMessage('fold functions: autofold ignored grammar', grammar.name) 89 | return false 90 | 91 | # check if the file is too short to run 92 | if shortfileCutoff = atom.config.get('fold-functions.shortfileCutoff', 42) 93 | # make sure the file is longer than the cutoff before folding 94 | if (shortfileCutoff > 0 and editor.getLineCount() >= shortfileCutoff) 95 | @debugMessage('fold functions: autofold turned on') 96 | autofold = true 97 | # if shortfileCutoff = 0/false/-1 then we should still turn on autofolding 98 | else 99 | @debugMessage('fold functions: autofold turned on') 100 | autofold = true 101 | 102 | # figure out if we should skip autofolding because we are not on the first 103 | # line of the file. 104 | if autofold and atom.config.get('fold-functions.skipAutofoldWhenNotFirstLine') 105 | onFirstLine = true 106 | for cursor in editor.getCursors() 107 | if cursor.getBufferRow() > 0 108 | onFirstLine = false 109 | break 110 | 111 | if not onFirstLine 112 | @debugMessage('fold function: not on first line, skipping autofold') 113 | autofold = false 114 | 115 | # figure out if we should skip autofolding because there is only one 116 | # top-level function to fold 117 | if autofold and atom.config.get('fold-functions.skipAutofoldWhenOnlyOneFunction') 118 | if @count(editor) == 1 119 | @debugMessage('fold functions: only one function, skipping autofold') 120 | autofold = false 121 | 122 | if autofold 123 | @debugMessage('fold functions: start autofolding') 124 | @fold('autofold', editor) 125 | @debugMessage('fold functions: autofolded') 126 | autofold = true 127 | autofold 128 | 129 | # Figure out the number of functions in this file. 130 | count: (editor) -> 131 | if not editor 132 | editor = atom.workspace.getActiveTextEditor() 133 | 134 | @indentLevel = @indentLevel || null 135 | hasFoldableLines = false 136 | 137 | functionCount = 0 138 | for row in [0..editor.getLastBufferRow()] 139 | foldable = editor.isFoldableAtBufferRow(row) 140 | isFolded = editor.isFoldedAtBufferRow(row) 141 | isCommented = editor.isBufferRowCommented(row) 142 | 143 | # check the indent level for this line and make sure it is the same as 144 | # previous lines where we found functions 145 | thisIndentLevel = editor.indentationForBufferRow(row) 146 | if @indentLevel != null and thisIndentLevel != @indentLevel 147 | continue 148 | 149 | if foldable 150 | hasFoldableLines = true 151 | 152 | isFunction = @hasScopeAtBufferRow( 153 | editor, 154 | row, 155 | 'meta.function', 156 | 'meta.method', 157 | 'storage.type.arrow', 158 | 'entity.name.function.constructor' 159 | ) 160 | if foldable and isFunction and not isCommented 161 | if @indentLevel == null 162 | @indentLevel = thisIndentLevel 163 | functionCount++ 164 | functionCount 165 | 166 | debugMessage: -> 167 | if atom.config.get('fold-functions.debug', false) 168 | console.log.apply(console, arguments) 169 | 170 | fold: (action, editor) -> 171 | if !action then action = 'fold' 172 | if not editor 173 | editor = atom.workspace.getActiveTextEditor() 174 | 175 | if not editor 176 | @debugMessage('fold functions: no editor, skipping') 177 | return false 178 | 179 | @debugMessage('fold functions: action=', action) 180 | @indentLevel = @indentLevel || null 181 | hasFoldableLines = false 182 | lines = foldableLines = fold = unfold = toggle = 0 183 | bufferHasFoldableLines = false 184 | 185 | # get the scopes as configured 186 | scopes = atom.config.get('fold-functions.foldScopes', scope: editor.getRootScopeDescriptor()) 187 | @debugMessage('fold functions: scopes=', scopes) 188 | 189 | for row in [0..editor.getLastBufferRow()] 190 | foldable = editor.isFoldableAtBufferRow row 191 | isFolded = editor.isFoldedAtBufferRow row 192 | isCommented = editor.isBufferRowCommented row 193 | 194 | bufferHasFoldableLines = true if foldable 195 | 196 | lines++ 197 | 198 | # check the indent level for this line and make sure it is the same as 199 | # previous lines where we found functions 200 | thisIndentLevel = editor.indentationForBufferRow(row) 201 | if @indentLevel != null and thisIndentLevel != @indentLevel 202 | continue 203 | 204 | # if we are unfolding lines, we don't need to pay attention to lines that 205 | # are not folded 206 | if action == 'unfold' and not isFolded 207 | continue 208 | 209 | # ignore commented lines 210 | if isCommented 211 | continue 212 | 213 | if foldable 214 | hasFoldableLines = true 215 | 216 | isFunction = @hasScopeAtBufferRow( 217 | editor, 218 | row, 219 | scopes 220 | ) 221 | if !isFunction and row > 1 222 | isFunction = @hasScopeAtBufferRow( 223 | editor, 224 | row - 1, 225 | scopes 226 | ) 227 | @debugMessage 'fold functions: is foldable', 228 | lines, 229 | (foldable and isFunction and not isCommented), 230 | 'foldable', foldable, 231 | 'isFunction', isFunction, 232 | 'isCommented', isCommented 233 | if isFunction and not (foldable and isFunction and not isCommented) 234 | @debugMessage 'fold functions: line is a function, but cannot be folded', foldable, isCommented 235 | else if isFunction and foldable and not isCommented 236 | @debugMessage '?' 237 | foldableLines++ 238 | if @indentLevel == null 239 | @indentLevel = thisIndentLevel 240 | @debugMessage 'fold functions: indentLevel set at', @indentLevel 241 | if action == 'toggle' 242 | editor.toggleFoldAtBufferRow row 243 | toggle++ 244 | else if action == 'unfold' and isFolded 245 | editor.unfoldBufferRow row 246 | unfold++ 247 | else if !editor.isFoldedAtBufferRow row 248 | editor.foldBufferRow row 249 | fold++ 250 | @debugMessage('fold functions: done scanning ' + lines + ' lines (' + fold + ':' + unfold + ':' + toggle + ')') 251 | @debugMessage('foldable lines: ' + foldableLines) 252 | @debugMessage('indentLevel: ' + @indentLevel) 253 | 254 | toggle: -> 255 | @fold('toggle') 256 | 257 | unfold: -> 258 | @fold('unfold') 259 | 260 | # Log the scopes and copy them to the clipboard. 261 | scopes: -> 262 | editor = atom.workspace.getActiveTextEditor() 263 | position = editor.getCursorBufferPosition() 264 | scopes = @getScopesForBufferRow(editor, position.row) 265 | atom.clipboard.write(scopes.join(', ')) 266 | list = scopes.map (item) -> "* #{item}" 267 | content = "Scopes at Row\n#{list.join('\n')}" 268 | atom.notifications.addInfo(content, dismissable: true) 269 | 270 | # get all the scopes in a buffer row 271 | getScopesForBufferRow: (editor, row) -> 272 | scopes = [] 273 | text = editor.lineTextForBufferRow(row).trim() 274 | if text and text.length > 0 275 | # scan the text line to see if there is a function somewhere 276 | for pos in [0..text.length] 277 | positionScopes = editor.scopeDescriptorForBufferPosition([row, pos]) 278 | for currentScope in positionScopes.scopes 279 | scopes.push(currentScope) if currentScope not in scopes 280 | scopes 281 | 282 | # Check the scopes for this buffer row to see if it matches what we want 283 | hasScopeAtBufferRow: (editor, row, scopes) -> 284 | rowScopes = @getScopesForBufferRow(editor, row) 285 | return @scopeInScopes(rowScopes, scopes) 286 | 287 | scopeInScopes: (rowScopes, scopes) -> 288 | @debugMessage(scopes, rowScopes) 289 | for scope in scopes 290 | # incase there is an exact match, return quickly 291 | return true if scope in rowScopes 292 | 293 | # if not, we need to look at each piece of the scope to see if they match 294 | # using startsWith is problematic for things like 'meta.function-call' 295 | # would get folded instead of just 'meta.function' 296 | pieces = scope.split('.') 297 | for rowScope in rowScopes 298 | rowScopePieces = rowScope.split('.') 299 | match = true 300 | for piece, i in pieces 301 | match = false if rowScopePieces[i] != piece 302 | if not match 303 | break 304 | if match 305 | @debugMessage('match for', pieces, rowScopePieces) 306 | return true 307 | false 308 | -------------------------------------------------------------------------------- /menus/fold-functions.cson: -------------------------------------------------------------------------------- 1 | # See https://atom.io/docs/latest/creating-a-package#menus for more details 2 | 'context-menu': 3 | 'atom-text-editor': [ 4 | { 5 | 'label': 'Fold Functions' 6 | 'submenu': [ 7 | { 8 | 'label': 'Toggle function folding' 9 | 'command': 'fold-functions:toggle' 10 | }, 11 | { 12 | 'label': 'Fold functions' 13 | 'command': 'fold-functions:fold' 14 | }, 15 | { 16 | 'label': 'Unfold functions' 17 | 'command': 'fold-functions:unfold' 18 | } 19 | ] 20 | } 21 | ] 22 | 'menu': [ 23 | { 24 | 'label': 'Packages' 25 | 'submenu': [ 26 | 'label': 'Fold Functions' 27 | 'submenu': [ 28 | { 29 | 'label': 'Fold' 30 | 'command': 'fold-functions:fold' 31 | }, 32 | { 33 | 'label': 'Toggle' 34 | 'command': 'fold-functions:toggle' 35 | }, 36 | { 37 | 'label': 'Unfold' 38 | 'command': 'fold-functions:unfold' 39 | } 40 | ] 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fold-functions", 3 | "main": "./lib/fold-functions", 4 | "version": "0.11.0", 5 | "description": "Toggle folding on all functions", 6 | "repository": "git@github.com:robballou/atom-fold-functions.git", 7 | "license": "MIT", 8 | "engines": { 9 | "atom": ">=0.174.0 <2.0.0" 10 | }, 11 | "dependencies": {} 12 | } 13 | -------------------------------------------------------------------------------- /spec/files/js-sample.js: -------------------------------------------------------------------------------- 1 | function sum(a, b) { 2 | return a + b; 3 | } 4 | -------------------------------------------------------------------------------- /spec/files/php-closure.php: -------------------------------------------------------------------------------- 1 | get('/thing', function(Request $request) use ($app) { 4 | // this should be folded. 5 | }); 6 | -------------------------------------------------------------------------------- /spec/files/php-oop.php: -------------------------------------------------------------------------------- 1 | thing = 123; 12 | } 13 | 14 | /** 15 | * Increment the thing. 16 | */ 17 | public function someMethod() { 18 | $this->thing++; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spec/fold-functions-spec.coffee: -------------------------------------------------------------------------------- 1 | AtomFoldFunctions = require '../lib/fold-functions' 2 | 3 | describe 'autofolding', -> 4 | beforeEach -> 5 | waitsForPromise -> 6 | atom.packages.activatePackage('fold-functions').then -> 7 | atom.config.set('fold-functions.autofold', true) 8 | atom.config.set('fold-functions.shortfileCutoff', 0) 9 | atom.config.set('fold-functions.skipAutofoldWhenNotFirstLine', true) 10 | atom.config.set('fold-functions.skipAutofoldWhenOnlyOneFunction', true) 11 | 12 | it 'should autofold', -> 13 | waitsForPromise -> 14 | atom.workspace.open('files/php-oop.php').then (editor) -> 15 | editor.tokenizedBuffer.onDidTokenize -> 16 | expect(editor.getPath()).toContain 'php-oop.php' 17 | expect(editor.isFoldedAtBufferRow(10)).toBe true 18 | expect(editor.isFoldedAtBufferRow(17)).toBe true 19 | 20 | # it 'should not break for when there is no editor (#11)', -> 21 | # atom.workspace.open('files').then (editor) -> 22 | # expect(AtomFoldFunctions.autofold(editor)).toBe false 23 | 24 | describe 'fold functions methods', -> 25 | editor = null 26 | 27 | beforeEach -> 28 | waitsForPromise -> 29 | atom.packages.activatePackage('language-javascript') 30 | 31 | waitsForPromise -> 32 | atom.packages.activatePackage('fold-functions').then -> 33 | atom.config.set('fold-functions.autofold', true) 34 | atom.config.set('fold-functions.shortfileCutoff', 0) 35 | atom.config.set('fold-functions.skipAutofoldWhenNotFirstLine', true) 36 | atom.config.set('fold-functions.skipAutofoldWhenOnlyOneFunction', true) 37 | 38 | waitsForPromise -> 39 | atom.workspace.open(__dirname + '/files/js-sample.js').then (o) -> editor = o 40 | 41 | it 'count() should count correctly', -> 42 | expect(AtomFoldFunctions.count(editor)).toEqual 1 43 | 44 | describe 'hasScopeAtBufferRow()', -> 45 | it 'should return true when the scope matches', -> 46 | expect(AtomFoldFunctions.hasScopeAtBufferRow(editor, 0, 'source.js')) 47 | .toBe true 48 | expect(AtomFoldFunctions.hasScopeAtBufferRow( 49 | editor, 50 | 0, 51 | 'meta.function', 52 | 'meta.method', 53 | 'storage.type.arrow', 54 | 'entity.name.function.constructor') 55 | ) 56 | .toBe true 57 | 58 | it 'should return false when the scope does not match', -> 59 | atom.workspace.open('files/php-oop.php').then (editor) -> 60 | expect(AtomFoldFunctions.hasScopeAtBufferRow(editor, 0, 'source.bogus')) 61 | .toBe false 62 | expect(AtomFoldFunctions.hasScopeAtBufferRow( 63 | editor, 64 | 1, 65 | 'meta.function', 66 | 'meta.method', 67 | 'storage.type.arrow', 68 | 'entity.name.function.constructor') 69 | ) 70 | .toBe false 71 | 72 | it 'getScopesForBufferRow() returns all scopes', -> 73 | text = editor.lineTextForBufferRow(0) 74 | scopes = AtomFoldFunctions.getScopesForBufferRow(editor, 0) 75 | 76 | expect(scopes.length).toBeGreaterThan 0 77 | expected = [ 78 | 'source.js', 79 | 'meta.function.js', 80 | 'storage.type.function.js', 81 | 'entity.name.function.js', 82 | 'punctuation.definition.parameters.begin.bracket.round.js' 83 | 'punctuation.definition.parameters.end.bracket.round.js', 84 | 'variable.parameter.function.js', 85 | 'meta.delimiter.object.comma.js', 86 | ] 87 | for expectedScope in expected 88 | expect(scopes).toContain expectedScope 89 | 90 | it 'scopeInScopes() returns true when matching', -> 91 | testScopes = ['meta.function', 'meta.method', 'storage.type.arrow', 'entity.name.function.constructor'] 92 | scopes = ['meta.function'] 93 | expect(AtomFoldFunctions.scopeInScopes(scopes, testScopes)).toBe.true 94 | scopes = [ 95 | 'text.html.php.drupal', 96 | 'meta.embedded.block.php', 97 | 'source.phpmeta.function.php', 98 | 'storage.type.function.php', 99 | 'entity.name.function.php', 100 | 'punctuation.definition.parameters.begin.php', 101 | 'meta.function.arguments.php', 102 | 'meta.function.argument.no-default.php', 103 | 'variable.other.php', 104 | 'punctuation.definition.variable.php', 105 | 'meta.function.argument.array.php', 106 | 'storage.type.php', 107 | 'keyword.operator.assignment.php', 108 | 'support.function.construct.php', 109 | 'punctuation.definition.array.begin.php', 110 | 'punctuation.definition.array.end.php', 111 | 'punctuation.definition.parameters.end.php', 112 | 'punctuation.section.scope.begin.php' 113 | ] 114 | expect(AtomFoldFunctions.scopeInScopes(scopes, testScopes)).toBe.true 115 | --------------------------------------------------------------------------------