How to mark a file as json without the json extension?

Hello, I am using PhpStorm 1.0.2.

I have json files that are used to generate code and they have a .jodl extension. I couldn't figure out how to associate that extension so that it works like the .json extension files.

Currently, *.json files are linked to "JavaScript files". I tried adding *.jodl to the list, but a file containing {"a": 1} is marked as having syntax errors.  That may not be valid JavaScript but it is valid JSON.

There must be something special about *.json files that they get treated specially.

Changing my files to .json is not possible, our build system recognizes file extensions and chooses the "compiler" to use based on the extension, so each category of json files need to have their own extension.

Regards,

5 comments

Hi Juan,

I have tried the same on latest EAP build (v2 beta), but got exactly the same results as you.

How flexible your build system is? Here is an idea -- give such file double extension -- for example project.jodl.json. I see no problems with this (especially if you can put such rules before rules for normal *.json files, if you have any of course) -- unless your build system is really simple/restrictive and does not understand/cannot accept double extensions.

0

Thanks Andriy. That actually is what I ended up doing. I was a little afraid that I would run into problems with ambiguous make rules. Right now I'm having a hard time getting "make" to create an automatic rule for .jodl.json.

I would like to see it fixed because it seems like there's some hack in intellij that makes "*.json" work. I think it should be a different file type, not bundled with "JavaScript file type".

Regards

0

Hi Juan,

I'm absolutely agree with you on this -- it better have a separate file type entry.

I would recommend you to post this at bug & issue tracker (if you want to have it fixed "properly") here: http://youtrack.jetbrains.net/issues/WI#newissue=yes (not sure if this should be marked as feature request or as bug report ... maybe first option).

0

This was fixed on Thursday, November 11, 2010 6:05:13 PM MSK
http://youtrack.jetbrains.net/issue/WI-3860#content-tab=1

Pretty fast I would say! Props to the intellij people for listening...

0

Please sign in to leave a comment.