eclipse-wildwebdeveloper / wildwebdeveloper

Simple and productive Web Development Tools in the Eclipse IDE
https://projects.eclipse.org/projects/tools.wildwebdeveloper
Eclipse Public License 2.0
187 stars 70 forks source link

Missing preferences for fromatting JavaScript source files #492

Closed Fred-Feuerstein closed 3 years ago

Fred-Feuerstein commented 3 years ago

In the preferences of Eclipse 2020-06 there is no way to define the formatting rules for JavaScript source file in the generic editor.

The HTML-Editor has such preferences, but they do not apply to plain JavaScript source files. grafik

I think it's an important feature to customize the formatting of JavaScript files. Otherwise I cannot adhere the coding styleguide for my project and I can't use this editor.

mickaelistria commented 3 years ago

This formatter comes from the Eclipse WebTools project that is not part of Wild Web Developer (and its preferences are ignored by the Generic Editor with Wild Web Developer). Formatting is provided by the language server ( https://github.com/theia-ide/typescript-language-server ).

Fred-Feuerstein commented 3 years ago

Thanks for the answer. I don't know the details of the communication between Eclipse and the language server. As far as I understand, the formatting is done by the language server, but the file and the formatting options are sent from the client (Eclipse) to language server. Here is an extract of the the language server log, where I can see the formatting options that are sent to the server:

[t=1596459275476] LSP4E to org.eclipse.wildwebdeveloper.jsts: {"jsonrpc":"2.0","id":"8","method":"textDocument/formatting","params":{"textDocument":{"uri":"file:///D:/usr/gasx/core30vm_oracle/src/dialogs/gulpfile.js"},"options":{"tabSize":4,"insertSpaces":false}}}

So from my point of view there must be some way to configure the formatting options in Eclipse. I think I cannot configure the formatting options on the Language server side.

mickaelistria commented 3 years ago

Those default preferences are defined in WIndow > Preference > Editor > Text Editor. Currently, there is no way to define indentation preferences per file/content-type.

mbratch commented 2 years ago

Using general Text Editor settings to set indentation size for a language seems very broad. Any other language-sensitive editor, such as Visual Studio Code, allows settings specific to any language since user preferences can vary between languages. Eclipse is an otherwise very powerful IDE supporting a small variety of programming languages. It seems odd that it can't support a different indentation for formatting for each language. Do all such feature requests just get closed?

norbertroamsys commented 4 months ago

I have the same opinion than @mbratch : There SHOULD be an extra settings block for JavaScript language! In general the editor is a good alternative to Visual Studio Code. But this feature is still missing any may lead to using MS product instead. We also had some frustration for getting the formatter to do what is needed for our coding standards.