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

[json] issue with editor.formatOnPaste on json files #33075

Closed
shouze opened this issue Aug 24, 2017 · 3 comments
Closed

[json] issue with editor.formatOnPaste on json files #33075

shouze opened this issue Aug 24, 2017 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug json JSON support issues verified Verification succeeded
Milestone

Comments

@shouze
Copy link

shouze commented Aug 24, 2017

  • VSCode Version: 1.15.1
  • OS Version: MacOS 10.13 (17A352a)
  • Extensions:
Extension Author Version
vscode-jest Orta 2.2.0
vscode-docker PeterJausovec 0.0.16
jsx TwentyChung 0.0.1
sort-lines Tyriar 1.3.0
yaml adamvoss 0.0.7
vscode-caniuse akamud 0.5.3
vscode-theme-onedark akamud 2.0.3
theme-atom-one-dark andischerer 0.0.1
color-info bierner 0.5.0
vscode-javascript-snippets codepunkt 1.0.0
gitignore codezombiech 0.5.0
vscode-svgviewer cssho 1.4.2
vscode-eslint dbaeumer 1.2.11
vscode-babel-coloring dzannotti 0.0.4
prettier-vscode esbenp 0.22.1
flow-for-vscode flowtype 0.7.1
theme-atom-one-dark freebroccolo 0.0.1
Go lukehoban 0.6.63
hex-rgba-converter medzhidov 1.0.4
prettify-json mohsen1 0.0.3
atom-keybindings ms-vscode 3.0.1
debugger-for-chrome msjsdiag 3.1.8
vscode-json-transform octref 0.1.2
vscode-statusbar-json-path richie5um2 1.0.7
vscode-icons robertohuertasm 7.12.0
sass-indented robinbentley 1.4.1
vscode-flow rtorr 276.3.0
preview-vscode searKing 1.1.5
vscode-fileutils sleistner 2.6.2
cucumber stevejpurves 0.9.6
json-schema-validator tberman 0.1.0
change-case wmaurer 1.0.0
JavaScriptSnippets xabikos 1.4.1
commentator zerocrunch 1.0.3

Steps to Reproduce:

  1. Have the setting editor.formatOnPaste: true
  2. Have a json file opened with the following content:
{"key":"1 value"}
  1. Copy the following (multi line) text:
1 value other 10 values
  1. Paste it in place of some value
  2. Will produce that (notice the space missing between other & 10):
{"key": "1 value
other10 values"}

Expected value should be:

{"key": "1 value\nother 10 values"}

So:

  • An unnecessary trim is performed
  • Carriage returns should be replaced by a \n

This is somehow similar to #26297 (related to HTML format and fixed by microsoft/vscode-html-languageservice@c7e3770).

So I guess this should be fixed somewhere into https://github.com/Microsoft/vscode-json-languageservice/blob/master/src/services/jsonFormatter.ts

Reproduces without extensions: Yes

@vscodebot vscodebot bot added new release json JSON support issues labels Aug 24, 2017
@rebornix rebornix assigned aeschli and unassigned rebornix Nov 16, 2017
@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label Nov 17, 2017
@aeschli aeschli added this to the Backlog milestone Nov 17, 2017
@aeschli aeschli changed the title issue with editor.formatOnPaste on json files [json] issue with editor.formatOnPaste on json files Nov 17, 2017
@aeschli
Copy link
Contributor

aeschli commented Dec 1, 2017

@shouze I need some help here: You write
Copy the following (multi line) text: 1 value other 10 values.
Is there some new line missing? Should it be

1 value
other 10 values

?

@shouze
Copy link
Author

shouze commented Dec 1, 2017

@aeschli yes sorry that's it! Looks like from the most recent stable release... multi lines are no more inlined... that was cool excepting this bug.

@shouze
Copy link
Author

shouze commented Dec 4, 2017

@aeschli thx!

@mjbvz mjbvz added the verified Verification succeeded label Dec 6, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug json JSON support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants