@@ -153,9 +153,12 @@ def pylsp_lint(
153
153
args = ["--show-column-numbers" ]
154
154
155
155
global tmpFile
156
- if live_mode and not is_saved and tmpFile :
157
- log .info ("live_mode tmpFile = %s" , live_mode )
158
- tmpFile = open (tmpFile .name , "w" )
156
+ if live_mode and not is_saved :
157
+ if tmpFile :
158
+ tmpFile = open (tmpFile .name , "w" )
159
+ else :
160
+ tmpFile = tempfile .NamedTemporaryFile ("w" , delete = False )
161
+ log .info ("live_mode tmpFile = %s" , tmpFile .name )
159
162
tmpFile .write (document .source )
160
163
tmpFile .close ()
161
164
args .extend (["--shadow-file" , document .path , tmpFile .name ])
@@ -261,13 +264,6 @@ def init(workspace: str) -> Dict[str, str]:
261
264
mypyConfigFile = findConfigFile (workspace , ["mypy.ini" , ".mypy.ini" ])
262
265
mypyConfigFileMap [workspace ] = mypyConfigFile
263
266
264
- if ("enabled" not in configuration or configuration ["enabled" ]) and (
265
- "live_mode" not in configuration or configuration ["live_mode" ]
266
- ):
267
- global tmpFile
268
- tmpFile = tempfile .NamedTemporaryFile ("w" , delete = False )
269
- tmpFile .close ()
270
-
271
267
log .info ("mypyConfigFile = %s configuration = %s" , mypyConfigFile , configuration )
272
268
return configuration
273
269
0 commit comments