microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.55k stars 29.4k forks source link

how to disable Word Wrap globally #230128

Open harshalgithub opened 2 months ago

harshalgithub commented 2 months ago

Environment data

Version: 1.93.1 (system setup) Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 Date: 2024-09-11T17:20:05.685Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631

Expected behaviour

Whenver we use the shortcut key "alt + z" it should disable wordwrap on all jupyter Notebook Cells

Actual behaviour

It is currently running on individual cell level and whenever we reopen the VSCode, it will be wordwrap again, so need to click each cell and click alt + z to remove word wraps

Steps to reproduce:

  1. create multiple notebook input cells with large string data in single line
  2. inbetween create input cells with smaller strings
  3. and then keep individual input cell unwrapped using alt + z
  4. restart the VScode, and you will see all the cell input values are wordwrapped again.
  5. even if we save all input cells with unwrapped data ( alt + z ), after vscode restart, it will wrapped again.

Default I have made wordwrap Off everywhere. In below screenshot it shows "Modified elsewhere" popup, there also I have checked and made settings to Off. but still issue persists after restarting the VSCode.

image

amunger commented 2 months ago

The cells all have word wrap disabled for me based on that setting as expected. Can you try on a fresh profile to see if this still occurs without any other settings/extensions: Profiles: create a temporary profile

harshalgithub commented 2 months ago

Hi Aaron,

I have created profile with all default parameters named "Untitled" as is,

image

Then I have moved to File> New window with Profile > Untitled

image

Then I have opened the existing file .ipynb jupyter notebook using "Open File" menu It showed me popup for installing"Python" extension, but I cancelled it

image

As we can see in above image "results" variable was word-wrapped somehow, even though all the configurations are on Default

Thank you

amunger commented 2 months ago

is that a python cell? does this happen for new notebooks or just that specific one?

harshalgithub commented 2 months ago

Its Python Jupyter notebook cell.

I have created "Jupyter: New Jupyter Notebook" empty and saved it in newly created above "Untitled" profile with all default parameters only.

Then I copied the long json string variable and python code into its cell, and saved it.

When I pasted data, it was showing in Single line and saved it.

But when I closed workspace/profile and reopen it and then Open File .ipynb, all data was Wordwrapped.

So it happens with new jupyter notebook as well.

harshalgithub commented 1 month ago

hi @amunger , am I missing something in configuration?

amunger commented 1 month ago

But when I closed workspace/profile and reopen it and then Open File .ipynb, all data was Wordwrapped.

Are you opening it from within a different workspace? does that workspace have a settings file?

I haven't managed to reproduce this behavior, so it's really hard to say why it's happening for you.

Is a regular text editor word wrapped as well?

harshalgithub commented 1 month ago

But when I closed workspace/profile and reopen it and then Open File .ipynb, all data was Wordwrapped.

Are you opening it from within a different workspace? does that workspace have a settings file?

I mean to say that, the default profile which you have asked me initially to create in above responses, with that profile I am trying to open the file.

I haven't managed to reproduce this behavior, so it's really hard to say why it's happening for you.

Is a regular text editor word wrapped as well?

Yes its happening for regular text file as well.

Can you create a single string with 10000+ characters and try to save it in in regular text file and same string you can copy into Jupyter Notebook as well then simply save both files.

After that close the VSCode and then reopen it and then try to open both files, it will show as Wordwrapped by default and when you type "Alt+Z" then it will unwrap and show in Single line text.

I have attached VSCode Profile Exports for your reference. VSCode_Export_Profile.zip

Files : Name : Usage

1 : VSCode_Default_Profile.code-profile : Regular day to day profile 2 : VSCode_Untitled_Profile.code-profile : Created based on your initial response with "Profiles: create a temporary profile" 3 : random_string.txt : random long string text file 4 : test_random_long_string.ipynb : Jupyter Notebook cell with above same random string value

amunger commented 1 month ago

profiles and workspaces are two different concepts - a workspace is can just be the directory that is opened in vscode. Can you check the workspace settings and also what shows up when you hover over the "modified elsewhere" text.

Since this is also happening with text editors, it seems like the setting has been turned on somewhere.

image
harshalgithub commented 1 month ago

Hi Thank you @amunger

I have tried to make Everywhere "word wrap" config to "Off" in User & Workspace options,

After that I have manually made the wrapped lines to unwrap using "Alt + Z" and saved file. ( Jupyter Cell Notebook )

but after restarting VSCode, and opening the .ipynb jupyter file, issue still persists.

It Seems needs to RESET the VSCode.

amunger commented 1 month ago

Just to boil this down to a simpler repro, can you confirm this behavior:

  1. Create a new empty folder on your machine
  2. Open vs code and switch to an empty profile
  3. Open that empty folder in vscode (File: Open Folder...)
  4. create a plain text file and add a text line that is long enough to wrap (at this point it isn't wrapped)
  5. save the file
  6. close vscode and reopen with that same folder and file

:bug: the line of text is wrapped

harshalgithub commented 1 month ago

I have followed above steps,

Created EmptyFolder Opened VSCode and moved to default profile, and Opened the above Folder Created PlainTextFile.txt as below, and saved it ( its in Single Line only as per screenshot )

image

After reopening the VSCode and followed same process to open file, it shows as wordwrapped as below,

image