How to pop up code completion hint and word expand together in Webstorm? - webstorm

I want to show pop up code completion hint and word expand (which is equal to Ctrl + N in Vim). Now I type Ctrl+E to popup expand word and I type Ctrl + Shift to popup code completion hint...
Do you have any idea how this could be done?

One of the lesser-known but potentially powerful features of the keymap is that you can map multiple actions to the same shortcut. You could try doing this for the two things you want to have happen at once.
In Settings → Keymap, you can change what action is triggered by what shortcut.
You can find the actions you're looking for either by name (if you know what they're called in WebStorm), or by their shortcut (by clicking on the Find actions by shortcut button next to the action name search box).
Once you've decided which keyboard shortcut you want to trigger both actions, you can assign it to both actions. You may get a popup about possible conflicts with other actions, with an option to either Remove the other shortcuts or Leave them be.
It may be obvious at this point, but you want to Leave the other shortcut in place so that both actions will be triggered.
Hope this helps!

I don't think it's possible, check the related requests:
IDEABKL-3262 Word Completion
IDEABKL-6021 introduce new completion type similar to expand word
The first request is most likely your use case:
provide reasonable variants to complete when any completion based on context language analysis fail or absent

Related

CListCtrl search by typing: how to show what's been typed?

I have a CListCtrl in Report view, and I noticed that I can search by typing the first few letters of an item (the control selects the first item that matches as I type), and that this search "resets" after a second or so (so if I've typed "abc", pause, then type "d", then it searches for "d" only). For usability, I want the user to realize that this search-by-typing feature exists.
So here are the options I can think of, in order of preference, and the question I have in each case:
Use whatever existing built-in support there is in MFC.
Is there such a thing?
Some other solution that's been implemented before.
Again, is there such a thing?
Add another textbox to the dialog box, and handle its ON_EN_CHANGE message to somehow trigger CListCtrl's search behavior. In other words, similar to the find dialog/toolbar in browsers.
How do I trigger the search behavior?
Did take a look into the List-View controls documentation on Microsoft Docs.
This behavior is described in the Default List-View Message Processing (WM_CHAR message). The search-string is indeed reset after one second.
However, I didn't find any notification message that seems to be relative, eg returning the current search-string, which you can display. There is the
LVN_INCREMENTALSEARCH, but the documentation is rather confusing (eg what is an "incremental search"? etc), and I don't know if you are going to receive this at all, as this seems to be about Virtual List-View controls. Anyway, you can give it a try.
But resetting the test entered by the user in just 1 sec may rather be unwelcome to users or reviewers (actually I have never seen an application doing so). So you can implement some "Search" operation in your dialog, as you said add an edit box and search for its content. You can use the LVM_FINDITEM message (or the ListView_FindItem() macro) requesting a partial-match search (LVFI_PARTIAL), or do the search yourself (find the matching item and move there).

WebStorm, unable to suppress inspection for undefined function

I found this documentation on suppressing certain inspections, and I remember using it before, however for some reason it is currently not available.
I am working on a UI for a Unity project and we are injecting a JavaScript function into the DOM from Unity. In WebStorm, the function is obviously undefined. Unfortunately, in the "fix" menu, I only have the following options:
Here is what I'm expecting, based on the docs:
I remember from using it in the past that it simply puts a comment before the call, but I don't remember what it is.
How can I enable this feature again? Alternatively, what is the comment so I can manually insert it?
Just as it's written in Help article, you have to press the -> key or click the right arrow button next to Create function.... menu item to open a submenu with suppress actions
You can also suppress it by adding a comment // noinspection JSUnresolvedFunction manually

Command pattern for undo/redo: when to NOT merge undo commands?

I'm implementing an undo/redo feature in our graphical Qt5-based app, using QUndoCommands which have a nice mergeWith() feature: for example, if the user repeatedly clicks the font size increase button on my app, rather than creating a ton of commands in the undo list, it just updates one command on the QUndoStack. So a single undo will go back to the original font size.
That's great, but there are times I don't want to automatically merge commands. For example, if I drag an item to a new location and drop it there, then drag the same item to another location: my app should create 2 move commands, not merge them both into one command.
So, here's a list of events that I think create a logical break, where the user will expect a command NOT to be merged with the next command, even if the next command changes the same property of the same object:
mouse release
widget lose focus
timer (after ??? seconds)
text typing, after ??? characters (or this can be handled with the timer?)
text typing, after certain keys are pressed, such as backspace?
As indicated by the question marks in my list, I'm not really sure in what situations to suppress merging commands. So my question is, are there any best practices in this regard? Where can I find them?
FWIW, I did not find any best practices, but for my software I suppressed merges on focus change (which in my app also occurs on mouse release on the graphics part). Additionally, for typing, I suppress merges if the input position changes in a way other that as expected for deleting or typing 1 character, and if the user switches between deleting characters and typing characters.
I did not bother with the timer, or with maximum characters when typing.

How to paste information into filtered CHeaderCtrl

We have an MFC application that uses the CHeaderCtrl and have been using the HDS_FILTERBAR style to filter data. Works great. But our users want to be able to paste in text into the filter cell. I have not found a way to get a pointer to any CEdit-type of control here so that I can call >Paste. I have managed to detect a Control-V while in the filter in the application's ::PreTranslateMessage. There is a way to send text to the filter by way of a CHeaderCtrl->SetItem call, but this will immediately launch the filter. I just want to be able to paste text.
So...I tried (I was desperate) using keybd_event and SendInput to force keystrokes. This worked but had undesirable side effects, probably due to MFC's message handling, and in my case, the user already had the Control + V pressed down. But in just sending the letter 'A', and forcing the SHIFT key, I accidently discovered that the CHeaderCtrl's filter does support a paste if you:
CONTROL + SHIFT + V
The problem is its hard to do, and hard to tell my users to do this.
I can simulate this sequence using keybd_event, but again, its real quirky.
Can anyone find a way to either get access to the CEdit (if there even is one) to a filtered CHeaderCtrl or know of another workaround ? I tried using a spy utility, but was not sure what to look for. Sorry for the long post.
So remove Ctrl+V from the accelerator list and you can handle it inside the control...
(Answer added according to the comment).

Unlimited number of checkboxes

I wonder how to create mechanism which create new checkbox below previous when you click on button. Number of checkboxes are unlimited.
I don't think that table of objects work well, so I think about implementation in list of objects.
Any suggestions?
Here is what I would do:
Create an event for clicking that button (let's call it OnBtnClick)
Use a vector/list to hold all the checkboxes
When OnBtnClick is called you do:
create a checkbox with the desired position and size and make sure it receives an unique id (this will help you differentiate between checkboxes when they are clicked/checked/etc).
add the checkbox to the list (to get its status: checked or not checked)
add the checkbox to the desired window, the parent window (though this may happen automatically when you create it)
if you want to add an event for the added checkbox you should check the manual of your GUI framework (you will probably use the same event handler for all checkboxes and treat them separately based on their id)
Depending on the GUI framework used the bottom details may vary but the idea remains the same. I did this with wxWidgets, QT and MFC but I don't know which framework you use. You should be able to find code samples for each framework.
What would you do with unlimited number of check boxes - confuse the user? So, that he/she wouldn't attempt to use it again? Bad idea, as you can guess now.
You may (should) limit the number of check boxes (or better, limit the number of controls on form/dialog). IMO, more than 10-12 CBs would be cumbersome for the end user. Therefore, better idea is to have all of them on dialog/dialog-resource, and make all of them invisible/disabled. When user does some action, make them visible/enabled - so that end user may do something with it.
Still demand N number of CBs, where N is not determined beforehand? Then you may have checkboxes under Combo box, or use check-boxes under List Control. List Control already hosts this feature, but for CBs under Combo, you may need to write your own class.See this article as an example.