@@ -48,31 +48,35 @@ void pluginCleanUp()
4848
4949void commandMenuInit ()
5050{
51+ int idx = 0 ;
5152 ShortcutKey* key = new ShortcutKey ();
5253 key->_isAlt = true ;
5354 key->_isCtrl = true ;
5455 key->_isShift = false ;
5556 key->_key = 0x74 ; // F5
56- setCommand (0 , TEXT (" Run file in Python" ), runFile, key, false );
57+ setCommand (idx++ , TEXT (" Run file in Python" ), runFile, key, false );
5758
5859 key = new ShortcutKey ();
5960 key->_isAlt = true ;
6061 key->_isCtrl = false ;
6162 key->_isShift = true ;
6263 key->_key = 0x74 ;
63- setCommand (1 , TEXT (" Run file in Python Interactive" ), runFileInteractive, key, false );
64+ setCommand (idx++ , TEXT (" Run file in Python Interactive" ), runFileInteractive, key, false );
6465
6566 key = new ShortcutKey ();
6667 key->_isAlt = true ;
6768 key->_isCtrl = true ;
6869 key->_isShift = true ;
6970 key->_key = 0x74 ;
70- setCommand (2 , TEXT (" Run file in PythonW" ), runFileW, key, false );
71+ setCommand (idx++ , TEXT (" Run file in PythonW" ), runFileW, key, false );
7172
72- lstrcpy (funcItem[3 ]._itemName , TEXT (" -SEPARATOR-" ));
73+ key = new ShortcutKey ();
74+ setCommand (idx++, TEXT (" Debug the file (PDB)" ), runFilePDB, key, false );
75+
76+ lstrcpy (funcItem[idx++]._itemName , TEXT (" -SEPARATOR-" ));
7377
74- setCommand (4 , TEXT (" Options" ), showOptionsDlg, 0 , false );
75- setCommand (5 , TEXT (" About PyNPP" ), showAboutDlg, 0 , false );
78+ setCommand (idx++ , TEXT (" Options" ), showOptionsDlg, 0 , false );
79+ setCommand (idx++ , TEXT (" About PyNPP" ), showAboutDlg, 0 , false );
7680}
7781
7882void commandMenuCleanUp ()
@@ -137,7 +141,7 @@ std::wstring getCurrentFile(bool &ok)
137141 return wPath;
138142}
139143
140- std::wstring buildRunCommand (std::wstring &filePath, std::wstring &pypath, bool isW = false , bool isI = false )
144+ std::wstring buildRunCommand (std::wstring &filePath, std::wstring &pypath, bool isW = false , bool isI = false , bool isPDB = false )
141145{
142146 std::wstring command = pypath;
143147 if (command[command.length () - 1 ] != ' \\ ' )
@@ -148,6 +152,8 @@ std::wstring buildRunCommand(std::wstring &filePath, std::wstring &pypath, bool
148152 command += TEXT (" .exe " );
149153 if (isI)
150154 command += TEXT (" -i " );
155+ if (isPDB)
156+ command += TEXT (" -m pdb " );
151157 command += TEXT (" \" " );
152158 command += filePath;
153159 command += TEXT (" \" " );
@@ -190,7 +196,7 @@ bool launchPython(std::wstring &command, std::wstring &path)
190196 return result;
191197}
192198
193- void run (bool isW, bool isI) {
199+ void run (bool isW, bool isI, bool isPDB ) {
194200 std::wstring pythonLoc = pythonPath;
195201
196202 if (pythonPath == L" " )
@@ -210,7 +216,7 @@ void run(bool isW, bool isI) {
210216 break ;
211217 }
212218 }
213- std::wstring command = buildRunCommand (file, pythonLoc, isW, isI);
219+ std::wstring command = buildRunCommand (file, pythonLoc, isW, isI, isPDB );
214220
215221 if (!launchPython (command, path)) {
216222 int errorCode = GetLastError ();
@@ -233,13 +239,17 @@ void run(bool isW, bool isI) {
233239}
234240
235241void runFile () {
236- run (false , false );
242+ run (false , false , false );
237243}
238244
239245void runFileInteractive () {
240- run (false , true );
246+ run (false , true , false );
241247}
242248
243249void runFileW () {
244- run (true , false );
245- }
250+ run (true , false , false );
251+ }
252+
253+ void runFilePDB () {
254+ run (false , false , true );
255+ }
0 commit comments