Closed andfoy closed 4 years ago
Unfortunately, this PR does not fix spyder-ide/spyder#13110.
After pulling this into my Spyder subrepo (installed during bootstrap) the same behavior I described here is exhibited. watched_folders
doesn't seem to do anything.
@ccordoba12 , your recent changes have not fixed the issue.
The log entries "Reading config from " and "Got user config from PyCodeStyleConfig" confirm that configurations files are found and configurations loaded from ~/.config/pycodestyle
and path/to/project/pycodestyle.cfg
, but are still ineffective. If a configuration file is placed in ~/.spyder-py3-dev/lsp-root-path/
, it is effective.
@ccordoba12 , your recent changes have not fixed the issue
They have. I'll open a PR in the Spyder repo with a test for this, so you can see that that's the case.
Perhaps I'm doing something wrong, then. I've pulled these changes into my fork of python-language-server, then used git-subrepo to update it in the subrepo of my local spyder repo, then run from bootstrap, which installs and uses the python-language-server from the spyder subrepo. I've reset Spyder configuration settings, then enable code style linting. If I place a pycodestyle.cfg in a project and open that project, the lsp logs indicate that the file is found and the configuration is loaded, but the linting in the editor is wrong. If I place that same config file in ~/spyder-py3-dev/lsp-root-path, then it works.
Sorry, you were right. There's a single case where this works right now: when Spyder starts with an open project. Otherwise, after switching projects Spyder needs to tell Jedi to extend its sys.path
with the project's directory. And that overwrites the pycodestyle config read from a file with our own (because we're sending our entire config, there's no way to send just a fraction of it).
@ccordoba12 , this works well on my end, now. I don't want to be too fastidious, but for an open project pycodestyle.cfg is monitored for changes (i.e. "Handling notification from client {'method': 'workspace/didChangeWatchedFiles' ...") while outside of a project ~/.config/pycodestyle is not monitored and Spyder must be restarted to load any changes. Is it possible to add the user config file to watched files when outside of a project?
this works well on my end, now.
Great to know!
outside of a project ~/.config/pycodestyle is not monitored and Spyder must be restarted to load any changes
That's strange because that file is read every time a linting request is processed. I'll take a look at it.
outside of a project ~/.config/pycodestyle is not monitored and Spyder must be restarted to load any changes
Sorry but I took a quick look at this and I couldn't find an easy way to add that functionality. Since the error you reported is already fixed, I think that's enough for now.
Of course, you're welcome to open a PR to solve that problem. I agree it'd be nice to have, but it's not critical.
Of course, you're welcome to open a PR to solve that problem. I agree it'd be nice to have, but it's not critical.
Agreed. Thanks a lot for taking care of this.
This also gives more priority to the user config over the client one, so the last doesn't overshadow the first.
Fixes https://github.com/palantir/python-language-server/issues/819