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

Using "o" and "O" in jsdoc style comments fails to create comment line leaders in correct alignment or at all #8784

Open
CanonRouge24 opened this issue Dec 18, 2023 · 1 comment

Comments

@CanonRouge24
Copy link

CanonRouge24 commented Dec 18, 2023

Describe the bug/Steps to reproduce the behavior:
In my current VSCode setup, it seems only JSDoc-style block comments get the asterisk line leaders auto-inserted.

  1. In Insert mode, using Enter, Ctrl + Enter, Ctrl + Shift + Enter (in other words, all the default VSCode behaviors) work as expected.
  2. In Normal mode, hitting just "o" will add the leading asterisk and a space, which is great.
  3. In Normal mode, hitting just "O" will not add the leading asterisk and the space afterwards. The cursor ends up at the same indentation level as where the asterisk would go, in Insert mode. I would then have to type the asterisk and the space manually.
  4. In Normal mode, using a count and "o" will go from this:
    image
    to this monstrosity ("2o" was used. As far as I know, where the cursor is placed on the line when the keybind is inputted does not matter):
    image
  5. In Normal mode, using a count and "O" will essentially scale up the problem in number 3. Typing the asterisk and space is the manual fix here as well, since there's already a cursor on all the lines ("2O" was used with the cursor on line2/the block terminator/"*/"):
    image

Steps To Reproduce

  1. Open a blank file
  2. Change file type to JavaScript or JavaScript module (or probably the other variations too)
  3. Start a JSDoc style comment with /**
  4. Hit Enter to get the first auto-generated line leading asterisk.
  5. Optionally format the terminating sequence to be in line with the other two lines (it's moved to the next line with no leading space)
  6. Try out any of the above examples in the bug description section.

Expected behavior
Something like this: (I personally wouldn't mind if cursor only ended up on the upper-most line for "O" and lower-most line for "o" either)
image

Environment (please complete the following information):
I really hope this isn't just an issue with my setup.

  • Extension (VsCodeVim) version: 1.27.1
  • VSCode version: 1.85.1
  • OS: Windows 11

Additional context
I did try fixing this using the various JSON remapping facilities

{
  // ...
  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": [
        "o"
      ],
      "commands": [
        "editor.action.insertLineAfter",
      ],
      "after": [
        "i"
      ]
    },
    {
      "before": [
        "O"
      ],
      "commands": [
        "editor.action.insertLineBefore",
      ],
      "after": [
        "i"
      ]
    }
  ]
}

Somewhat frustratingly, it works perfectly "fine" (as far as I was concerned or aware of) for "O", with and without the count, but will not work past the first line with "o". I tweaked it a bunch, trying to use the recursive version of keymaps to take advantage of the working "O" behavior and whatnot, but to no avail. I believe using these keymaps also inherently drops the feature of "o/O" copying the typed line multiple times (indicated by the (lack of) multiple cursors)

@CanonRouge24
Copy link
Author

Is there a way to get "o" to bind to "Ctrl+Enter" and "O" to bind to "Ctrl+Shift+Enter"?
#8786 would a change have to be made similar to this?

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

1 participant