I am using IntelliJ IDEA 14 for a web project, where I want to keep a file a.js
containing a JSON object. The content of the a.js
is
{
"ac" : "abc",
"d" : 4,
"_constants": {}
}
While editing this file, IntelliJ keeps reminding me that this file has syntactic errors. It makes a hints after "ac", "d" and "_constants", before the semicolon, saying "Expecting newline or semicolon".
Does not IntelliJ IDEA accept a file containing a JSON object as a legitimate javascript file?
I am using IntelliJ IDEA 14 for a web project, where I want to keep a file a.js
containing a JSON object. The content of the a.js
is
{
"ac" : "abc",
"d" : 4,
"_constants": {}
}
While editing this file, IntelliJ keeps reminding me that this file has syntactic errors. It makes a hints after "ac", "d" and "_constants", before the semicolon, saying "Expecting newline or semicolon".
Does not IntelliJ IDEA accept a file containing a JSON object as a legitimate javascript file?
Share Improve this question edited Feb 25, 2015 at 14:34 gefei asked Feb 25, 2015 at 14:24 gefeigefei 19.9k9 gold badges54 silver badges70 bronze badges2 Answers
Reset to default 5IntelliJ has a separate file type for JSON files. It will be applied if you rename your file from a.js to a.json.
You can add file pattern to your settings
Settings->Editor->File Types->Json
For example "json-config-*.js"
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745199864a4616272.html
评论列表(0条)