Home Download Buy Blog Forum Support

Plugin Idea: Would This Be Useful?

Re: Plugin Idea: Would This Be Useful?

Postby facelessuser on Mon Jan 09, 2012 5:14 pm

I just noticed that RegReplace has been addded to the SublimeText Group, and therefore added to Package Control. That version is kind of half baked and incomplete, I personally would discourage use of that branch for now. While people are free to fork the project as much as they want, I think forking it to the SublimeText group is not a wise choice at this point. I am not able to personally maintain that branch. I am hoping by the end of the week, I will have the important features in, and will personally add the package to Package Control myself.

I would like to keep it out of SublimeText group until I am to a point where I wish to longer support the branch, and then it can be supported by the community or whatever. Trying to get pull requests and such on the SublimeText group will not allow me to be as nimble as I would like; especially since the plugin is still in development. Also, this will be confusing to people when I do personally add my branch to Package Control and there will be 2 versions of RegReplace.

I will try and send a message to the maintainer of that group.
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: Plugin Idea: Would This Be Useful?

Postby tito on Mon Jan 09, 2012 5:25 pm

I just deleted the package per your request.
FYI: I've no idea how the package ended at Sublime Text.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 860
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Plugin Idea: Would This Be Useful?

Postby facelessuser on Mon Jan 09, 2012 5:28 pm

Thanks so much! I have no idea either. It must really want to be released :D
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: Plugin Idea: Would This Be Useful?

Postby tito on Mon Jan 09, 2012 5:29 pm

I want to say I disagree forks (to sublimetext organization) of packages without the authorization of the package "owner"

edit: I also sent to you an invitation to "collaborate" there.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 860
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Plugin Idea: Would This Be Useful?

Postby sublimator on Mon Jan 09, 2012 5:44 pm

my bad ... I forked it to my account the other day ... and accidentally pressed the ST organisation first but didn't think the request completed ...
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Plugin Idea: Would This Be Useful?

Postby facelessuser on Mon Jan 09, 2012 5:50 pm

tito wrote:I want to say I disagree forks (to sublimetext organization) of packages without the authorization of the package "owner"

edit: I also sent to you an invitation to "collaborate" there.


I agree, and thanks for the invite.

castles_made_of_sand wrote:my bad ... I forked it to my account the other day ... and accidentally pressed the ST organisation first but didn't think the request completed ...


No worries. It happens. It just surprised me.
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: Plugin Idea: Would This Be Useful?

Postby facelessuser on Tue Jan 10, 2012 4:35 pm

I wanted to see if anyone has an opinion on this. I added scope filtering locally on my machine the other day, but I am trying to figure out the best way to represent the functionality.

Basically I have positive and negative filtering (must include and must exclude scope respectively), but on top of that, I have further defined the difference: include at least one instance of scope vs entire match must be of scope type; alternately on the negative side: one instance of scope disqualifies match, and only the entire match of a scope disqualifies match.

My questions is the best way to represent this to be the most intuitive. Currently I have:

- Any instance of scope qualifies match: scope.name
- Entire match of scope qualifies match: !scope.name
- Any instance of scope disqualifies match: -scope.name
- Entire match of scope disqualifies match: -!scope.name

Thoughts, opinions?
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: Plugin Idea: Would This Be Useful?

Postby facelessuser on Tue Jan 10, 2012 6:22 pm

Also looking for good useful regex tasks to include by default. If you have any suggestions, post them here. I may not include all of them, but I will evaluate them and include the ones I feel would be the most useful.
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: Plugin Idea: Would This Be Useful?

Postby brentdooley999 on Tue Jan 10, 2012 10:16 pm

I just downloaded Sublime yesterday and I am loving it. I've been playing with the plugin stuff off and on today and I think I'm missing something. I think I understand how the plugins work but for the life of me I can't find how to pass arguments to the view.run_command function. In other words, what's the command prompt syntax to run regreplace? When I run it the script always dies at "if len(replacements) > 0:" because I'm, apparently, not passing anything in.

Any help would be appriciated.
brentdooley999
 
Posts: 5
Joined: Tue Jan 10, 2012 10:11 pm

Re: Plugin Idea: Would This Be Useful?

Postby facelessuser on Tue Jan 10, 2012 10:41 pm

brentdooley999 wrote:I just downloaded Sublime yesterday and I am loving it. I've been playing with the plugin stuff off and on today and I think I'm missing something. I think I understand how the plugins work but for the life of me I can't find how to pass arguments to the view.run_command function. In other words, what's the command prompt syntax to run regreplace? When I run it the script always dies at "if len(replacements) > 0:" because I'm, apparently, not passing anything in.

Any help would be appriciated.


First off, you must have the replacement(s) you want defined in the settings file(reg_replace.sublime-settings). If you are adding your own, I recommend to copy the settings file to the User folder under the Packages folder and modify it there so your settings will persist when you upgrade the plugin.

For example:
Code: Select all
{
   "replacements": {
      "remove_html_comments": {
         "find": "<!--[\\s\\S]+?-->",
         "replace": "",
         "scope_filter": ["!comment"],
         "greedy": true,
         "case": true
      },
      "trailing_spaces": {
         "find": "[ \\t]+$",
         "replace": "",
         "greedy": true,
         "case": true
      }
   }
}


You can then define a command in the Defaults.sublime-commands file. Do the same as your settings file if you are going to make changes that you wish to persist.

Follow the same convention as your command file.

So, if I have a replacement defined in my settings file called "trailing_spaces", I would call it via the command line in the console like this (you can also call this from other plugins as well similarly; you just need a valid view to call it):

Code: Select all
sublime.active_window().active_view().run_command("reg_replace", {"replacements" : ["trailing_spaces"]})


or define it in the command file like this (this will make the command accessible via the command pallet):
Code: Select all
{
      "caption": "Reg Replace: Example - Remove Trailing Spaces",
      "command": "reg_replace",
      "args": {"replacements": ["trailing_spaces"]}
   }


Notice the arguments for the command are contained inside a dict, and the "replacements" argument is always in an array (you can add other regex tasks to the array to perform multiple regex in a sequence).

I hope this makes it a little more clear.

Note this is still in development, so please note there may be some bugs. I have a fairly big commit comming tonight that should complete most of the currently planned features...assuming there are no bugs :).
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

PreviousNext

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 8 guests