IntelliJ: Additional indent in function arguments - intellij-idea

When I use Reformat File in IntelliJ Idea, IDE adds additional space in function argument to align it in one line with function.
I can't find option in Code Style to disable in on change configuration.
Code:
export const getApplicationFormInstance = ({
consents,
dealer_code,
source,
rent_subscription,
comment = null,
...baseOptions
}: IApplicationFormOptions): FormInstanceType<IApplicationModel> => {
return false;
}
Screenshot of Error from ESLint:
I try to find way to fix it in IDE, not in ESLint like:
"#typescript-eslint/indent": "off"

Select the code you want to format differently.
Type Alt+Enter and invoke Adjust code style settings
Under the Wrapping and Braces tab uncheck the Align when multiline checkbox
That should get you the formatter behaviour you want.

Related

How to get TextEditor From TextDocument

Currently I have a TextDocument from the event callback of onWillSaveTextDocument. I want to edit this text document, but to do so I need the class TextEditor. How would I get the associated TextEditor from this TextDocument?
You can use the array vscode.window.visibleTextEditors and find the TextEditor through comparing the documents:
const editor = vscode.window.visibleTextEditors.find(
(editor) => editor.document === ev.document
);

How to select a line chart by clicking somewhere else than a datapoint in echarts?

I am using echarts to visualize multiple line-charts. When I click exactly on a datapoint I am able to select a specific line chart. However If I click elsewhere on the line, where there in no datapoint associated, the chart in not selected. I know there is a focus feature by hovering the mouse. I want the same functionality using the click event.
I am using the following method, but I am not sure how to implement it.
myChart.getZr().on('click', params => {
//to be implemented
})
Here is the configuration example for the hovering effect on echarts:
https://echarts.apache.org/examples/en/editor.html?c=multiple-x-axis
I solved this with filled-area
I put areaStyle: {} in series' option
then add the following event handler like this
myChart.getZr().on('click', function (params) {
Object.keys(params.target).filter(key => key.includes(
'__ec_inner_')).filter(key => params.target[key]
.seriesIndex != undefined).forEach(key => {
console.log(option.series[params.target[key]
.seriesIndex].name)
})
});

IntelliJ IDEA: Extract Constant in javascript

I use Ctrl Alt C to extract constants in Java, but for Javascript, esp for React/ES6, I do not find the option to extract constant in IntellJ. Also checked the context menu, but it's not there.
I need to change "CHANGE_HEIGHT" which is present locally in
return (dispatch) => {
dispatch({ type: "CHANGE_HEIGHT",
height: height });
}
to
export const CHANGE_HEIGHT = 'CHANGE_HEIGHT';
so I can use it in the reducer.
I do this manually currently, but it would be nice if we can extract it with Ctrl Alt C. Why is it not there? How do I do this?
There is no such feature:( Please follow WEB-14450 for updates.
For now I'd suggest using Extract field or Extract variable refactorings instead

How to disable validation on dijit.form.FilteringSelect?

My FilteringSelect have to set required: true but can accept any text.
The problem is when the text not match in store, the error will appear.
How can I avoid that error?
Note : This code is working well but its disable required's validator too.
this.myFilteringSelect.validate = function () {
//NoAction
};
You should use a dijit/form/ComboBox to get the desired behavior.
http://jsfiddle.net/cswing/ESwpr/

Prevent unnecessary white space in Webstorm

Is there a way to delete unnecessary white space,two space instead of one for example, when auto formatting a JavaScript file in Webstorm
before
function test () {
return 'test' ;
}
after
function test() {
return 'test';
}
At the moment it's formatted to:
function test() {
return 'test';
}
As I can see the only problem is with the number of spaces after return. I've created a new issue for it, please star/vote. If you find other cases where formatting doesn't work as expected, feel free to report them directly to YouTrack.