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

ruff lsp is weird, potentially add to readme? #698

Open
yash-fn opened this issue Sep 4, 2023 · 1 comment
Open

ruff lsp is weird, potentially add to readme? #698

yash-fn opened this issue Sep 4, 2023 · 1 comment

Comments

@yash-fn
Copy link

yash-fn commented Sep 4, 2023

ruff-lsp global and workspace config is weird. instead of using:
for workspace config:

   "ruff-lsp": {
          "workspace_config": {
		  ...
	  }
   }

it chooses to use:

   "ruff-lsp": {
      "initialization_options": {
        "globalSettings": {
		  ...
        },
        "settings": {
		  ...
        }
      }
   }

i.e. workspace_config becomes initialization_options.settings or initialization_options.globalSettings

Just mentioning this here for future confused users.

Thanks!

@lmmx
Copy link

lmmx commented Dec 15, 2023

Thank you for sharing this was confusing me too! Can you share how to configure a setting this way?

I'm trying this and getting no change (the pyright config is helpfully demonstrated in the setup script)

let g:lsp_settings_filetype_python = ['ruff-lsp', 'pyright-langserver']

" Configure the Pyright and Python LSP servers
let g:lsp_settings = {
\   'ruff-lsp': { 
\     'disabled': v:false,
\     'initialization_options': {
\       "globalSettings": {
\         'python': {
\           'format': {
\             'args': ['--unsafe-fixes']
\           }
\         }
\       }
\     }
\   },
\   'pyright-langserver': {
\     'disabled': v:false,
\     'workspace_config': {
\       'python': {
\         'analysis': {
\           'useLibraryCodeForTypes': v:true,
\         }
\       }
\     }
\   },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants