jshinonome / vscode-q

vscode kdb+/q extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Ctrl+q enhancements

travis-leith opened this issue · comments

Would be good to have Ctrl+q automatically advance the cursor to the next line, so that I can execute line by line using only Ctrl+q, without having to move the cursor myself.

A stretch goal (but I think this may be more challenging) is to have the language server recognize the boundaries of an expression, which may exist across multiple lines, and have Ctrl+q execute the expression that the current line is a part of, and then move the cursor to the start of the next expression.

This is an interesting request. I will probably use a different shortcut for this feature.

If you remap ctrl+q to ctrl+enter, you get most of this functionality for free, since vs code automatically handles the cursor move. At least my vs code does. Hopefully this is not a result of some other extension I have.

I didn't use ctrl + enter because there is a conflict. If two commands are assigned to the same shortcut, it will trigger only one of them.
You can remap the shortcut to anything you want, by the way.

Are you saying there is a conflict already with ctrl+enter? Or are you saying that likely will be a conflict because of how common this shortcut is among other extensions?
If the former, then it is probably not a good idea for me to remap, right?

The former, the default setting is that ctrl+Enter will add a new line after the current line.
If you prefer to use ctrl+Enter and you are willing to give up this add a new line feature, you can remap it.

Oh I see. I was hoping it would be possible to add to that behavior, rather than replace it. I guess not.

Anyway, I will explore this feature and add it.

@travis-leith, I just released(v2.3.6) this feature, please use ';' to separate the code block if possible.
The shortcut is ctrl+e.

Has this been pushed to vs code market place?
image

In 1 place I can see the current version is 2.3.6 but in another it tells me the current version is 2.3.5, which is what I am told is the currently installed version, and I see no option to update.

Yes, I have pushed the release. You have to upgrade your vscode first. I always target at latest vscode, which should be v1.62

Yes, I have latest vscode. But I think vscode extensions might be nerfed somehow by my IT dept. Another out of date extension I have shows the same problem. I tried reinstalling the extension but it just installs 2.3.5 again. Will play around with it. Might have to reinstall vscode entirely.

Ok, got everything updated, and it is responding to ctrl+e. What exactly is the difference in expected behavior of ctrl+e vs ctrl+q?

Done some testing, works well provided you know some quirks. This will be a nice quality of life improvement.

Is seems to be based on expressions ending with ;. Is that right? If the cursor is placed before the final ;, it works well. If the cursor is placed just after the final ;, it seems to try to execute the rest of the file.

Doesn't seem to like this

\S 1234;
>>> ERROR: domain
>>> Explanation: Out of domain
>>>
  [3]  \S 1234;
       ^
<<<

but it execute this just fine

(\S 1234);

not sure if this is something to do with ctrl+e, or something to do with the q interpreter.

Thank you for this.

Thanks for the update, I will take a look at your case.
You don't need to add semicolon to those lines start with '\'. The parser can detect most statement scope without a semicolon.