microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 769 forks source link

User should be alerted somehow if `${workspaceFolder:foo}` references unknown folder name #6146

Open debonte opened 2 months ago

debonte commented 2 months ago

Given a .code-workspace file like this:

{
    "folders": [
        {
            "path": "root1",
            "name": "name1"
        },
        {
            "path": "root2",
            "name": "name2"
        }
    ],
    "settings": {
        "python.analysis.include": ["${workspaceFolder:invalid_name}/**"]
     }
}

I don't see any feedback to the user in VS Code or the Pylance log about the invalid folder name reference in the python.analysis.include seting value. I think it would be easy to make a typo here and be confused about why it wasn't working. Or to change the workspace name and forget to change the related references.

Perhaps this should be filed on vscode?

heejaechang commented 1 month ago

include is our setting, so I dont think it is vscode's responsibility to show errors. if we want to show error, we should do but should be done at LS layer not workspace/settings layer which make it a bit wonky.

debonte commented 1 month ago

include is our setting, so I dont think it is vscode's responsibility to show errors

I was thinking that VS Code could show errors in the .code-workspace editor for any setting whose value contains ${workspaceFolder:foo} for an invalid foo. Is it not safe for them to assume the intent of that string when seen?

heejaechang commented 1 month ago

I see. ya, they might be open to the suggestion.