Coder Social home page Coder Social logo

sublime-coolformat's People

Contributors

akof1314 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sublime-coolformat's Issues

文件对HTML的配置不生效

位于/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重启再试还是一样。。。

Does not work on Apple Silicon

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 slice is available:

ls -l /Users/Alex/Library/Application\ Support/Sublime\ Text\ 3/Packages/CoolFormat/CoolFormatLib                             12:19
total 8
-rw-r--r--  1 Alex  staff  550 Dec 12 12:18 CoolFormatConfig.cfconfig
drwxr-xr-x  3 Alex  staff   96 Dec 12 12:18 cf_linux_x32
drwxr-xr-x  3 Alex  staff   96 Dec 12 12:18 cf_linux_x64
drwxr-xr-x  3 Alex  staff   96 Dec 12 12:18 cf_osx_x64
drwxr-xr-x  3 Alex  staff   96 Dec 12 12:18 cf_windows_x32
drwxr-xr-x  3 Alex  staff   96 Dec 12 12:18 cf_windows_x64

Attempting to symlink the x86 dylib is equally futile:

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' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libCoolFormatLib.dylib' (no such file)

CoolFormat deletes text if syntax does not match any presets.

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 easily be resolved by implementing a simple verification process:

  • activeSyntax = view.settings().get( "syntax" )
  • check the found syntax against an array of valid syntaxes
  • return if no matches are found

HTML格式化后标签间新增了空行

格式化前

      <div class="w530 lft category-con ml10">
      <textarea class="textareaBox" name="content" id="content" style="width:450px; height:100px;"></textarea>
      <div class="tips"></div>
      </div>

格式化后ctrl-alt-shift-s

      <div class="w530 lft category-con ml10">
        <textarea class="textareaBox" name="content" id="content" style="width:450px; height:100px;">
      </textarea>

        <div class="tips"></div>
      </div>

希望能够设置
(1)不出现</textarea><div class="tips">之间的空行。
因为每个标签间的空行,使代码变得很长(个人习惯)

(2)</textarea>不另起一行,直接合到<textarea后边。

预期效果

      <div class="w530 lft category-con ml10">
        <textarea class="textareaBox" name="content" id="content" style="width:450px; height:100px;"></textarea>
        <div class="tips"></div>
      </div>

Json(Sublime)语言无法lang返回-1,代码清空

原因:
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)

修改getCFLang函数

def getCFLang(self):
	lang = self.view.settings().get('syntax') # eg Packages/C++/C++.tmLanguage
	sublime.message_dialog(lang)
	for keys in Synlanguage.lang_dict.keys():
		if lang.find(keys,9) != -1:
			return Synlanguage.lang_dict[keys]

ps:#4 issues可能是这个原因

[Feature Request] add support for Python & custom syntaxes

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 of dictionaries @ sublime-settings.

These custom syntaxes could be much simpler than the included presets, functioning only on characters within single lines.

For example:

    [
        {
            syntaxes: [ "autohotkey", "processing", "regular expression" ],

            // select the padding method for each character
            // a space will be added to the defined sides of the character upon formatting
            // OPTIONS: "left" | "right" | "both"
            left_paren:  "right"
            right_paren: "left"
            colon:       "both"
            ETC...
        }
    ]

Or maybe even regEx defined patterns instead of explicitly defined characters as in the example above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.