Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JavaScript] Move JSON out of the JavaScript package #1805

Merged
merged 4 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions JSON/Comments.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.json</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>// </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>/*</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>*/</string>
</dict>
</array>
</dict>
</dict>
</plist>
67 changes: 67 additions & 0 deletions JSON/Indentation Rules.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>JavaScript Indent</string>
<key>scope</key>
<string>source.json</string>
<key>settings</key>
<dict>
<key>decreaseIndentPattern</key>
<string>(?x)
# When an object is closed, but not opened
(
^
(
# Consume strings
"(?:[^"\\]|\\.)*"
|
# Consume all chars that don't start a string, comment or
# open an object on this line
[^"/{\n]
)*
\}.*$
)
|
# When an array is closed by itself on a line (interacts with indentSquareBrackets)
(
^(.*\*/)?\s*\].*$
)
</string>
<key>increaseIndentPattern</key>
<string>(?x)
# When an object is opened, but not closed
(
^.*\{
(
# Consume strings
"(?:[^"\\]|\\.)*"
|
# Consume all chars that don't start a string, comment or
# end the object that was opened on this line
[^"/}]
)*
# Stop matching at the end of the line, or once we hit a comment
($|/[/*])
)
|
# When an array is opened, but not closed
(
^.*\[
(
# Consume strings
"(?:[^"\\]|\\.)*"
|
# Consume all chars that don't start a string, comment or
# end the array that was opened on this line
[^"/\]]
)*
# Stop matching at the end of the line, or once we hit a comment
($|/[/*])
)
</string>
<key>indentSquareBrackets</key>
<true/>
</dict>
</dict>
</plist>
2 changes: 1 addition & 1 deletion JSON/syntax_test_json.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SYNTAX TEST "Packages/JavaScript/JSON.sublime-syntax"
// SYNTAX TEST "Packages/JSON/JSON.sublime-syntax"

{
// <- meta.mapping.json punctuation.section.mapping.begin.json
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/Comments.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.js, source.json</string>
<string>source.js</string>
deathaxe marked this conversation as resolved.
Show resolved Hide resolved
<key>settings</key>
<dict>
<key>shellVariables</key>
Expand Down