Sublime-CoolFormat
Sublime-CoolFormat copied to clipboard
A Sublime Text plugin for Source Code Formatter
In the console, the following error appears: ``` dlopen(/Users/Alex/Library/Application Support/Sublime Text 3/Packages/CoolFormat/CoolFormatLib/cf_osx_arm64/libCoolFormatLib.dylib, 0x0006): tried: '/Users/Alex/Library/Application Support/Sublime Text 3/Packages/CoolFormat/CoolFormatLib/cf_osx_arm64/libCoolFormatLib.dylib' (no such file), '/usr/lib/libCoolFormatLib.dylib' (no such file) ``` However, only an x86...
比如 https://element.eleme.cn/#/zh-CN/component/select ```html ```
fix the #12 and #4 bug
原因: self.view.settings().get('syntax')关于此语言返回Package\包名\作者\Json(sublime).sublime-syntax Sol: 1. 判断formatted_code e.g: ``` if formatted_code != '': view.replace(edit, region, formatted_code) else: view.replace(edit, region, code) ``` 2. 修改getCFLang函数 ``` def getCFLang(self): lang = self.view.settings().get('syntax') # eg Packages/C++/C++.tmLanguage...
位于/packages/CoolFormat/CoolFormatLib/的CoolFormatConfig.cfconfig文件如下: ``` ; Please visit http://akof1314.github.io/CoolFormat/doc/index.html for more information [SynTidy] C++=""-A2-p-N-Y-k3"" Java=""-A2-p-N-Y-k3"" C#=""-A2-p-N-Y-k3"" Objective-C=""-A1-p-N-Y-k3"" HTML=""-aan-dep-fb-fbc-fu-js-ll-n-ox-pe-qa-qn-m-wa-wj-wp-ws-sw-fo-i0-d1-ce0-ie0-oe0-w0-sbo0"" XML=""-aan-dep-fb-fbc-js-ll-n-ix-qa-qn-m-wa-wj-wp-ws-sw-fo-i1-ce0-ie0-oe0-w0"" PHP=""-sas-icd-samt-salo-saeo-saro-sabo-saao-samp-aas-rsl-iel-rpc-rst-st"" JavaScript=""-nb-cn4"" CSS=""-c2-rub-cl0-os1-cc-cf-cfp0-rs2"" JSON=""-cn3"" SQL=""-cn2-el-ml0"" ``` 经测试,C++等语言的设置可生效,HTML的设置无法生效 比如:根据文档,w0表示wrap无限制,w10表示每10个字符截断另起一行,我无论设置w几都无法截断。这只是一个测试,还有很多参数设置和不设置都一样。 我后来改成了`HTML=""“‘’”`这样,使用quick format还是一样的效果,根本无法对HTML的格式化规则产生影响。 subtime time重启再试还是一样。。。
一个小问题: 当函数返回enum类型时,格式化后,switch - case语句及且其后所有的大括号均不能正确对齐。 Bug: Functions with enum return value and switch-case statements cannot be formatted correctly. 格式化前的代码: Before formatted: >  格式化后的代码: After formatted: > 
Python would be nice to have as a fully implemented preset in CoolFormat. Additionally, it would be very useful if users could define custom syntax preferences via an array...
If you attempt to run CoolFormat on a file whose syntax does not match any of the supported languages, all text in the document will be deleted. This can...
Sublime Text官方的语法高亮并不是十分精准,所以我会安装一些第三方的语法高亮包,比方说C Improved或者Python Improved。 为了让CoolFormat配合这些包,直接修改原先代码中的`lang_dict`,就可以把他们关联到相应的SYN_CPP/SYN_PYTHON。但是,这样修改,Package Control更新的时候会覆盖掉(虽然好像从来没更新过诶:laughing: 同理,`CoolFormatConfig.cfconfig`也会在更新中被覆盖,我正在想解决方案。
格式化前 ``` html ``` 格式化后`ctrl-alt-shift-s` ``` html ``` 希望能够设置 (1)不出现``和``之间的空行。 因为每个标签间的空行,使代码变得很长(个人习惯) (2)``不另起一行,直接合到`