Jump to content

Apologies if this is trivial but some research leads to changing tabs to spaces and im not convinced. Does anyone know how to setup vscode so it doesnt mess up while pasting?

I know it might not be secure, yeah vibecoding is cool but we shouldnt do smt unless we understand it and etc. thx but these disclaimers get old quick. maybe we shall be reminded frequently for we are stupid but i dont work at a nuclear powerplant.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/
Share on other sites

Link to post
Share on other sites

 

35 minutes ago, apoyusiken said:

mess up while pasting?

It doesnt for me. It retains the formatting.

 

What extensions do you have installed for python? 

What editor format settings you using - Command Pallet (Ctrl+Shift+P) > default or user settings > type "format" in the filter bar at top

What editor paste setting you using -= - Command Pallet (Ctrl+Shift+P) > default or user settings > type "paste" in the filter bar at top

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16813107
Share on other sites

Link to post
Share on other sites

17 minutes ago, C2dan88 said:

 

It doesnt for me. It retains the formatting.

 

What extensions do you have installed for python? 

What editor format settings you using - Command Pallet (Ctrl+Shift+P) > default or user settings > type "format" in the filter bar at top

What editor paste setting you using -= - Command Pallet (Ctrl+Shift+P) > default or user settings > type "paste" in the filter bar at top

using it vanilla really

I know it might not be secure, yeah vibecoding is cool but we shouldnt do smt unless we understand it and etc. thx but these disclaimers get old quick. maybe we shall be reminded frequently for we are stupid but i dont work at a nuclear powerplant.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16813117
Share on other sites

Link to post
Share on other sites

1 hour ago, apoyusiken said:

Apologies if this is trivial but some research leads to changing tabs to spaces and im not convinced. Does anyone know how to setup vscode so it doesnt mess up while pasting?

I don't know how VSC processes pasting but..

Use Alt Shift F to autoformat if the pasted code is messed up.

That implies there's some installed formatter for that language.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16813138
Share on other sites

Link to post
Share on other sites

17 hours ago, BootlessBuck said:

What do you mean by "mess up"?

it doesnt handle the indendation cleanly, if you just paste some stuff you cant run it right away

I know it might not be secure, yeah vibecoding is cool but we shouldnt do smt unless we understand it and etc. thx but these disclaimers get old quick. maybe we shall be reminded frequently for we are stupid but i dont work at a nuclear powerplant.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16816532
Share on other sites

Link to post
Share on other sites

10 hours ago, apoyusiken said:

it doesnt handle the indendation cleanly, if you just paste some stuff you cant run it right away

You could enable format on save.

https://code.visualstudio.com/updates/v1_6#_format-on-save

 

It still might not be perfect, if the language you're using depends on whitespace and there is some ambiguity to what has been pasted in. It should work as well as Alt+Shift+F, but without needing to take the extra step. You have to save anyway.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16816847
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
On 11/8/2025 at 7:35 PM, cute.as.kawaii said:

I have install prettier extension on VS code with custom indentation and spacing settings. With "format on save" enabled, code gets formatted automatically.

yea but how does it know the intended indentation?

I know it might not be secure, yeah vibecoding is cool but we shouldnt do smt unless we understand it and etc. thx but these disclaimers get old quick. maybe we shall be reminded frequently for we are stupid but i dont work at a nuclear powerplant.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16827868
Share on other sites

Link to post
Share on other sites

23 hours ago, Blasty Blosty said:

Because theres only 1 main way to correctly indent code

no bro, not talking about how many spaces. but i get it it can understand it.

I know it might not be secure, yeah vibecoding is cool but we shouldnt do smt unless we understand it and etc. thx but these disclaimers get old quick. maybe we shall be reminded frequently for we are stupid but i dont work at a nuclear powerplant.

Link to comment
https://linustechtips.com/topic/1624781-vs-code-pasting-python/#findComment-16828588
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×