英文:
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:
and here how it looks on 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
and here how it looks in 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论