zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.42k stars 3.01k forks source link

Cannot use autocompletion on module named "licenses.py" #16650

Open mak448a opened 2 months ago

mak448a commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Make a file called licenses.py with a class named "LicensesUI." Import that class from a file called main.py. It should have squiggly underlines saying Pyright: "LicensesUI" is unknown import symbol.

image

If needed, here's some dummy content for you to try with.

main.py

from licenses import LicensesUI

licenses.py

class LicensesUI:
    def __init__(self):
        print("init")

Environment

Zed: v0.149.3 (Zed) OS: Linux Wayland fedora 40 Memory: 15.1 GiB Architecture: x86_64 GPU: Intel(R) UHD Graphics 620 (KBL GT2) || Intel open-source Mesa driver || Mesa 24.1.6

Zed Settings

// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette
{
  "assistant": {
    "default_model": {
      "provider": "ollama",
      "model": "stablelm2:latest"
    },
    "version": "2"
  },
  "telemetry": {
    "diagnostics": false,
    "metrics": false
  },
  "base_keymap": "VSCode",
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "theme": {
    "mode": "system",
    "light": "One Light",
    "dark": "macOS Classic Dark"
  },
  "show_completions_on_input": true,
  "lsp": {
    "pyright": {
      "settings": {
        "python.analysis": {
          "diagnosticMode": "workspace",
          "typeCheckingMode": "standard"
        },
        "python": {
          "pythonPath": ".venv/bin/python"
        }
      }
    }
  },
  "languages": {
    "Python": {
      "format_on_save": "on",
      "formatter": [
        {
          "language_server": {
            "name": "ruff"
          }
        }
      ]
    }
  }
}

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

JosephTLyons commented 2 months ago

Hey @mak448a, I'm not actually able to reproduce this:

SCR-20240823-obxj

What does your directory tree look like and what happens if you restart the language server with editor: restart language server?

mak448a commented 2 months ago

image Still happens. It did take a bit to reappear though.

mak448a commented 2 months ago

The files are in a folder called src. When I opened the folder src as a project, the autocomplete works fine. It's only bugging out when it's in the subfolder. @JosephTLyons