-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: add pylyzer dependency info (erg) (#3433) #3770
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
Conversation
Pylyzer requires Erg as dependency. This info is missing in default config and doc.
Opened this PR as a fixer to #3441 (update the file in |
lsp/pylyzer.lua
Outdated
@@ -22,4 +28,7 @@ return { | |||
checkOnType = false, | |||
}, | |||
}, | |||
on_new_config = function(new_config, _) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no such thing in vim.lsp.config. try before_init
? and please test that it actually works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, why not just define it directly in cmd_env
instead? Something like this:
return {
cmd = { 'pylyzer', '--server' },
cmd_env = {
ERG_PATH = vim.env.ERG_PATH or vim.fs.joinpath(vim.uv.os_homedir(), '.erg')
},
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, though that means the CWD "sticks" and won't dynamically update. I don't use this config so I have no strong opinion :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it wasn't really doing anything dynamic anyway. It was essentially just setting ERG_PATH=~/.erg
. Unless I'm missing something...?
And before_init
happens after starting the binary. So setting cmd_env
wouldn't have any effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before_init
happens after starting the binary
oh. Then cmd
should be defined as a function (again, assuming this functionality is important for users of this config)
I'm also fine with your cmd_env
suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before_init
happens after starting the binaryoh. Then
cmd
should be defined as a function (again, assuming this functionality is important for users of this config)
I'm not sure about this though. Just going by the docs:
Callback invoked before the LSP "initialize" phase, where
params
contains the parameters being sent to the server andconfig
is the config that was passed tovim.lsp.start()
. You can use this to modify parameters before they are sent.
Seems to indicate that vim.lsp.start()
has already been called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that said. I suppose cmd
being a function could be useful when you want to start a server relative to the resolved root.
For example you might want to call ./node_modules/.bin/biome
relative to that root.
Though I suppose that could also be solved by having relative paths be relative to workspace root instead of cwd (though relative paths aren't supported at all at the moment I think?).
Or do the VS Code way (or CoC, don't remember which). By using some magic marker like {root_dir}/node_modules/.bin/biome
.
Fixed, tested and it works. Not sure what's about the |
Yeah sorry. I digressed. |
Pylyzer requires Erg as dependency. This info is missing in default config and doc.