【pycharm】【基本代码辅助】

本文详细介绍了PyCharm的基本代码辅助功能,包括语法高亮、代码补全、代码意图和查看问题等,帮助开发者更高效地编写Python代码。
摘要由CSDN通过智能技术生成

目录

Basic Code Assistance 

基本代码辅助

1 Learn about syntax highlighting and how to get code assistance.

1 了解语法突出显示以及如何获得代码帮助。

2 Code Completion 

2 代码补全

3 Syntax Highlighting 

3 语法高亮

4 Code Intentions 

4 代码意图

5 Viewing Problems 

5 查看问题

6 Conclusion 

6 结论

Basic Code Assistance 

基本代码辅助

1 Learn about syntax highlighting and how to get code assistance.

1 了解语法突出显示以及如何获得代码帮助。

In this step, we are going to talk about one of the most important reasons to use PyCharm - code assistance.
在这一步中,我们将讨论使用PyCharm的最重要原因之一-代码辅助。

2 Code Completion 

2 代码补全

First off, let’s talk about context-aware code completion, where the IDE uses all kinds of smarts to help you finish your typing. Live Templates are one such example. The keyboard shortcut is ⌘J (macOS) / Ctrl+J (Windows/Linux) but PyCharm will invoke them by default when you start typing some code that matches a Live Template. You can find a list of Live Templates in your Preferences/Settings ⌘, (macOS) / Ctrl+Alt+S (Windows/Linux) and you can also add your own.
首先,让我们讨论一下上下文感知代码完成,IDE使用各种智能来帮助您完成输入。Live Templates就是这样一个例子。键盘快捷键是 ⌘J (macOS)/ Ctrl+J (Windows/Linux),但PyCharm会在您开始键入一些与Live Template匹配的代码时默认调用它们。您可以在首选项/设置 ⌘, (macOS)/ Ctrl+Alt+S (Windows/Linux)中找到实时模板列表,也可以添加自己的模板。

Live Templates

PyCharm also offers you basic and type-based smart completion. For example, if we start typing something, PyCharm prompts with options to complete your code, so you won’t need to type the full line. For example, if you have this code in the above class and type in C, PyCharm will offer you Car.
PyCharm还为您提供了基本的基于类型的智能完成。例如,如果我们开始键入某些内容,PyCharm会提示选项来完成代码,因此您不需要键入整行。例如,如果你在上面的类中有这样的代码,并输入 C ,PyCharm将为你提供 Car 。

Basic Code Completion

If it’s the correct completion, as it is in this case, we can press Enter, and PyCharm will complete the line for you. If the correct completion is in the list, but not selected, you can use the arrows in your keyboard to go up and down to select it and then press Enter. And finally, if the correct completion is not in the list yes, you can keep typing until PyCharm figures it out for you.
如果它是正确的完成,就像在这个例子中一样,我们可以按Enter键,PyCharm将为您完成这一行。如果正确的完成在列表中,但未选中,则可以使用键盘中的箭头上下移动以选中它,然后按Enter。最后,如果正确的补全不在yes列表中,您可以继续输入,直到PyCharm为您找到为止。

Code completion is not only available

  • 29
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

资源存储库

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值