@@ -7,13 +7,13 @@ import { exec } from 'child_process';
7
7
interface PythonScripterSettings {
8
8
pythonPath : string ;
9
9
pythonExe : string ;
10
- useLastFile : boolean ;
10
+ // useLastFile: boolean;
11
11
}
12
12
13
13
const DEFAULT_SETTINGS : PythonScripterSettings = {
14
14
pythonPath : "" ,
15
15
pythonExe : "" ,
16
- useLastFile : false
16
+ // useLastFile: false
17
17
}
18
18
19
19
export default class PythonScripterPlugin extends Plugin {
@@ -72,13 +72,19 @@ export default class PythonScripterPlugin extends Plugin {
72
72
python_exe = this . settings . pythonExe
73
73
}
74
74
if ( stats . isFile ( ) ) {
75
- var local_current_file_path = this . app . workspace . activeEditor ?. file ?. path ;
76
- if ( this . settings . useLastFile ) {
77
- local_current_file_path = this . app . workspace . lastActiveFile ?. path ;
78
- }
75
+ // var local_current_file_path = this.app.workspace.activeEditor?.file?.path;
76
+ var local_current_file_path = this . app . workspace . getActiveFile ( ) ?. name ?. toString ( ) ;
79
77
if ( local_current_file_path === undefined ) {
78
+ // local_current_file_path = "";
80
79
local_current_file_path = "" ;
81
80
}
81
+ // if (this.settings.useLastFile) {
82
+ // local_current_file_path = this.app.workspace.getActiveFile()?.name?.toString();
83
+ // }
84
+ // else {
85
+ // local_current_file_path = this.app.workspace.activeEditor?.file?.path;
86
+ // }
87
+
82
88
83
89
84
90
exec ( `${ python_exe } \"${ filePath } \" \"${ basePath } \" \"${ local_current_file_path } \"` , { cwd : this . pythonDirectory } , ( error : any , stdout : any , stderr : any ) => {
@@ -162,14 +168,14 @@ class PythonScripterSettingTab extends PluginSettingTab {
162
168
this . plugin . settings . pythonExe = value ;
163
169
await this . plugin . saveSettings ( ) ;
164
170
} ) ) ;
165
- new Setting ( containerEl )
166
- . setName ( 'Use Last File' )
167
- . setDesc ( 'Run the script on the last file that was opened. This make it possible to run it on other file types e.g. pdf.' )
168
- . addToggle ( toggle => toggle
169
- . setValue ( this . plugin . settings . useLastFile )
170
- . onChange ( async ( value ) => {
171
- this . plugin . settings . useLastFile = value ;
172
- await this . plugin . saveSettings ( ) ;
173
- } ) ) ;
171
+ // new Setting(containerEl)
172
+ // .setName('Use Last File')
173
+ // .setDesc('Run the script on the last file that was opened. This make it possible to run it on other file types e.g. pdf.')
174
+ // .addToggle(toggle => toggle
175
+ // .setValue(this.plugin.settings.useLastFile)
176
+ // .onChange(async (value) => {
177
+ // this.plugin.settings.useLastFile = value;
178
+ // await this.plugin.saveSettings();
179
+ // }));
174
180
}
175
181
}
0 commit comments