forked from lucacri/PhpSimpleRefactor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhpSimpleRefactorExtractMethod.py
More file actions
26 lines (21 loc) · 1.01 KB
/
PhpSimpleRefactorExtractMethod.py
File metadata and controls
26 lines (21 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sublime, sublime_plugin
import subprocess
import tempfile
import os
import sys
from PhpSimpleRefactor.PhpSimpleRefactorCommand import PhpSimpleRefactorBaseCommand
class PhpSimpleRefactorExtractMethodCommand(PhpSimpleRefactorBaseCommand):
function_name = ''
def process(self):
sublime.active_window().show_input_panel('Function name', '', self.obtain_function_name, None, None)
def obtain_function_name(self, functionName):
self.function_name = functionName;
self.on_filled_info()
def get_command(self):
settings = sublime.load_settings('PHPSimpleRefactor.sublime-settings')
self.php_path = settings.get('php_path')
self.refactor_path = settings.get('refactor_path')
rows = ''.join([str(self.rowBegin), "-", str(self.rowEnd)])
cmd = ''.join([self.php_path, ' "', self.refactor_path,'" ', 'extract-method', ' "', self.file_name, '" ', rows, ' ', self.function_name])
print(cmd)
return subprocess.Popen(cmd, shell=True, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)