kvichans / cuda_exttools Goto Github PK
View Code? Open in Web Editor NEWExternal Tools for CudaText
External Tools for CudaText
нужна правка- кнопки по краю контролов edit, без -1..-2 пикселя.
тул Tidy.exe.
задал line (?P<line>\d+) column (?P<col>\d+) .+
При клике- ошибка
File is maybe not text:
/home/user/
Do you want to open it?
файл /home/user/test.htm
Plugin for CudaText.
Allows to call external programs in CudaText.
Adds menu "Tools" (near "Plugins") with commands:
Config (customize tools),
Run main lexer tool (analog of SublimeText's command "Build"),
Tool1...ToolN (items appear after tools are configured).
Config file is settings/exttools.json.
Details:
- "Shell command" option must be checked for tools which you want to run via OS-shell:
on Windows it's commands of cmd.exe. On Linux this opt usually not needed.
- If lexer(s) assigned to a tool, tool can be called only when these lexers active.
- "Patterns" allow to parse output lines by regex, and find in these lines:
filename, line number, column number. If line parsed OK, you can jump to found
line number and file by clicking in Output panel.
Author: A.Kvichanskiy (kvichans at forum/github)
License: MIT
В Син есть много готовых outpresets. Их можно перенести в Куд.
Подскажите, если ли где-то готовые наборы примеров для тестирования этих шаблонов?
Перв. вызов диалога- listbox не имеет выделения
(значит не работает Edit/Del)
Как получить чудесный список
Command.dlg_config:133 exkys=['Tidy [Ctrl+T]', '', 'edit', '', '']
делаем add, в длг файла делаем отмену.
макрос для портабельности.КИнул тул в подпапку Куды.И надо пускать с флешки.
диалог открывается, listview index не задан, в Вин нет синей полосы на listview, wish- задавать index.
Synwrite ExtTools имеет фичу "как разбирать вывод тул"- есть опц.
по regex Син разбирает лог и подсвечивает output
wish. Так же в Cud ExtTools.
Через app_log можно давать regex, index of fname/ line/ col
Original exception was:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 13, in dlg_config
def dlg_config(self): return RLS.dlg_config()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 506, in dlg_config
return self.dlg_config_list()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 209, in dlg_config_list
self.last_ext_id = ids[ext_ind]
IndexError: list index out of range
to choose lexer "any" or lexer name (API lexer_proc)
Лучше исп. if name.startswith('-') для сепараторов (то же в Macros)
list имеет 1 п-т.Жмем clone, clone. вылет
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 13, in dlg_config
def dlg_config(self): return RLS.dlg_config()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 269, in dlg_config
return self.dlg_config_list()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 428, in dlg_config_list
self.last_ext_id = ids[ext_ind]
IndexError: list index out of range
Button too wide. Pls to right corner, size 80-120
Python 3.4.3 (default, Oct 14 2015, 20:31:36)
[GCC 4.8.4]
Command.run:500 nm="Tidy", cmnd="", ddir="tidy", prms_s="-errors -quiet "{FileName}""
Command.run:522 ready prms_l=['-errors', '-quiet', '/home/user/test-tree.html']
Command.run:525 val4call=['tidy', '-errors', '-quiet', '/home/user/test-tree.html']
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 14, in run
def run(self, ext_id): return RLS.run(ext_id)
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 530, in run
subprocess.Popen(val4call, cwd=ddir)
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: ''
Original exception was:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 14, in run
def run(self, ext_id): return RLS.run(ext_id)
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 530, in run
subprocess.Popen(val4call, cwd=ddir)
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: ''
Close Keys dialog,ESC-
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 13, in dlg_config
def dlg_config(self): return RLS.dlg_config()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 287, in dlg_config
return self.dlg_config_list()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 472, in dlg_config_list
ed_ans = self.dlg_config_prop(self.exts[new_ext_ind], keys)
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 824, in dlg_config_prop
keys = apx._json_loads(open(keys_json).read()) if os.path.exists(keys_json) else {}
UnboundLocalError: local variable 'keys_json' referenced before assignment
подозрение. не точно. Может не закрываете процесс. запустил tidy 2-3 раза- менял shell=on/off- tidy стал игнорить файл- даже если вернул shell=off -все равно все запуски "не видят файл"
Such plugin: maybe it's good to look at it. ExtProgr https://packagecontrol.io/packages/External_Programs
If tab untitled: don't run tool if has macros {FileNNNNNNN}- show status message "Cannot run this tool for untitled tab"
Невозможно избавиться от последнего перехода на новую строку.
Если это только визуальных эффект, то он запутывает: невозможно отличить когда файл заканчивается на \n, а когда нет.
Была идея дать в плагине команду "Перейти на след проблему". Для этого в API вы добавили извлечение строк из output и установку выделенной. Планирую сделать.
wish.Если парам-р имеет {Filename},то давать ош при запуске тула,при untitled tab.
&Chars duplicated
(e.g. "&Brows")
есть макр для 1-based line num, для красоты хорошо бы еще для 0-based(чтоб было)
CurrentLineNum0
CurrentColumnNum0
сделал тул (файл /usr/bin/tidy -тут нет расширения)
парам {FileName}. захват. запуск-
Original exception was:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.cudatext/py/cuda_exttools/__init__.py", line 265, in run
subprocess.Popen(cmd)
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/tidy /home/user/test.htm'
Хорошо бы составить советы по компоновке контролов, чтобы они прилично смотрелись в разных ОС (Win, Mac, Lnx).
Типичные проблемы:
создал тул--взял просто файл у него нет атрибута "можно запускать".Надо проверять это.А то вываливает
Original exception was:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.cudatext/py/cuda_exttools/cd_exttools.py", line 247, in run
subprocess.Popen(val4call, **nmargs)
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
Оказывается в re у Питона есть именованные группы!
Я сделаю через них.
Сравните:
В Син разбор ошибки при запуске Питона делается при указании
\w+ "(.+)", line (\d+).*
Куд это будет делаться одним рег.выражением
\w+ "(?P<file>.+)", line (?P<line>\d+).*
Нужно передать в плагин навигацию по строкам из Output
def get_encoding_names(self):
Можно ли записать это в файл(текстом, и читать по text.splitlines)?
ошибки - turkis, englis, gree
Можно сделать **все про запуск(но не про обращение к списку exts, не обращение к json)в новый файл?
Menus dlg_menu have word "...... ExtTool"
pls use short clean word: "........ tool"
Custom dlg. встаю на width of keys, "R50". OK- err
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 13, in dlg_config
def dlg_config(self): return RLS.dlg_config()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 269, in dlg_config
return self.dlg_config_list()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 391, in dlg_config_list
self.dlg_prs['keys'] = str(max( 50, int(custs[2])))
ValueError: invalid literal for int() with base 10: 'R50'
предлагаю ключи
"file":
"save"
"params"
"dir"
"name"
"id"
"shell"
"out"
"capture"
"enc"
все время получается вывод (Output pane)
line 1 column 1 - Warning: inserting missing 'title' element
Info: Document content looks like HTML 3.2
1 warning, 0 errors were found!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
<title></title>
</head>
<body>
</body>
</html>
To learn more about...
Запуск в консоли-
tidy -errors -quiet "/home/user/test.html"
дает норм вывод
line 1 column 1 - Warning: specified input encoding (iso-8859-1) does not match actual input encoding (utf-8)
line 1 column 5 - Warning: missing <!DOCTYPE> declaration
line 3 column 24 - Warning: plain text isn't allowed in <head> elements
line 2 column 1 - Info: <head> previously mentioned
line 3 column 24 - Warning: inserting implicit <body>
line 4 column 1 - Warning: </head> isn't allowed in <body> elements
line 3 column 24 - Info: <body> previously mentioned
line 5 column 17 - Warning: discarding unexpected <body>
line 16 column 1 - Warning: missing </div>
запуск ИзКуд дает такой лог
Command.run:227 nm, raw-cmd=Tidy tidy -errors -quiet "{FileName}"
Command.run:254 ready prms=-errors -quiet "/home/user/test-tree.html"
Command.run:269 ?? Popen
Command.run:279 ok Popen
Command.run:297 out_ln=line 1 column 1 - Warning: inserting missing 'title' element
Command.run:297 out_ln=Info: Document content looks like HTML 3.2
Command.run:297 out_ln=1 warning, 0 errors were found!
Command.run:297 out_ln=
Command.run:297 out_ln=<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
Command.run:297 out_ln=<html>
Command.run:297 out_ln=<head>
Command.run:297 out_ln=<meta name="generator" content=
Command.run:297 out_ln="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
Command.run:297 out_ln=<title></title>
Command.run:297 out_ln=</head>
Command.run:297 out_ln=<body>
Command.run:297 out_ln=</body>
Command.run:297 out_ln=</html>
Command.run:297 out_ln=
Command.run:297 out_ln=To learn more about
Тул-
Добавил навигацию на основе результатов тула
Для работы с tidy появилась расширенная настройка (в Advanced)
source_tab_as_blanks:8
предл. назваить кнопы справа
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 504, in run
if not ed.file_save(): return
AttributeError: 'Editor' object has no attribute 'file_save'
Если ф. даст 1 число для разных тулов- один сотрется(много запусков Куд)?
выбрал второй тул- на моем скрине- "edit"
жму clone-
bug- диалог пропал,
bug- появился в меню третий тул НО в списке потом опять 2
wish--клонировать в имя "edit и-чтото"
,'props=props=1,0,1' # ro,mono,border
ограничение не раб-т.
надо
Есть реакция на Y N, но не вижу реакции на y/n lowercase
2 длг нужно-
Стабильно натыкаюсь, что после обновления библ.лексеров не работают сочетания для плагинов, пока не перевызовешь Куд.
Что это?
wish. 1/3 size for right list, 2/3 for left list
не моуг создать тул. Add, отмена в dlg_file, потом
File "<string>", line 1, in <module>
File "/home/user/cuda/cuda/app/py/cuda_exttools/__init__.py", line 13, in dlg_config
def dlg_config(self): return RLS.dlg_config()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 288, in dlg_config
return self.dlg_config_list()
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 471, in dlg_config_list
self.last_ext_id = ids[ext_ind]
IndexError: list index out of range
проверьте все типа вывода. Один -Output- дает всегда append, это не Output Append, просто output.
Можно ли из текущих контролов dlg_custom сделать рамку для с подписью для обозначения именованной группы, которую она будет окружать?
Похоже что ответ "нет"
Ради этого плагина делалось апи :)
запуск тула. у него параметр "{Interactive}"
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 215, in run
prm = subst_props(prm, file_nm, cCrt, rCrt)
File "/home/user/cuda/cuda/app/py/cuda_exttools/cd_exttools.py", line 898, in subst_props
ans = app.dlg_input('Param for call {}'.format(ext['nm']), '')
NameError: name 'ext' is not defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.