zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

Paste code into zmodel doesn't work

Open sw34 opened this issue 10 months ago • 5 comments

Description and expected behavior When creating a new model, I tried copying an existing model or really anything within a .zmodel file and it will initially paste but them immediately get deleted. You can type into the file, but pasting anything will not work.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • VSCode 1.97.2
  • ZenStack Language Tools 2.11.1

sw34 avatar Feb 17 '25 14:02 sw34

Hi @sw34 , this sounds very strange. Do you see any error in the VSCode extension output panel?

ymc9 avatar Feb 21 '25 05:02 ymc9

None. Attached is a screen recording, I am pasting a line repeatedly, you can see it flash on screen and get removed, then after about 10 or 12 attempts if finally pastes in.

https://github.com/user-attachments/assets/bbc11e48-ccaf-4be4-885d-f0b9adf4f032

sw34 avatar Feb 24 '25 19:02 sw34

Very strange ... does it happen to any model you work on? Or just one specific model. Do you have other vscode extension that can potentially interfere?

ymc9 avatar Feb 25 '25 15:02 ymc9

Any model does this.

My default formatter is set to None (null), and Prettier does not show as active when a zmodel file is loaded but as soon as I disable the Prettier extension and reload VSCode, pasting works fine. If I re-enable Prettier it goes back to as shown in the video.

["INFO" - 2:13:24 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 2:13:24 PM] Extension Version: 11.0.0.

sw34 avatar Feb 25 '25 19:02 sw34

I saw the update to the extension, and have added this to my settings file

"[zmodel]": {
    "editor.defaultFormatter": "zenstack.zenstack"
  },

I can now copy a whole model file, which I was not able to do before.

Copying a single property, it will work sometimes but not always. Only common thing I can see when it works is I am pasting at the same indent level as the other properties.

sw34 avatar Mar 12 '25 15:03 sw34