Skip to content

rope autoimport code action error. #647

@loujiaye

Description

@loujiaye

I use emacs`s lsp-pylsp. When i want to use autoimport function, it suggests path with src.How can i right configurate.

Image

path tree

.
├── requirements.txt
├── src
│   ├── pycache
│   ├── app.py
│   ├── config
│   ├── data
│   ├── func
│   │   ├── init.py
│   │   ├── pycache
│   │   └── rule.py
│   ├── image2config
│   │   ├── init.py
│   │   └── page.py
│   ├── model
│   │   ├── pycache
│   │   ├── database.py
│   │   ├── device.py
│   │   ├── pagetree.py
│   │   └── project.py
│   ├── other
│   ├── resource
│   │   ├── copyposition.ui
│   │   ├── copypositiondialog.ui
│   │   ├── devicemanage.ui
│   │   ├── imagedisplay.ui
│   │   ├── imageedit.ui
│   │   ├── mainpage.ui
│   │   ├── pagedisplay.ui
│   │   ├── pageedit.ui
│   │   ├── positioncompare.ui
│   │   ├── positiondialog.ui
│   │   ├── projectdialog.ui
│   │   └── projectlist.ui
│   ├── ui
│   │   ├── init.py
│   │   ├── pycache
│   │   ├── devicemanageproxy.py
│   │   ├── imagedisplayproxy.py
│   │   ├── imageeditproxy.py
│   │   ├── mainpageproxy.py
│   │   ├── pagedisplayproxy.py
│   │   ├── pageeditproxy.py
│   │   ├── positiondialogproxy.py
│   │   ├── projectdialogproxy.py
│   │   └── projectlistproxy.py
│   └── util
│   ├── pycache
│   ├── func.py
│   └── imageutil.py
└── tests
└── util
├── pycache
├── func_test.py
└── imageutil_test.py

.dir-locals.el

((python-mode .
((lsp-pylsp-configuration
. (:python (:analysis (:extraPaths ["src"]))))
(lsp-pylsp-plugins-flake8-ignore . ["E111" "E121" "E114" "E501"])
(lsp-pylsp-plugins-jedi-environment . "/Users/tong/program/project/xianyu/venv")
(lsp-pylsp-plugins-jedi-completion-extra-paths . ["src"])
(lsp-pylsp-plugins-mypy-overrides . ["--python-executable" "/Users/tong/program/project/xianyu/venv/bin/python" t])
(lsp-disabled-clients . (pyright))
)))

pyproject.toml

[tool.pylsp]
plugins.jedi_completion = { enabled = true, extra_paths = ["src"] }
plugins.pylint = { enabled = true, args = ["--max-line-length=100"] }
plugins.autopep8 = { enabled = true }
plugins.black = { enabled = true }
plugins.rope = { enabled = true }

[tool.rope]
enabled = true
python_path = ["/Users/tong/program/project/xianyu/venv/bin/python"]
save_objectdb = true
split_imports = true
source_folders = ["src"] # 源码目录
ignored_paths = ["tests"] # 排除目录

[tool.jedi_completion]
cache_for = ['PySide6', 'PySide6.QtWidgets']
extra_paths = ["src"]

[tool.flake8]
enable-extensions = "D" # 启用 docstring 规则(flake8-docstrings)
exclude = ".git,pycache,venv,test" # 排除这些目录

[tool.pytest.ini_options]
addopts = "-s"
testpaths = ["tests"]
pythonpath = ["src"]

[tool.ruff]
src = ["src"]

[tool.mypy]
mypy_path = "src"
files = ["src", "tests"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions