JavaScript Code autoformat

Hi.

It seems JavaScript code formatting is in a pretty bad state.

1. Is anyone else experiencing this?
2. JetBrains - Is it considered done (thus I can report a bug) or is it
still a work in progress?

Thanks,
Amnon

7 comments
Comment actions Permalink

It seems JavaScript code formatting is in a pretty bad state.

Regarding javascript, not just the formatting is in a bad state. Just
open some real javascript files and you will see.

1. Is anyone else experiencing this?

Yes.

Ahmed.

0
Comment actions Permalink

javascript formatter is indeed in early works. Not done yet for sure.
-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Hi.

It seems JavaScript code formatting is in a pretty bad state.

1. Is anyone else experiencing this?
2. JetBrains - Is it considered done (thus I can report a bug) or is
it
still a work in progress?
Thanks,
Amnon




0
Comment actions Permalink

Regarding javascript, not just the formatting is in a bad state. Just
open some real javascript files and you will see.

Any details?


0
Comment actions Permalink

Maxim Shafirov wrote:
>> Regarding javascript, not just the formatting is in a bad state. Just
>> open some real javascript files and you will see.


Any details?

There are just too many issues in the way to work with javascript in a
confortable way.

As a proof, use some javascript files like those from the dynapi project:
http://dynapi.sourceforge.net/

and try to "jump"/navigate , see the structure, complete, etc. Than you
will see if what's happening is what a developer expects :(.

Another problem is that at the moment there's no support for
"multi-files", i.e. when working in a js file that needs methods from
another file.
Simplified scenario:
I'm not embeding javascript in HTML, so I use at least 2 javascript
files e.g: utils.js, work1.js . I reuse utils.js in a lot of situations,
and work1.js is specific to the page I'm working on.
It really makes sense that if I imported in work1.html both utils.js and
work1.js, while editing work1.js to have support for all the resouces
from utils.js.

Ahmed.
P.S. I could describe in detail all the issues with examples if you
would like, but I don't know at what degree are you interested anyway in
developing the javascript support for IDEA.

0
Comment actions Permalink

Huh,
hapilly nothing I didn't new about. That true javscript support is very basic
for the moment and doesn't always (or even rarely does) what expected.
We're planning to implement yet many improovments there but it just matter
of time if we'll be able to implement those before Irida release.
If there were volunteers :)

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Maxim Shafirov wrote:

>>> Regarding javascript, not just the formatting is in a bad state.
>>> Just open some real javascript files and you will see.
>>>
>> Any details?
>>

There are just too many issues in the way to work with javascript in a
confortable way.

As a proof, use some javascript files like those from the dynapi
project: http://dynapi.sourceforge.net/

and try to "jump"/navigate , see the structure, complete, etc. Than
you will see if what's happening is what a developer expects :(.

Another problem is that at the moment there's no support for
"multi-files", i.e. when working in a js file that needs methods from
another file.
Simplified scenario:
I'm not embeding javascript in HTML, so I use at least 2 javascript
files e.g: utils.js, work1.js . I reuse utils.js in a lot of
situations,
and work1.js is specific to the page I'm working on.
It really makes sense that if I imported in work1.html both utils.js
and
work1.js, while editing work1.js to have support for all the resouces
from utils.js.
Ahmed.
P.S. I could describe in detail all the issues with examples if you
would like, but I don't know at what degree are you interested anyway
in
developing the javascript support for IDEA.




0
Comment actions Permalink

Thanks for the update, I'll wait patiently, then...

Amnon

Maxim Shafirov wrote:

javascript formatter is indeed in early works. Not done yet for sure.
-------------------
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Huh, hapilly nothing I didn't new about. That true javscript support is
very basic for the moment and doesn't always (or even rarely does) what
expected.
We're planning to implement yet many improovments there but it just
matter of time if we'll be able to implement those before Irida release.
If there were volunteers :)

Unfortunately from the javascript plug-in source, I can't figure out how
to extend it. I suppose one needs really knowledge of IntelliJ
internals, despite of the OpenAPI.

The biggest problem is IMHO the way the parsing takes place. Due to the
dynamic orientation of javascript, one would really need some sort of
"progressive parsing". Only this way one could have really the sort of
"intelligence" one is used to, when working with java in IDEA:
E.g. if somewhere in the code there's something like

than after that statement, in the whole context of the above code, the
myFunction should be available, and everywhere else, it should be
highlighted as an error.

I don't think this is possible with the OpenAPI at the moment.

Regarding the DOM and custome object support, I think the same approach
like in the case of java could be made, plus:
- use the concept of "library", but in this case, to libraries will
belong all the javascript files in the current project/module
- javadocs like support for the parsed javascript files.
- javadoc like tags/annotations to extend information the IDE has over a
function (e.g. desired parameter type - even if one can change this
dynamicaly, desired return type, if the method is just a dummy for the
DOM/js objects,etc.)
- with the above functionality write a dummy/(wrapper) implementation of
the browser supported DOM Objects and the standard javascript objects,
as belonging to "Standard library" "Mozilla Library", "IE5.5 library",
etc., i.e. the same role that in java the JDK or the custom libraries
plays. In writting these "libraries, the comunity could help alot.

If one includes one of these "libraries"(dummy methods with javadoc
comments and annotations/tags), the editor has much more information to
provide a java similar intelligence to the user.

Unfortunately, I have no idea how to implement the above with the IDEA
OpenAPI :( - I suppose it's not even possible at the moment.

I really have no lust to do it with Eclipse/SWT, cause I think that
IntelliJ should be the better place for such "intelligent language
support" , since they started this approach with java.

Ahmed.

0

Please sign in to leave a comment.