在代码编辑器中使用较短的行,但在推送到GitHub存储库时使用较长的行。

huangapple go评论103阅读模式
英文:

Having shorter lines in code editor, but longer ones when get pushed to github repo

问题

I am experiencing an issue where the code lines in VS Code appear normal, but when I push the code to GitHub, the lines become excessively long with horizontal scrolling. This happens particularly when writing comments.

Here how a portion of the code look in VS Code:

在代码编辑器中使用较短的行,但在推送到GitHub存储库时使用较长的行。

and here how it looks on GitHub:

在代码编辑器中使用较短的行,但在推送到GitHub存储库时使用较长的行。

Initially, both the editor and GitHub displayed long code lines. I adjusted the editor's settings, specifically the word-wrap property and word wrap column, hoping that it would also apply to GitHub. Unfortunately, the changes did not reflect on GitHub.

I am seeking a solution to ensure that the code appears consistently in both the code editor and on GitHub.

英文:

I am experiencing an issue where the code lines in VS Code appear normal, but when I push the code to GitHub, the lines become excessively long with horizontal scrolling. This happens particularly when writing comments.

Here how a portion of the code look in vs code

在代码编辑器中使用较短的行,但在推送到GitHub存储库时使用较长的行。

and here how it looks in github

在代码编辑器中使用较短的行,但在推送到GitHub存储库时使用较长的行。

Initially, both the editor and GitHub displayed long code lines. I adjusted the editor's settings, specifically the word-wrap property and word wrap column, hoping that it would also apply to GitHub. Unfortunately, the changes did not reflect on GitHub.

I am seeking a solution to ensure that the code appears consistently in both the code editor and on GitHub.

答案1

得分: 1

以下是翻译好的部分:

"这些行实际上过长。您需要在您的代码中添加换行符。您已经告诉VSCode在实际上没有换行的地方断开行。

例如,假设这是一个非常长的注释:

# This is some very long comment

它应该变成类似这样:

# This is some very
# long comment

由于您正在使用Python,您应该限制行长;参见PEP 8。"

英文:

The lines are in fact excessively long. You need to add line breaks in your code. You've told VSCode to break lines where there aren't actually line breaks.

For example, pretend this is a very long comment:

# This is some very long comment

It should become something like this:

# This is some very
# long comment

Since you're using Python, you should be limiting the line length anyway; see PEP 8.

huangapple
  • 本文由 发表于 2023年4月11日 04:37:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75980529.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定