visual-studio 代码语法突出显示不起作用

问题描述 投票:0回答:0

自昨天(2023 年 3 月 24 日)以来,Visual Studio 代码突出显示无法正常工作。将鼠标悬停在上方时,没有从其他文件导入的函数或类的定义。在终端中运行代码没有任何问题,但我无法访问我创建的方法的定义。

VS Code 版本:1.76.2(通用) 安装的扩展:Python + Pylance + isort

Issue

我的文件夹结构:

- 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"]
    
}

如果有人能帮助我,我将不胜感激,因为需要继续从事这个项目并且无法访问我自己定义的类和方法会使我的工作速度变慢(然后我必须去文件并检查)

  1. 重新安装扩展。
  2. 从我的 Mac 中完全删除了 VSCode。
  3. 手动删除这些文件:
- ~/.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
  1. 在步骤 3 之后重新安装 VSCode。
python visual-studio-code pylance
© www.soinside.com 2019 - 2024. All rights reserved.