mattn / vim-lsp-settings

Auto configurations for Language Server for vim-lsp
MIT License
1.27k stars 229 forks source link

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

Open yash-fn opened 10 months ago

yash-fn commented 10 months ago

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 commented 7 months ago

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,
\         }
\       }
\     }
\   },