vscode extension -- ty not discovering pyproject.toml file - missing/no configuration option for "path to config file"?
Summary
Given a project structure like this:
my_repo
├── backend
│ ├── pyproject.toml
│ ├── .venv
│ └── app
├── frontend
└── README.md
The ty extension is both able to find the executable in my .venv folder (although I suspect this is because it is the chosen environment for my vscode (cursor) project) and support go to definition for both first and third party modules.
However, rule configuration in my pyproject.toml are not respected and first party module auto imports do not work. I suspect both of these are due to the ty extension not discovering my pyproject.toml file.
If I do
[tool.ty.rules]
unsupported-operator = "ignore"
or set it to warn, a = 10 + "test" still shows as an error.
Ruff configuration still works however without me having to point it to the toml file via some setting.
A lot if not most linter extensions have some sort of "path to config file" setting (including the (now old) ruff extension on pycharm), though given how ruff auto-discovers it just fine, perhaps a setting like this is not needed and it this could be a bug in ty if not a missing feature.
Thanks! Excited to use ty in vscode
Version
0.0.2
Yes, this is a known limitation that ty only picks up your configuration if it's directly in the folder you opened in your editor or any of its ancestor directories.
I'll re-open this. While https://github.com/astral-sh/ruff/pull/22053 will help in the described instance, there will still be inconsistencies if the configuration file uses any relative paths (because the LSP resolves the paths relative to the workspace root whereas the CLI resolves them relative to the pyproject.toml).