Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension doesn't seem to respect acceptSelectedSuggestion #30

Open
figurae opened this issue Jul 1, 2024 · 2 comments
Open

Extension doesn't seem to respect acceptSelectedSuggestion #30

figurae opened this issue Jul 1, 2024 · 2 comments

Comments

@figurae
Copy link

figurae commented Jul 1, 2024

Hi! Thanks for this great extension. I seem to have a problem though.

It seems that code completion for things like register and label names provided by this extension is handled differently from other completions. When I change the keybinding for acceptSelectedSuggestion from Enter to something else, pressing enter still completes the selection, except now it also moves the cursor down. Snippets respect the change, though.

@mborik
Copy link
Owner

mborik commented Jul 5, 2024

Hi. Thank you for reporting, but I honestly can't imagine your situation and the problem that is happening to you at all. Can you give me more details, your extension settings and specific VSCode settings? A test scenario that I could simulate and reproduce would help (or short video).

@figurae
Copy link
Author

figurae commented Jul 6, 2024

Certainly. I'm doing this on a fresh VSCode profile and the only extension installed is Z80 Macro-Assembler. All settings are left at default values.

Now, if I open a .js file and type cons, I get a code completion popup:

001

When I press enter, the code completes with the cursor remaining at the end of the same line:

002

Now, let's move to an .asm file, which triggers the Z80 Macro-Assembler extension. I type [tab]ld h to get the code completion popup:

003

Now, when I press enter on hl, I get the same behaviour as in the .js file, hl is completed and the cursor remains at the end of the same line:

004,png

On a side note, I noticed that this only works in this manner for the first register, if I try to complete the second register, like so:

005

Pressing enter not only completes the register name, but also moves the cursor down to the next line:

006

I understand the reasoning behind this, but I think it would be nice if this behaviour was adjustable, as I often like to write a comment on the same line after the second register. Anyway, back to the issue at hand. ;)

Now, let's change the default keybinding for accepting popup selections, i.e., acceptSelectedSuggestion:

007

Normally, I like to use something like ctrl+enter, but let's change it to f to make certain there's no enter anywhere:

008

Now, when I type cons in the .js file, see the completion popup, and press enter, I get:

009

Which is the expected result as enter is no longer bound to the completion action. However, when we move to the .asm file and attempt to press enter after [tab]ld h and moving the cursor to hl, we get:

010

So the code still completes with enter, even though the key is no longer bound to this action. Additionally, the cursor moves to the next line, as, I think, it both accepts the completion and reads enter as a normal press of an enter key. When I press enter after [tab]ld hl,b and selecting bc from the list, I get this:

011

The cursor is now two lines down. I think it's because the code completion action includes one enter when completing the second register and now it also registers the keypress as a normal enter as well, resulting in two enters.

Expected behaviour: I would expect the code not to complete at all when pressing a key that is not bound to the acceptSelectedSuggestion action. In such case, I would expect the editor to just react to the key like normal, ignoring code completion, like this:

012

And I would also expect the code completion action not to move the cursor down depending on whether I'm completing the first or the second register name (does this need a separate issue, or is it okay if I just write it here?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants