deadfoxygrandpa / Elm.tmLanguage

Elm language syntax highlighting and tool integration for ST2/3
https://packagecontrol.io/packages/Elm%20Language%20Support
MIT License
122 stars 27 forks source link

Add regex file search for elm-format command #57

Closed deadfoxygrandpa closed 8 years ago

deadfoxygrandpa commented 8 years ago

@rtfeldman There's some details to work out for this. I have the pieces basically working individually right now on the regex branch, but since you brought it up I'm hoping to get your input.

What type of regex search do you want? Do you want full matches, excluding the file extension? Are partial matches OK, and if so, do they need to start at the beginning of the file name?

I assume you only want to match on .elm files, so I can just strip the .elm extension out of the filenames. Is this a valid assumption?

rtfeldman commented 8 years ago

I'm actually doing whole file path with the SublimeOnSaveBuild plugin. Previously I was excluding some older projects (by directory), but right at the moment I have:

    "filename_filter": "((^(?!.*?(Css)).*\\.elm$)|(elm-css/src/Css/.*\\.elm$))",

Basically I want to exclude any Elm files with Css in the path (e.g. ~/dreamwriter/Dreamwriter/Css/Editor.elm), because the elm-css DSL is designed to look like SASS, and running elm-format on elm-css files makes them look like a mess instead of like SASS.

(I explicitly permit code in elm-css itself, naturally, so its source files get the formatting.)

deadfoxygrandpa commented 8 years ago

OK. I have this mostly implemented on a computer I left at work and forgot to push the commits. I'll push it tomorrow.

deadfoxygrandpa commented 8 years ago

@rtfeldman I've added this as a new Elm Language Support user setting "elm_format_filename_filter" in the 0.16.1 release, which just went live on Package Control. Let me know if there are any issues with it.