Closed ghost closed 9 years ago
where.exe sqlformat
in your Windows CMD Prompt and let me know resultsAtom Beautify - Help Debug Editor
Atom Beautify - Debugging information **Platform**: win32 Versions **Atom Version**: 0.209.0 **Atom Beautify Version**: 0.28.3 Original file to be beautified **Original File Path**: `C:\Users\Administrator\Desktop\superior_company.sql` **Original File Grammar**: SQL ...(omit) Results **Beautified File Contents**: ``` sql Error: Could not find 'sqlformat'. The program may not be installed. ``` ...(omit) 2015-06-12T05:48:51.155Z - debug: [C:\Users\Administrator.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] error Error: spawn sqlformat ENOENT at exports._errnoException (util.js:734:11) at Process.ChildProcess._handle.onexit (child_process.js:1035:32) at child_process.js:1127:20 at process._tickCallback (node.js:357:13)
I was hoping to see more about your PATH
environment variable from the Help Debug Editor
logs...
Let's try this another way:
echo %PATH%
in your CMD promptprocess.env.PATH
in the JavaScript Console of Atom's Developer Tools (Atom -> View -> Developer -> Toggle Developer Tools)I hope to see that 1) they match and 2) D:\Python34\Scripts\
is found in both of them, thus indicating that sqlformat has been installed properly.
The `D:\Python34\Scripts`` is found in both of them.
Excellent! Update to v0.28.4 and let me know if that works for you.
Update: Windows does not support shebangs so I am not sure if spawn
(create process with Node.js) will be able to run the script even if it is found. You may need to play with the sqlformat
beautifier: https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/sqlformat.coffee#L16
It may require to be as ugly as it is for PHP-CS-Fixer
: https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/php-cs-fixer.coffee#L18-L62
Hopefully v0.28.4 works, however if not then it's another Windows-specific issue to tackle and that takes time -- I just spent all day adding more tests and improving Windows + PHP support. Developing on Windows is definitely not something I look forward to so I recommend that you play around with the sqlformat
beautifier code and see if you can get it working and let me know. Once you have it working, we can discuss a more production-ready and official solution. Thanks!
It also has the same error message. Anyway, thank for your help.
I have enabled the tests and am checking them out on Travis CI (Mac) and AppVeyor (Windows). If there are problems I'll try and resolve them. It should work the same as autopep8
, which is installed via pip
and already has passing tests on both Mac and Windows.
Were you able to get this working @xhxiaomihu ?
sqlformat
fail: https://ci.appveyor.com/project/Glavin001/atom-beautify
autopep8
works and sqlformat
does not...It does not working, It also has same error message.
Because I'm not familiar CoffeeScript, so I have no idea how to fix it. I have a lot to learn.
Anyway, thanks for you help.
I'll try and fix it now that I have the tests on AppVeyor (Windows) erroring with the same message you have.
Why Node.js + Spawn + Windows does not work: https://github.com/joyent/node/issues/2318
I am looking into alternatives:
Update: Cross-Spawn looks like the winner: https://www.npmjs.com/package/cross-spawn
Published a fix to v0.28.5
Having the same issue. Any help would be greatly appreciated.
Error: Could not find 'sqlformat'. The program may not be installed. at Sqlformat.module.exports.Beautifier.commandNotFoundError (C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee:178:14) at C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee:264:26 at tryCatcher (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\util.js:24:31) at Promise._settlePromiseFromHandler (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\promise.js:454:31) at Promise._settlePromiseAt (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\promise.js:530:18) at Promise._settlePromises (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\promise.js:646:14) at Async._drainQueue (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\async.js:182:16) at Async._drainQueues (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\async.js:192:10) at MutationObserver.Async.drainQueues (C:\Users\Thomas Rea.atom\packages\atom-beautify\node_modules\bluebird\js\main\async.js:15:14) at process._tickCallback (node.js:367:9)
Version: Platform: win32 Atom Version: 1.0.0 Atom Beautify Version: 0.28.6
Atom Beautify - Help Debug: 2015-06-25T16:41:59.199Z - debug: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] tempFile input null path=C:\Users\THOMAS~1\AppData\Local\Temp\input115525-1320-1f9nmnk, fd=4
2015-06-25T16:41:59.207Z - debug: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] exeName, args: sqlformat 0=C:\Users\THOMAS~1\AppData\Local\Temp\input115525-1320-1f9nmnk, 1=--reindent, 2=--indent_width=2, 3=--keywords=upper, 4=--identifiers=lower
2015-06-25T16:41:59.215Z - debug: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] exePath, env: C:\Python34\Scripts\sqlformat ALLUSERSPROFILE=C:\ProgramData, APPDATA=C:\Users\Thomas Rea\AppData\Roaming, asl.log=Destination=file, ATOM_HOME=C:\Users\Thomas Rea.atom, ChocolateyInstall=C:\ProgramData\chocolatey, CommonProgramFiles=C:\Program Files (x86)\Common Files, CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, CommonProgramW6432=C:\Program Files\Common Files, COMPUTERNAME=, ComSpec=C:\Windows\system32\cmd.exe, FP_NO_HOST_CHECK=NO, GOOGLE_API_KEY=, HOMEDRIVE=C:, HOMEPATH=\Users\Thomas Rea, LOCALAPPDATA=C:\Users\Thomas Rea\AppData\Local, LOGONSERVER=\, LSHOST=no-net, NODE_ENV=production, NODE_PATH=C:\Users\Thomas Rea\AppData\Local\atom\app-1.0.0\resources\app.asar\exports, NUMBER_OF_PROCESSORS=4, OS=Windows_NT, Path=C:\Python34\;C:\Python34\Scripts;C:\Program Files\Dell\DW WLAN Card;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Hitachi ID\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Common Files\MicroStrategy\JRE\170_51\Win32\C:\Python27;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Users\Thomas Rea\AppData\Roaming\npm, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY, PROCESSOR_ARCHITECTURE=x86, PROCESSOR_ARCHITEW6432=AMD64, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
2015-06-25T16:41:59.215Z - debug: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn C:\Python34\Scripts\sqlformat 0=C:\Users\THOMAS~1\AppData\Local\Temp\input115525-1320-1f9nmnk, 1=--reindent, 2=--indent_width=2, 3=--keywords=upper, 4=--identifiers=lower
2015-06-25T16:41:59.581Z - debug: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn done 1 '"C:\Python34\Scripts\sqlformat"' is not recognized as an internal or external command, operable program or batch file.
2015-06-25T16:41:59.581Z - verbose: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn result 1 '"C:\Python34\Scripts\sqlformat"' is not recognized as an internal or external command, operable program or batch file.
2015-06-25T16:41:59.581Z - verbose: [C:\Users\Thomas Rea.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] '"C:\Python34\Scripts\sqlformat"' is not recognized as an internal or external command, operable program or batch file. is not recognized as an internal or external command
@thomasmarkrea, please let me know the following:
where.exe sqlformat
to find pathsqlformat
<filename>
, and add some SQLsqlformat <filename> --reindent
and confirm it worksAtom Beautify - Help Debug Editor
where.exe sqlformat: C:\Python34\Scripts\sqlformat sqlformat works fine from cmd: C:\Python34\Scripts>python sqlformat test.sql --reindent select * from test where id = 5
The following debugging information was generated by Atom Beautify
on Fri Jun 26 2015 10:49:40 GMT+0100 (GMT Daylight Time)
.
Platform: win32
Atom Version: 1.0.0
Atom Beautify Version: 0.28.6
Original File Path: C:\Users\Thomas Rea\Desktop\ABASE\analytical_models\data-pipelines\abase\resources\build\tables.sql
Original File Grammar: SQL
Original File Language: SQL
Original File Contents:
Editor Options: Options from Atom Editor settings
{
"_default": {
"indent_size": 1,
"indent_char": "\t",
"indent_with_tabs": true
}
}
Config Options: Options from Atom Beautify package settings
{
"cs": {
"configPath": ""
},
"c": {
"configPath": ""
},
"cpp": {
"configPath": ""
},
"css": {
"indent_size": 2,
"indent_char": " ",
"selector_separator_newline": false,
"newline_between_rules": false,
"preserve_newlines": false,
"wrap_line_length": 0,
"indent_comments": true,
"force_indentation": false,
"convert_quotes": "none",
"align_assignments": false
},
"d": {
"configPath": ""
},
"fortran": {
"emacs_path": "",
"emacs_script_path": ""
},
"html": {
"indent_inner_html": false,
"indent_size": 2,
"indent_char": " ",
"brace_style": "collapse",
"indent_scripts": "normal",
"wrap_line_length": 250,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 2,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"unformatted": [
"a",
"sub",
"sup",
"b",
"i",
"u"
],
"end_with_newline": false
},
"java": {
"configPath": ""
},
"js": {
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"space_in_paren": false,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"break_chained_methods": false,
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0,
"end_with_newline": false
},
"objectivec": {
"configPath": ""
},
"pawn": {
"configPath": ""
},
"perl": {
"perltidy_profile": ""
},
"php": {
"cs_fixer_path": "",
"fixers": "",
"level": ""
},
"python": {
"max_line_length": 79,
"indent_size": 2,
"ignore": [
"E24"
]
},
"ruby": {
"indent_size": 2,
"indent_char": " "
},
"rust": {
"rustfmt_path": ""
},
"sql": {
"indent_size": 2,
"keywords": "upper",
"identifiers": "lower"
},
"vala": {
"configPath": ""
}
}
Home Options:
Options from C:\Users\Thomas Rea\.jsbeautifyrc
{
"_default": {}
}
EditorConfig Options: Options from EditorConfig file
{
"_default": {}
}
Project Options:
Options from .jsbeautifyrc
files starting from directory C:\Users\Thomas Rea\Desktop\ABASE\analytical_models\data-pipelines\abase\resources\build
and going up to root
[
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
}
]
Final Options: Final combined options that are used
{
"indent_size": 2,
"indent_char": "\t",
"indent_with_tabs": true,
"keywords": "upper",
"identifiers": "lower"
}
Package Settings: The raw package settings options
{
"_analyticsUserId": "8a120392-be70-4abf-a328-37ff34805ce8",
"analytics": true,
"_loggerLevel": "warn",
"beautifyEntireFileOnSave": true,
"muteUnsupportedLanguageErrors": false,
"muteAllErrors": false,
"cs_configPath": "",
"c_configPath": "",
"cpp_configPath": "",
"css_indent_size": 2,
"css_indent_char": " ",
"css_selector_separator_newline": false,
"css_newline_between_rules": false,
"css_preserve_newlines": false,
"css_wrap_line_length": 0,
"css_indent_comments": true,
"css_force_indentation": false,
"css_convert_quotes": "none",
"css_align_assignments": false,
"d_configPath": "",
"fortran_emacs_path": "",
"fortran_emacs_script_path": "",
"html_indent_inner_html": false,
"html_indent_size": 2,
"html_indent_char": " ",
"html_brace_style": "collapse",
"html_indent_scripts": "normal",
"html_wrap_line_length": 250,
"html_wrap_attributes": "auto",
"html_wrap_attributes_indent_size": 2,
"html_preserve_newlines": true,
"html_max_preserve_newlines": 10,
"html_unformatted": [
"a",
"sub",
"sup",
"b",
"i",
"u"
],
"html_end_with_newline": false,
"java_configPath": "",
"js_indent_size": 2,
"js_indent_char": " ",
"js_indent_level": 0,
"js_indent_with_tabs": false,
"js_preserve_newlines": true,
"js_max_preserve_newlines": 10,
"js_space_in_paren": false,
"js_jslint_happy": false,
"js_space_after_anon_function": false,
"js_brace_style": "collapse",
"js_break_chained_methods": false,
"js_keep_array_indentation": false,
"js_keep_function_indentation": false,
"js_space_before_conditional": true,
"js_eval_code": false,
"js_unescape_strings": false,
"js_wrap_line_length": 0,
"js_end_with_newline": false,
"objectivec_configPath": "",
"pawn_configPath": "",
"perl_perltidy_profile": "",
"php_cs_fixer_path": "",
"php_fixers": "",
"php_level": "",
"python_max_line_length": 79,
"python_indent_size": 2,
"python_ignore": [
"E24"
],
"ruby_indent_size": 2,
"ruby_indent_char": " ",
"rust_rustfmt_path": "",
"sql_indent_size": 2,
"sql_keywords": "upper",
"sql_identifiers": "lower",
"vala_configPath": "",
"language_cs_disabled": false,
"language_cs_default_beautifier": "Uncrustify",
"language_cs_beautify_on_save": false,
"language_c_disabled": false,
"language_c_default_beautifier": "Uncrustify",
"language_c_beautify_on_save": false,
"language_coffeescript_disabled": false,
"language_coffeescript_default_beautifier": "coffee-fmt",
"language_coffeescript_beautify_on_save": false,
"language_cpp_disabled": false,
"language_cpp_default_beautifier": "Uncrustify",
"language_cpp_beautify_on_save": false,
"language_css_disabled": false,
"language_css_default_beautifier": "JS Beautify",
"language_css_beautify_on_save": false,
"language_csv_disabled": false,
"language_csv_default_beautifier": "Pretty Diff",
"language_csv_beautify_on_save": false,
"language_d_disabled": false,
"language_d_default_beautifier": "Uncrustify",
"language_d_beautify_on_save": false,
"language_ejs_disabled": false,
"language_ejs_default_beautifier": "Pretty Diff",
"language_ejs_beautify_on_save": false,
"language_erb_disabled": false,
"language_erb_default_beautifier": "Pretty Diff",
"language_erb_beautify_on_save": false,
"language_go_disabled": false,
"language_go_default_beautifier": "gofmt",
"language_go_beautify_on_save": false,
"language_fortran_disabled": false,
"language_fortran_default_beautifier": "Fortran Beautifier",
"language_fortran_beautify_on_save": false,
"language_handlebars_disabled": false,
"language_handlebars_default_beautifier": "JS Beautify",
"language_handlebars_beautify_on_save": false,
"language_html_disabled": false,
"language_html_default_beautifier": "JS Beautify",
"language_html_beautify_on_save": false,
"language_java_disabled": false,
"language_java_default_beautifier": "Uncrustify",
"language_java_beautify_on_save": false,
"language_js_disabled": false,
"language_js_default_beautifier": "JS Beautify",
"language_js_beautify_on_save": false,
"language_json_disabled": false,
"language_json_default_beautifier": "JS Beautify",
"language_json_beautify_on_save": false,
"language_jsx_disabled": false,
"language_jsx_default_beautifier": "Pretty Diff",
"language_jsx_beautify_on_save": false,
"language_less_disabled": false,
"language_less_default_beautifier": "Pretty Diff",
"language_less_beautify_on_save": false,
"language_markdown_disabled": false,
"language_markdown_default_beautifier": "Tidy Markdown",
"language_markdown_beautify_on_save": false,
"language_marko_disabled": false,
"language_marko_default_beautifier": "JS Beautify",
"language_marko_beautify_on_save": false,
"language_mustache_disabled": false,
"language_mustache_default_beautifier": "JS Beautify",
"language_mustache_beautify_on_save": false,
"language_objectivec_disabled": false,
"language_objectivec_default_beautifier": "Uncrustify",
"language_objectivec_beautify_on_save": false,
"language_pawn_disabled": false,
"language_pawn_default_beautifier": "Uncrustify",
"language_pawn_beautify_on_save": false,
"language_perl_disabled": false,
"language_perl_default_beautifier": "Perltidy",
"language_perl_beautify_on_save": false,
"language_php_disabled": false,
"language_php_default_beautifier": "PHP-CS-Fixer",
"language_php_beautify_on_save": false,
"language_python_disabled": false,
"language_python_default_beautifier": "autopep8",
"language_python_beautify_on_save": false,
"language_ruby_disabled": false,
"language_ruby_default_beautifier": "Rubocop",
"language_ruby_beautify_on_save": false,
"language_rust_disabled": false,
"language_rust_default_beautifier": "rustfmt",
"language_rust_beautify_on_save": false,
"language_sass_disabled": false,
"language_sass_default_beautifier": "Pretty Diff",
"language_sass_beautify_on_save": false,
"language_scss_disabled": false,
"language_scss_default_beautifier": "Pretty Diff",
"language_scss_beautify_on_save": false,
"language_spacebars_disabled": false,
"language_spacebars_default_beautifier": "Pretty Diff",
"language_spacebars_beautify_on_save": false,
"language_sql_disabled": false,
"language_sql_default_beautifier": "sqlformat",
"language_sql_beautify_on_save": false,
"language_swig_disabled": false,
"language_swig_default_beautifier": "Pretty Diff",
"language_swig_beautify_on_save": false,
"language_tss_disabled": false,
"language_tss_default_beautifier": "Pretty Diff",
"language_tss_beautify_on_save": false,
"language_twig_disabled": false,
"language_twig_default_beautifier": "Pretty Diff",
"language_twig_beautify_on_save": false,
"language_typescript_disabled": false,
"language_typescript_default_beautifier": "TypeScript Formatter",
"language_typescript_beautify_on_save": false,
"language_vala_disabled": false,
"language_vala_default_beautifier": "Uncrustify",
"language_vala_beautify_on_save": false,
"language_visualforce_disabled": false,
"language_visualforce_default_beautifier": "Pretty Diff",
"language_visualforce_beautify_on_save": false,
"language_xml_disabled": false,
"language_xml_default_beautifier": "Pretty Diff",
"language_xml_beautify_on_save": false
}
Beautified File Contents:
Error: Could not find 'sqlformat'. The program may not be installed.
Logs:
2015-06-26T09:49:40.704Z - info: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautify
SQL REMOVED
[ { _default: { indent_size: 1, indent_char: '\t', indent_with_tabs: true } },
{ cs: { configPath: '' },
c: { configPath: '' },
cpp: { configPath: '' },
css:
{ indent_size: 2,
indent_char: ' ',
selector_separator_newline: false,
newline_between_rules: false,
preserve_newlines: false,
wrap_line_length: 0,
indent_comments: true,
force_indentation: false,
convert_quotes: 'none',
align_assignments: false },
d: { configPath: '' },
fortran: { emacs_path: '', emacs_script_path: '' },
html:
{ indent_inner_html: false,
indent_size: 2,
indent_char: ' ',
brace_style: 'collapse',
indent_scripts: 'normal',
wrap_line_length: 250,
wrap_attributes: 'auto',
wrap_attributes_indent_size: 2,
preserve_newlines: true,
max_preserve_newlines: 10,
unformatted: [Object],
end_with_newline: false },
java: { configPath: '' },
js:
{ indent_size: 2,
indent_char: ' ',
indent_level: 0,
indent_with_tabs: false,
preserve_newlines: true,
max_preserve_newlines: 10,
space_in_paren: false,
jslint_happy: false,
space_after_anon_function: false,
brace_style: 'collapse',
break_chained_methods: false,
keep_array_indentation: false,
keep_function_indentation: false,
space_before_conditional: true,
eval_code: false,
unescape_strings: false,
wrap_line_length: 0,
end_with_newline: false },
objectivec: { configPath: '' },
pawn: { configPath: '' },
perl: { perltidy_profile: '' },
php: { cs_fixer_path: '', fixers: '', level: '' },
python: { max_line_length: 79, indent_size: 2, ignore: [Object] },
ruby: { indent_size: 2, indent_char: ' ' },
rust: { rustfmt_path: '' },
sql: { indent_size: 2, keywords: 'upper', identifiers: 'lower' },
vala: { configPath: '' } },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} },
{ _default: {} } ] SQL C:\Users\Thomas Rea\Desktop\ABASE\analytical_models\data-pipelines\abase\resources\build\tables.sql undefined
2015-06-26T09:49:40.705Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] indent_size=1, indent_char= , indent_with_tabs=true, configPath=, configPath=, configPath=, indent_size=2, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, wrap_line_length=0, indent_comments=true, force_indentation=false, convert_quotes=none, align_assignments=false, configPath=, emacs_path=, emacs_script_path=, indent_inner_html=false, indent_size=2, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=2, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=2, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, cs_fixer_path=, fixers=, level=, max_line_length=79, indent_size=2, ignore=[E24], indent_size=2, indent_char= , rustfmt_path=, indent_size=2, keywords=upper, identifiers=lower, configPath=, , , , , , , , , , ,
2015-06-26T09:49:40.706Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] [ { name: 'SQL',
namespace: 'sql',
grammars: [ 'SQL (Rails)', 'SQL' ],
extensions: [ 'sql' ],
options:
{ indent_size: [Object],
keywords: [Object],
identifiers: [Object] },
beautifiers: [ 'sqlformat' ] } ] 'SQL' 'sql'
2015-06-26T09:49:40.706Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] Language SQL supported
2015-06-26T09:49:40.707Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] getOptions selections [ 'sql' ] indent_size=1, indent_char= , indent_with_tabs=true, configPath=, configPath=, configPath=, indent_size=2, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, wrap_line_length=0, indent_comments=true, force_indentation=false, convert_quotes=none, align_assignments=false, configPath=, emacs_path=, emacs_script_path=, indent_inner_html=false, indent_size=2, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=2, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=2, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, cs_fixer_path=, fixers=, level=, max_line_length=79, indent_size=2, ignore=[E24], indent_size=2, indent_char= , rustfmt_path=, indent_size=2, keywords=upper, identifiers=lower, configPath=, , , , , , , , , , ,
2015-06-26T09:49:40.707Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true indent_size=1, indent_char= , indent_with_tabs=true
2015-06-26T09:49:40.707Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.707Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql indent_size=1, indent_char= , indent_with_tabs=true
2015-06-26T09:49:40.707Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true configPath=, configPath=, configPath=, indent_size=2, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, wrap_line_length=0, indent_comments=true, force_indentation=false, convert_quotes=none, align_assignments=false, configPath=, emacs_path=, emacs_script_path=, indent_inner_html=false, indent_size=2, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=2, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=2, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, cs_fixer_path=, fixers=, level=, max_line_length=79, indent_size=2, ignore=[E24], indent_size=2, indent_char= , rustfmt_path=, indent_size=2, keywords=upper, identifiers=lower, configPath=
2015-06-26T09:49:40.708Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql indent_size=2, keywords=upper, identifiers=lower
2015-06-26T09:49:40.708Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql indent_size=2, keywords=upper, identifiers=lower
2015-06-26T09:49:40.708Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.708Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.708Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.709Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.710Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.710Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.710Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.710Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql undefined
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options sql
2015-06-26T09:49:40.712Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] SQL name=SQL, namespace=sql, grammars=[SQL (Rails), SQL], extensions=[sql], type=integer, default=2, minimum=0, description=Indentation size/length (Supported by sqlformat), title=SQL - Indent size, beautifiers=[sqlformat], type=string, default=upper, description=Change case of keywords (Supported by sqlformat), enum=[lower, upper, capitalize], title=SQL - Keywords, beautifiers=[sqlformat], type=string, default=lower, description=Change case of identifiers (Supported by sqlformat), enum=[lower, upper, capitalize], title=SQL - Identifiers, beautifiers=[sqlformat], beautifiers=[sqlformat]
2015-06-26T09:49:40.714Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options indent_size=2, indent_char= , indent_with_tabs=true, keywords=upper, identifiers=lower
2015-06-26T09:49:40.714Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautifiers silly=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, debug=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, verbose=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, info=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, warn=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, error=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, onLogging=function (handler) {
var subscription;
subscription = emitter.on('logging', handler);
return subscription;
}, silly=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, debug=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, verbose=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, info=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, warn=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, error=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, onLogging=function (handler) {
var subscription;
subscription = emitter.on('logging', handler);
return subscription;
}, languages=[SQL]
2015-06-26T09:49:40.715Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] SQL C:\Users\Thomas Rea\Desktop\ABASE\analytical_models\data-pipelines\abase\resources\build\tables.sql { indent_size: 2,
indent_char: '\t',
indent_with_tabs: true,
keywords: 'upper',
identifiers: 'lower' } indent_size=1, indent_char= , indent_with_tabs=true, configPath=, configPath=, configPath=, indent_size=2, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, wrap_line_length=0, indent_comments=true, force_indentation=false, convert_quotes=none, align_assignments=false, configPath=, emacs_path=, emacs_script_path=, indent_inner_html=false, indent_size=2, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=2, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=2, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, cs_fixer_path=, fixers=, level=, max_line_length=79, indent_size=2, ignore=[E24], indent_size=2, indent_char= , rustfmt_path=, indent_size=2, keywords=upper, identifiers=lower, configPath=, , , , , , , , , , ,
2015-06-26T09:49:40.716Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautifier sqlformat silly=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, debug=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, verbose=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, info=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, warn=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, error=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, onLogging=function (handler) {
var subscription;
subscription = emitter.on('logging', handler);
return subscription;
}, silly=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, debug=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, verbose=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, info=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, warn=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, error=function (msg) {
// build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
var args = [level].concat(Array.prototype.slice.call(arguments));
target.log.apply(target, args);
}, onLogging=function (handler) {
var subscription;
subscription = emitter.on('logging', handler);
return subscription;
}, languages=[SQL]
2015-06-26T09:49:40.727Z - debug: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] tempFile input null path=C:\Users\THOMAS~1\AppData\Local\Temp\input115526-1176-f5n1hf, fd=1
2015-06-26T09:49:40.733Z - debug: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] exeName, args: sqlformat 0=C:\Users\THOMAS~1\AppData\Local\Temp\input115526-1176-f5n1hf, 1=--reindent, 2=--indent_width=2, 3=--keywords=upper, 4=--identifiers=lower
2015-06-26T09:49:40.745Z - debug: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] exePath, env: C:\Python34\Scripts\sqlformat ALLUSERSPROFILE=C:\ProgramData, APPDATA=C:\Users\Thomas Rea\AppData\Roaming, asl.log=Destination=file, ATOM_HOME=C:\Users\Thomas Rea\.atom, ChocolateyInstall=C:\ProgramData\chocolatey, CommonProgramFiles=C:\Program Files (x86)\Common Files, CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, CommonProgramW6432=C:\Program Files\Common Files, COMPUTERNAME=UKANGL0009, ComSpec=C:\Windows\system32\cmd.exe, FP_NO_HOST_CHECK=NO, GOOGLE_API_KEY=AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q, HOMEDRIVE=C:, HOMEPATH=\Users\Thomas Rea, LOCALAPPDATA=C:\Users\Thomas Rea\AppData\Local, LOGONSERVER=\\NLAMSDC03, LSHOST=no-net, NODE_ENV=production, NODE_PATH=C:\Users\Thomas Rea\AppData\Local\atom\app-1.0.0\resources\app.asar\exports, NUMBER_OF_PROCESSORS=4, OS=Windows_NT, Path=C:\Python34\;C:\Python34\Scripts;C:\Program Files\Dell\DW WLAN Card;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Hitachi ID\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Common Files\MicroStrategy\JRE\170_51\Win32\C:\Python27;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Users\Thomas Rea\AppData\Roaming\npm;C:\Users\Thomas Rea\AppData\Local\atom\bin, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY, PROCESSOR_ARCHITECTURE=x86, PROCESSOR_ARCHITEW6432=AMD64, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel, PROCESSOR_LEVEL=6, PROCESSOR_REVISION=2a07, ProgramData=C:\ProgramData, ProgramFiles=C:\Program Files (x86), ProgramFiles(x86)=C:\Program Files (x86), ProgramW6432=C:\Program Files, PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\, PUBLIC=C:\Users\Public, SESSIONNAME=Console, SystemDrive=C:, SystemRoot=C:\Windows, TEMP=C:\Users\THOMAS~1\AppData\Local\Temp, TMP=C:\Users\THOMAS~1\AppData\Local\Temp, UATDATA=C:\Windows\CCM\UATData\, USERDNSDOMAIN=, USERDOMAIN=, USERNAME=, USERPROFILE=C:\Users\Thomas Rea, windir=C:\Windows, windows_tracing_flags=3, windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
2015-06-26T09:49:40.746Z - debug: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn C:\Python34\Scripts\sqlformat 0=C:\Users\THOMAS~1\AppData\Local\Temp\input115526-1176-f5n1hf, 1=--reindent, 2=--indent_width=2, 3=--keywords=upper, 4=--identifiers=lower
2015-06-26T09:49:40.841Z - debug: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn done 1 '"C:\Python34\Scripts\sqlformat"' is not recognized as an internal or external command,
operable program or batch file.
2015-06-26T09:49:40.841Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn result 1 '"C:\Python34\Scripts\sqlformat"' is not recognized as an internal or external command,
operable program or batch file.
2015-06-26T09:49:40.841Z - verbose: [C:\Users\Thomas Rea\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] '"C:\Python34\Scripts\sqlformat"' is not recognized as an internal or external command,
operable program or batch file.
is not recognized as an internal or external command
Atom is multiplatform editor, almost platform independent, you should probably chose formatter which works on all platforms in the same way. One option would be to re-write sqlparse formatter in javascript perhaps? Also, relying on the program being on the PATH is not the best approach either, as one may not want to use the version that is on the PATH for this specific editor. Why not allow editing the formatter path in the settings?
This is what I did to get it working on Windows, if *.py is not associated with the python as default shell app.
###
Requires https://github.com/andialbrecht/sqlparse
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Sqlformat extends Beautifier
name: "sqlformat"
options: {
SQL: true
}
beautify: (text, language, options) ->
@run("python", [
"c:/python27/Scripts/sqlformat"
@tempFile("input", text)
"--reindent"
"--indent_width=#{options.indent_size}" if options.indent_size?
"--keywords=#{options.keywords}" if options.keywords?
"--identifiers=#{options.identifiers}" if options.identifiers?
], help: {
link: "https://github.com/andialbrecht/sqlparse"
})
@dr3adl04d: Absolutely. If you would like to re-write sqlparse, a project with currently 522 commits from 18 contributors and 448 stars, in JavaScript / Node.js and for free on your own personal time instead of spending it with family and friends, please let me know and I will be happy to swap it into Atom Beautify instead of the Python version. I strongly welcome contributions to these free, open-source projects.
Python absolutely works on multiple platforms, and so sqlparse
will as well. The setup has differences between Windows and Mac/Linux, however it is definitely possible to get working on all platforms, and there are tests to prove it:
You could follow the steps from those configurations and actually set up your computer in the exact same way, if you like.
where.exe sqlformat: C:\Python34\Scripts\sqlformat sqlformat works fine from cmd: C:\Python34\Scripts>python sqlformat test.sql --reindent
@thomasmarkrea could you test that C:\Python34\Scripts\sqlformat
works fine, in the same way Atom Beautify uses it, instead of using python sqlformat
:
C:\Python34\Scripts\sqlformat test.sql --reindent
@Glavin001 My point was that you need to take various configurations into account, but you can't force people to set up something one way only. Best way would be to extend configuration in such a way that it allows for editing of how the formatters are executed. Optionally, you could always run formatters via their handler, like in the setup I posted above via python executable. The reason why most corporations don't allow scripts to be executed via default handler is Security, therefore you can't assume this way of execution as a default. I hope this helps.
A lot of users were having difficulties getting setup. The standard for executables is that they exist in your PATH environment variable and can be automatically looked up by your shell, so I took that as the automated approach and invested time to improve that functionality within Atom Beautify.
It is apparent now that no matter which way I go with the intent on making it even easier for users, there will still be struggle to get it setup. So instead of a more automated approach, then I will have to adopt something similar to what you said above:
Also, relying on the program being on the PATH is not the best approach either, as one may not want to use the version that is on the PATH for this specific editor. Why not allow editing the formatter path in the settings?
I actually originally did have options for setting the path to the executable for each beautifier, however then we had cases where on Windows an executable would need to be run first by its language interpreter (python
, php
, etc). So the command would need to be python path/to/sqlformat
instead simply path/to/sqlformat
, where the latter works on Mac/Linux as expected. To make matters worse, after I added in custom code to detect Windows and fix those cases, then some users found that on their Windows setup, they did not need to run it under their language's interpreter. So now I needed Windows to have options to allow either with or without the interpreter as the initial executable to wrap the beautifier executable. I was hoping using the PATH
and emulating the User's shell as much as possible would mitigate these cross-platform pains. However, this is not the case, as you noted, some users do not use the standard PATH environment variable.
I would appreciate some more feedback from users as to what all of their individual cases are, such that Atom Beautify can support all of those possible techniques for executing the beautifiers. I am currently thinking:
interpreter
, if applicable, and using it can be toggled via the package settings. Therefore testing out python path/to/sqlformat
or just path/to/sqlformat
would be a simple option to toggle.sqlparse
and php-cs-fixer
being two of the most common beautifiers that create Issues for Atom Beautify.@dr3adl04d: Let me know what you think and if you have any other ideas. I personally use Mac for all of my development and do not experience many of these problems. I recently won a Microsoft Surface and upon trying to set it up, saw some of the many problems Windows users face when trying to setup their software properly and develop. What a terrible experience. Since then Atom Beautify has improved it's Windows support significantly, including adding complete tests for Windows using AppVeyor along with the pre-existing Mac tests on Travis CI. However, this is not enough. I have worked hard to try and mitigate these Issues from Windows users and want to continue to improve the experience and setup process for them. Hopefully with some more Windows user feedback, we can design a solution that makes everyone happy. Thank you.
index.js:15 Unhandled promise rejection Promise with error: Error: Could not find 'sqlformat'. The program may not be installed. at Sqlformat.module.exports.Beautifier.commandNotFoundError (/home/eric/.atom/packages/atom-beautify/src/beautifiers/beautifier.coffee:204:14) at /home/eric/.atom/packages/atom-beautify/src/beautifiers/beautifier.coffee:304:22 at tryCatcher (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:510:31) at Promise._settlePromise (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromise0 (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:612:10) at Promise._settlePromises (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:687:18) at Async._drainQueue (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:138:16) at Async._drainQueues (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:148:10) at Async.drainQueues (/home/eric/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:17:14) at process._tickCallback (internal/process/next_tick.js:103:7)
I really want to focus on improving the installation experience for users. I have created a new Issue, #1687, to target this problem. Please provide your feedback! Thanks in advance.
When trying to format a sql file I get the following error and stack trace. atom version: 0.209.0 beautify version: 0.28.3
But I already install sqlparse.