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

vscode: improve tab size and wrapping #1271

Closed

Conversation

derrickstolee
Copy link

I've been using these settings myself for a few weeks now. Fixed some problems I saw in recent submissions.

Abhradeep was having similar issues, which drove me to actually submit the change.

Thanks,
-Stolee

cc: gitster@pobox.com
cc: chakrabortyabhradeep79@gmail.com

The contrib/vscode/init.sh script initializes the .vscode directory with
some helpful metadata so VS Code handles Git code better.

One big issue that VS Code has is detecting the tab width based on file
type. ".txt" files were not covered by this script before, so add them
with the appropriate tab widths. This prevents inserting spaces instead
of tabs and keeps the tab width to eight instead of four or two.

While we are here, remove the "editor.wordWrap" settings. The editor's
word wrap is only cosmetic: it does not actually insert newlines when
your typing goes over the column limit. This can make it appear like you
have properly wrapped code, but it is incorrect. Further, existing code
that is over the column limit is wrapped even if your editor window is
wider than the limit. This can make reading such code more difficult.
Without these lines, VS Code renders the lines accurately, without
"ghost" newlines.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
@derrickstolee derrickstolee self-assigned this Jun 27, 2022
@derrickstolee
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 27, 2022

Submitted as pull.1271.git.1656354587496.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1271/derrickstolee/vscode-improvements-v1

To fetch this version to local tag pr-1271/derrickstolee/vscode-improvements-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1271/derrickstolee/vscode-improvements-v1

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 27, 2022

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Derrick Stolee <derrickstolee@github.com>
>
> The contrib/vscode/init.sh script initializes the .vscode directory with
> some helpful metadata so VS Code handles Git code better.
>
> One big issue that VS Code has is detecting the tab width based on file
> type. ".txt" files were not covered by this script before, so add them
> with the appropriate tab widths. This prevents inserting spaces instead
> of tabs and keeps the tab width to eight instead of four or two.
>
> While we are here, remove the "editor.wordWrap" settings. The editor's
> word wrap is only cosmetic: it does not actually insert newlines when
> your typing goes over the column limit. This can make it appear like you
> have properly wrapped code, but it is incorrect. Further, existing code
> that is over the column limit is wrapped even if your editor window is
> wider than the limit. This can make reading such code more difficult.
> Without these lines, VS Code renders the lines accurately, without
> "ghost" newlines.
>
> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
> ---

Nicely described and I found it very easy to understand the
reasoning behind every change, even though I am not a regular user
of the VS Code environment.

>     Abhradeep was having similar issues, which drove me to actually submit
>     the change.
>     
>     Thanks, -Stolee

Thanks, both.

>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1271%2Fderrickstolee%2Fvscode-improvements-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1271/derrickstolee/vscode-improvements-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/1271
>
>  contrib/vscode/init.sh | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/vscode/init.sh b/contrib/vscode/init.sh
> index f139fd86444..521d3037225 100755
> --- a/contrib/vscode/init.sh
> +++ b/contrib/vscode/init.sh
> @@ -25,8 +25,12 @@ cat >.vscode/settings.json.new <<\EOF ||
>          "editor.detectIndentation": false,
>          "editor.insertSpaces": false,
>          "editor.tabSize": 8,
> -        "editor.wordWrap": "wordWrapColumn",
> -        "editor.wordWrapColumn": 80,
> +        "files.trimTrailingWhitespace": true
> +    },
> +    "[txt]": {
> +        "editor.detectIndentation": false,
> +        "editor.insertSpaces": false,
> +        "editor.tabSize": 8,
>          "files.trimTrailingWhitespace": true
>      },
>      "files.associations": {
>
> base-commit: e4a4b31577c7419497ac30cebe30d755b97752c5

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 27, 2022

This branch is now known as ds/vscode-settings.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 27, 2022

This patch series was integrated into seen via git@ee5f457.

@gitgitgadget gitgitgadget bot added the seen label Jun 27, 2022
@gitgitgadget
Copy link

gitgitgadget bot commented Jun 28, 2022

This patch series was integrated into seen via git@b18fd14.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 29, 2022

This patch series was integrated into seen via git@8efe0bb.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 1, 2022

There was a status update in the "New Topics" section about the branch ds/vscode-settings on the Git mailing list:

source: <pull.1271.git.1656354587496.gitgitgadget@gmail.com>

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 3, 2022

This patch series was integrated into seen via git@0d85e97.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 3, 2022

This patch series was integrated into next via git@fcbd2e7.

@gitgitgadget gitgitgadget bot added the next label Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant