Skip to content
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

Convert the path LSP setting to a list if it is a string #402

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

PedramNavid
Copy link
Contributor

@PedramNavid PedramNavid commented Mar 5, 2024

Summary

I ran into a subtle issue today where I provided a single string path:

 require('lspconfig').ruff_lsp.setup {
   init_options = {
     settings = {
     path = '~/.pyenv/shims/ruff',

Which would result in the following error:

PermissionError: [Errno 13] Permission denied: '/'

This is because we loop over the path in variable, but of course in Python, you can loop over a string and get / as the first result

for path in settings["path"]:

This change will convert the str to a simple list in case the user provides a single path rather than a list.

Test Plan

tested locally

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

@charliermarsh charliermarsh merged commit 6a50696 into astral-sh:main Mar 5, 2024
1 of 2 checks passed
@charliermarsh charliermarsh added the bug Something isn't working label Mar 5, 2024
@charliermarsh
Copy link
Member

Thanks!

@MichaReiser MichaReiser mentioned this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants