Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Moved TreeIndenter config to code as suggested
Browse files Browse the repository at this point in the history
This is to have it all in one place.
  • Loading branch information
chfritz committed Jan 7, 2019
1 parent 955bc72 commit 99f24f3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
30 changes: 29 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,36 @@ exports.activate = function () {
})
}

// This feels hacky. Better suggestions welcome.
const grammar = atom.grammars.grammarForId('source.js')

grammar.scopes = {
indent: {
array: true,
object: true,
arguments: true,
statement_block: true,
class_body: true,
parenthesized_expression: true,
jsx_element: true,
jsx_opening_element: true,
jsx_expression: true,
switch_body: true,
comment: true },
indentExceptFirst: {
member_expression: true,
assignment_expression: true,
expression_statement: true,
variable_declarator: true,
lexical_declaration: true,
binary_expression: true },
types: {
indent: {},
outdent: {
access_specifier: true
}
}
}

grammar.precedingRowConditions = (node) => (
(node.parent.type == 'while_statement' && node.type != 'statement_block')
|| (node.parent.type == 'jsx_self_closing_element' && node.type != '/')
Expand Down
24 changes: 0 additions & 24 deletions settings/language-javascript.cson
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,3 @@
'decreaseIndentPattern': '(?x)
^ \\s* (\\s* /[*] .* [*]/ \\s*)* [}\\])]
'
scopes:
indent:
array: true
object: true
arguments: true
statement_block: true
class_body: true
parenthesized_expression: true
jsx_element: true
jsx_opening_element: true
jsx_expression: true
switch_body: true
comment: true
indentExceptFirst:
member_expression: true
assignment_expression: true
expression_statement: true
variable_declarator: true
lexical_declaration: true
binary_expression: true
types:
indent: {}
outdent:
access_specifier: true

0 comments on commit 99f24f3

Please sign in to comment.