-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect isort config files and restart server on change. #71
Comments
@pfmoore We don't do anything special in the extension that causes it to not find I will file a bug on |
My setup was Let me know if you need more than this, or if there's any way I can do any diagnosis for you. |
For what it's worth, I can confirm that isort does pick up the config file when run with runpy:
(This is using my |
I use a |
I can try (tomorrow) putting my isort config into |
@pfmoore Can you add |
@pfmoore I just tried it myself and it also works with a
[settings]
profile=black
line_length=110
{
"profile": "black",
"line_length": 110,
"source": "<CWD>/.isort.cfg"
} So it doesn't seem to be a bug in isort or the extension. It works as expected. |
Hmm, when I did that all I got in the isort output was
But if I re-save my settings, I get the following in the isort output:
I see nothing in there about which config files are used, though... Moving my config between |
FYI the code that runs isort can be found at: vscode-isort/bundled/formatter/format_server.py Lines 139 to 146 in a01f599
|
@pfmoore are you using the isort we ship in the extension or your own copy? |
You must call And the output of |
@brettcannon as far as I know the one shipped with the extension. How could I tell? @alkatar21 I followed all of the steps you gave. You say "In the output under "sources"", but I don't see that at all. I can only assume I'm doing something wrong, but I have no idea what. (You say "Use a testfile and format imports" - I'm using right click -> "Sort imports", is that what you meant here?) |
@pfmoore Oh, sorry about my inaccuracy, I'm not part of Microsoft or otherwise involved in development and am just trying to help. "[python]": {
"editor.codeActionsOnSave": { // Format imports with isort.
"source.organizeImports": true
},
},
"isort.args": ["--show-config"], I have saved the file and isort runs automatically when saving with this setting. (Then there is the mentioned output) Right click -> Sort imports: I do not know how that works. |
Ah, that did it. Here's the Output
I see in there:
So I guess that means my I wonder if the errors I was seeing were because I'd not reloaded the extension somehow? I'll do some more experimenting, but it'll have to be tomorrow now. |
Yes, your config is read. So that is not the problem. |
OK, having reviewed things, it looks pretty clear to me that the problem was that I created my Things just went worse from there, because changing the VS Code settings file appears to restart the isort server automatically, but changing the config file doesn't, so I ended up hopelessly confused as to what was going on 🙁 I have the following suggestions for making the behaviour less surprising:
Apart from those suggestions, I think this can be closed as "user error", though. Thanks for all the help. |
@karthiknadig can you change this to a feature request to watch the config file(s) and restart the server as necessary? |
My project has a
.isort.cfg
file specifyingprofile=black
. The extension doesn't take account of this file, so I need to add the profile to my extension settings as well (and keep the two in line).The extension should respect any of the config locations that isort supports.
The text was updated successfully, but these errors were encountered: