自昨天(2023 年 3 月 24 日)以来,Visual Studio 代码突出显示无法正常工作。将鼠标悬停在上方时,没有从其他文件导入的函数或类的定义。在终端中运行代码没有任何问题,但我无法访问我创建的方法的定义。
VS Code 版本:1.76.2(通用) 安装的扩展:Python + Pylance + isort
我的文件夹结构:
- Project Python
- Main.py
- Amplitude_Tools
- __init__.py
- Replacetor.py
- Important_Functions.py
- More files with classes.
这就是我的 .JSON 的样子:
{
"security.workspace.trust.enabled": false,
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.autoBuild.run":"onFileChange",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
"editor.wordWrap": "on",
"editor.tabCompletion": "onlySnippets",
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 17,
"workbench.editor.untitled.hint": "hidden",
"latex-utilities.message.update.show": false,
"window.commandCenter": false,
"[python]": {
"editor.formatOnType": true
},
"workbench.tree.renderIndentGuides": "none",
"editor.guides.highlightActiveIndentation": true,
"editor.guides.indentation": false,
"git.openRepositoryInParentFolders": "never",
"editor.indentSize": "tabSize",
"workbench.statusBar.visible": false,
"workbench.activityBar.visible": false,
"python.defaultInterpreterPath": "/usr/local/bin/python3.10",
"python.analysis.autoSearchPaths" : true,
"python.analysis.autoImportCompletions":true,
"python.languageServer": "Pylance",
"python.analysis.extraPaths":["/.source"]
}
如果有人能帮助我,我将不胜感激,因为需要继续从事这个项目并且无法访问我自己定义的类和方法会使我的工作速度变慢(然后我必须去文件并检查)
- ~/.vscode
- ~/Library/Application Support/Code
- ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.microsoft.vscode.sfl*
- ~/Library/Caches/com.microsoft.VSCode.ShipIt
- ~/Library/Caches/com.microsoft.VSCode
- ~/Library/Preferences/ByHost/com.microsoft.VSCode.ShipIt.*.plist
- ~/Library/Preferences/com.microsoft.VSCode.helper.plist
- ~/Library/Preferences/com.microsoft.VSCode.plist
- ~/Library/Saved Application State/com.microsoft.VSCode.savedState