microsoft/vscode-autopep8

The extension uses black instead of autopep8

vadim-su opened this issue · 5 comments

function getArgs(namespace: string, workspace: WorkspaceFolder): string[] {
const config = getConfiguration(namespace, workspace.uri);
const args = config.get<string[]>('args', []);
if (args.length > 0) {
return args;
}
const legacyConfig = getConfiguration('python', workspace.uri);
return legacyConfig.get<string[]>('formatting.blackArgs', []);
}
function getPath(namespace: string, workspace: WorkspaceFolder): string[] {
const config = getConfiguration(namespace, workspace.uri);
const path = config.get<string[]>('path', []);
if (path.length > 0) {
return path;
}
const legacyConfig = getConfiguration('python', workspace.uri);
const legacyPath = legacyConfig.get<string>('formatting.blackPath', '');
if (legacyPath.length > 0 && legacyPath !== 'black') {
return [legacyPath];
}
return [];
}

Some logs
2023-05-15 07:35:04.058 [info] Name: autopep8
2023-05-15 07:35:04.058 [info] Module: autopep8
2023-05-15 07:35:04.058 [info] Python extension loading
2023-05-15 07:35:04.058 [info] Waiting for interpreter from python extension.
2023-05-15 07:35:04.058 [info] Python extension loaded
2023-05-15 07:35:04.058 [info] Server run command: /workspaces/test/.venv/bin/python /home/vscode/.vscode-remote/extensions/ms-python.autopep8-2023.3.10961007/bundled/tool/lsp_server.py
2023-05-15 07:35:04.058 [info] Server: Start requested.
2023-05-15 07:35:06.387 [info] CWD Server: /workspaces/test
2023-05-15 07:35:06.388 [info] sys.path used to run Server:
   /home/vscode/.vscode-remote/extensions/ms-python.autopep8-2023.3.10961007/bundled/libs
   /home/vscode/.vscode-remote/extensions/ms-python.autopep8-2023.3.10961007/bundled/tool
   /usr/local/lib/python311.zip
   /usr/local/lib/python3.11
   /usr/local/lib/python3.11/lib-dynload
   /workspaces/test/.venv/lib/python3.11/site-packages
   /workspaces/test
2023-05-15 07:35:06.390 [info] PYTHONPATH env variable used to run Server:
   /home/vscode/.vscode-remote/extensions/ms-python.autopep8-2023.3.10961007/bundled/libs:
2023-05-15 07:35:06.391 [info] Settings used to run Server:
[
    {
        "cwd": "/workspaces/test",
        "workspace": "file:///workspaces/test",
        "args": [],
        "path": [
            "/usr/local/py-utils/bin/black"
        ],
        "interpreter": [
            "/workspaces/test/.venv/bin/python"
        ],
        "importStrategy": "useBundled",
        "showNotifications": "off"
    }
]
 "path": [
            "/usr/local/py-utils/bin/black"
        ],

It completely destroyed my project 😞

Well, now I need to clean up the changes in 24 files

Oh my gosh! Sorry about this I fixed this in #86

It should be available in the next pre-release.

@suharnikov I just published a pre-release 2023.3.11351702 with this fixed. Please try that out and let me know. Thanks

Thanks! It pretends to work)