1
1
local lspconfig = require (" lspconfig" )
2
+ local py = require (" modules.lsp.utils.python_help" )
2
3
3
4
-- WARN: Dont remove this files
4
5
require (" modules.lsp.installer" )
@@ -38,6 +39,8 @@ local servers = {
38
39
" --pch-storage=memory" ,
39
40
},
40
41
},
42
+ -- basedpyright = {},
43
+ -- pyright = {},
41
44
}
42
45
for server , config in pairs (servers ) do
43
46
lspconfig [server ].setup (vim .tbl_deep_extend (" force" , {
49
52
local pyright = {
50
53
on_attach = on_attach ,
51
54
settings = {
52
- pyright = {
53
- disableOrganizeImports = false ,
54
- },
55
55
python = {
56
56
analysis = {
57
57
indexing = true ,
@@ -71,73 +71,37 @@ local pyright = {
71
71
},
72
72
},
73
73
},
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
- }, ]]
94
74
}
95
75
96
76
local jedi = {
97
77
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" },
134
86
},
135
87
},
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 ,
136
99
}
137
100
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