11local lspconfig = require (" lspconfig" )
2+ local py = require (" modules.lsp.utils.python_help" )
23
34-- WARN: Dont remove this files
45require (" modules.lsp.installer" )
@@ -38,6 +39,8 @@ local servers = {
3839 " --pch-storage=memory" ,
3940 },
4041 },
42+ -- basedpyright = {},
43+ -- pyright = {},
4144}
4245for server , config in pairs (servers ) do
4346 lspconfig [server ].setup (vim .tbl_deep_extend (" force" , {
4952local pyright = {
5053 on_attach = on_attach ,
5154 settings = {
52- pyright = {
53- disableOrganizeImports = false ,
54- },
5555 python = {
5656 analysis = {
5757 indexing = true ,
@@ -71,73 +71,37 @@ local pyright = {
7171 },
7272 },
7373 },
74- --[[ settings = {
75- python = {
76- analysis = {
77- indexing = true,
78- typecheckingmode = "basic",
79- -- diagnosticmode = "openfilesonly",
80- diagnosticmode = "workspace",
81- inlayhints = {
82- variabletypes = true,
83- functionreturntypes = true,
84- },
85- stubpath = vim.fn.expand("$home/typings"),
86- diagnosticseverityoverrides = {
87- reportunusedimport = "information",
88- reportunusedfunction = "information",
89- reportunusedvariable = "information",
90- },
91- },
92- },
93- }, ]]
9474}
9575
9676local jedi = {
9777 on_attach = on_attach ,
98- capabilities = capabilities ,
99- settings = {
100- python = {
101- analysis = {
102- indexing = true ,
103- typeCheckingMode = " basic" ,
104- diagnosticMode = " workspace" ,
105- inlayHints = {
106- variableTypes = true ,
107- functionReturnTypes = true ,
108- },
109- stubPath = vim .fn .expand (" $HOME/typings" ),
110- diagnosticSeverityOverrides = {
111- reportMissingTypeStubs = " information" ,
112- reportGeneralTypeIssues = " warning" ,
113- reportUnboundVariable = " warning" ,
114- reportUndefinedVariable = " error" ,
115- reportUnknownMemberType = " information" ,
116- reportUnknownVariableType = " information" ,
117- reportUntypedClassDecorator = " none" ,
118- reportUntypedFunctionDecorator = " none" ,
119- reportFunctionMemberAccess = " warning" ,
120- reportUnknownArgumentType = " warning" ,
121- reportUnknownParameterType = " warning" ,
122- reportUnknownLambdaType = " warning" ,
123- reportUnusedImport = " information" ,
124- reportUnusedFunction = " information" ,
125- reportUnusedVariable = " information" ,
126- reportUnusedClass = " information" ,
127- strictParameterNoneValue = false ,
128- reportOptionalSubscript = " warning" ,
129- reportOptionalMemberAccess = " warning" ,
130- reportOptionalIterable = " warning" ,
131- reportOptionalCall = " none" ,
132- },
133- },
78+ -- capabilities = capabilities,
79+ init_options = {
80+ jediSettings = {
81+ case_insensitive_completion = true ,
82+ add_bracket_after_function = true ,
83+ dynamic_params = true ,
84+ -- Allot of machine learning models that are set from default.
85+ autoImportModules = { " numpy" , " matplotlib" , " random" , " math" , " scipy" },
13486 },
13587 },
88+
89+ on_new_config = function (new_config , new_root_dir )
90+ new_config .settings .python .pythonPath = vim .fn .exepath (" python" )
91+ print (new_config .settings .python .pythonPath )
92+ new_config .cmd_env .PATH = py .env (new_root_dir ) .. new_config .cmd_env .PATH
93+
94+ local pep582 = py .pep582 (new_root_dir )
95+ if pep582 ~= nil then
96+ new_config .settings .python .analysis .extraPaths = { pep582 }
97+ end
98+ end ,
13699}
137100
138- local use_pyright = true
139- if use_pyright then
140- require (" lspconfig" ).pyright .setup (pyright )
141- else
142- require (" lspconfig" ).jedi_language_server .setup (jedi )
143- end
101+ require (" lspconfig" ).jedi_language_server .setup (jedi )
102+ -- local use_pyright = true
103+ -- if use_pyright then
104+ -- require("lspconfig").pyright.setup(pyright)
105+ -- else
106+ -- require("lspconfig").jedi_language_server.setup(jedi)
107+ -- end
0 commit comments