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

Language Support for Java(TM) by Red Hat overrides expected Paste behavior #3237

Closed
andy98725 opened this issue Aug 6, 2023 · 6 comments
Closed

Comments

@andy98725
Copy link

When selecting a block of text, copying and pasting is expected to move the cursor to the end of the block. When I disable the extension, it behaves as expected. With the extension enabled, the behavior is overrided and the cursor does not move.

Environment
  • Operating System: Windows 11
  • JDK version: N/A
  • Visual Studio Code version: v1.80.1
  • Java extension version: v1.21
Steps To Reproduce
  1. Set up a fresh VSCode workspace with Language Support for Java(TM) by Red Hat
  2. Select and copy (Ctrl+C) a block of text.
  3. With the text still selected, paste (Ctrl+V).
Current Result

The block remains selected

Expected Result

The cursor should move to end of block

Additional Information

A "Show Paste options" dialogue comes up, with the options Paste using 'Language Support for Java(TM) by Red Hat' extension and Insert Plain Text. Presumably, the latter is the desired behavior, but the selection resets to the former option between each paste.

There is no setting AFAIK that disables this behavior override.

@dainank
Copy link

dainank commented Aug 7, 2023

EDIT: Solution -> #3237 (comment)

Bumping this because there needs to be a plugin setting to disable this paste override.

I understand that there is currently a little popup that lets you select the VSCode paste behaviour, however, this gets overwritten the next time you paste again through a keybinding. This is not sufficient behaviour, if anything, a bug.

@fbricon
Copy link
Collaborator

fbricon commented Aug 7, 2023

Try

"[java]": {
   "editor.pasteAs.enabled": false
},

@dainank
Copy link

dainank commented Aug 7, 2023

Try

"[java]": {
   "editor.pasteAs.enabled": false
},

This works! Thank you very much! I will amend my review of the VSCode extension.

@fbricon
I suppose that this trick can be used for all languages that get sometimes overridden by paste behaviours from plugins?

@fbricon
Copy link
Collaborator

fbricon commented Aug 7, 2023

yes, it's a VS Code setting

@bardware
Copy link

I notice there's something wrong when I want to duplicate a line of code. I select the line, press CTRL + c followed by CTRL + v twice. I expect my line to be duplicated. Still, there's only one line.
Setting editor.pasteAs.enabled as suggested helps. Still, no idea what this is supposed to mean.

@hopehadfield
Copy link
Contributor

#3444 fixes this issue. Should no longer be a problem in v1.26.0 of vscode-java.

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

No branches or pull requests

6 participants