VSCode 智能感知不适用于 pygame [英] VSCode Intellisense not Working for pygame

查看:59
本文介绍了VSCode 智能感知不适用于 pygame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 pygame 中编码时,我意识到 VSCode 没有为相当多的 pygame 模块显示 itellisense,而是将这些模块显示为 变量.经过一些挖掘后,我发现如果你做 import pygame.display as display,智能感知显示只是 fine.有没有什么方法可以在不导入这些模块的情况下使用智能?

While coding in pygame, I realised that VSCode was not showing up itellisense for quite some pygame modules, and instead showed those modules as variables. After some digging, I found out that if you do import pygame.display as display, the intellisense show up just fine. Is there any way in which I can use intelliense without importing these modules like this?

推荐答案

'Autocomplete and IntelliSense' 由 Python Server 提供.在 vscode 中,基本上你可以选择绝地"或微软",它们的作用不同.老实说,两者都不够好,如果你利用Pycharm,你不会遇到这个问题.

'Autocomplete and IntelliSense' was provided by Python Server. In vscode, basically you can choose 'Jedi' or 'Microsoft', and they are with different actions. Honestly, both of them are not well enough, if you take advantage of Pycharm, you will not come across this problem.

在绝地"中:

'from pygame import display', 'from pygame import display as display':display 将被视为一个变量,因此它们不起作用.

'from pygame import display', 'from pygame import display as display': display will be treated as a variable, so they don't work.

'import pygame.display as display':display 会被当作一个模块,所以它可以工作.

'import pygame.display as display': display will be treated as a module, so it works.

'from pygame import *':它不起作用,因为找不到模块'pygame'或'camera'.

'from pygame import *': it doesn't work, because can't find module 'pygame' or 'camera'.

在微软"中:

'import pygame.display', 'import pygame.display as display', 'from pygame import display', 'from pygame import display as display', 'from pygame import *': display将被视为一个模块,所以它们有效.

'import pygame.display', 'import pygame.display as display', 'from pygame import display', 'from pygame import display as display', 'from pygame import *': display will be treated as a module, so they works.

这篇关于VSCode 智能感知不适用于 pygame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆