Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installed but doesn't work (shortcut conflict) #7

Closed
ghost opened this issue Feb 13, 2012 · 26 comments
Closed

Installed but doesn't work (shortcut conflict) #7

ghost opened this issue Feb 13, 2012 · 26 comments
Labels

Comments

@ghost
Copy link

ghost commented Feb 13, 2012

I've installed the plugin via Package Control,
and it's there when I list packages,
but when I press ctrl+alt+f in a .js file (jquery) nothing happens

@jdavisclark
Copy link
Owner

Hmm.. Can you press "ctrl + ~" to open up the console, and then try again in a js file and see if there is an error in the console? Thanks!

@ghost
Copy link
Author

ghost commented Feb 13, 2012

I did: pressed ctrl+` (you meant that?), then pressed ctrl+alt+f in this file:
$(function(){
func1 = function(id){
var code = (event.keyCode) ? event.keyCode : event.which;
if ( code == 13 ) {
if($('#id1'+id).val()!='') update_it(id);
}
};//func1

$('#id2').keydown(function(event){//

var code = (event.keyCode) ? event.keyCode : event.which;

 if ( code == 13) {     
 save_it();

}
});//keypress

});//doc ready

and nothing happens..

when I browse for plugins it has been installed here: Sublime Text 2\Packages\JsFormat (12 files from Default (Linux).sublime-keymap to README.md)
It's not listed under Package Settings btw...
Do you have any suggestions?

@jdavisclark
Copy link
Owner

put > 5 blank lines between two lines of code in your js file, hit ctrl+alt+f and see if it reduces the number of blank lines. I'm hoping that maybe you just don't have any huge formatting errors to be corrected. The formatter that JsFormat uses does not go crazy re-doing your code, it just neatens up some glaring errors.

If that doesn't shed some light on the situation, what OS and version of sublime (Help -> About ST2 -> Build #) are you on?

I don't think individual package settings appear under the "Package Settings" item, just links to the Package Control settings files (could be wrong though).

@ghost
Copy link
Author

ghost commented Feb 13, 2012

I've put about 10 blank lines between var x=1; and var x=2; and nothing happens after I press the keyboard shortcut.
I'm on WinXP and I'm using 2177 build of SublimeText

@ghost
Copy link
Author

ghost commented Feb 13, 2012

Here's the user setting file btw:

{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 11.0,
"ignored_packages":
[
"LaTeX",
"Java",
"Scala",
"Vintage",
"Makefile",
"Rails",
"Perl",
"Textile",
"Lua",
"Matlab",
"Erlang",
"Batch File",
"Python",
"AppleScript",
"TCL",
"Ruby",
"Groovy",
"D",
"Lisp",
"C++",
"Objective-C",
"R",
"ShellScript",
"Clojure",
"C#",
"Markdown",
"RestructuredText",
"OCaml",
"Graphviz",
"YAML",
"Haskell",
"Go",
"Diff",
"ActionScript",
"ASP"
],
"theme": "Soda Dark.sublime-theme"
}

@ghost
Copy link
Author

ghost commented Feb 13, 2012

I've disabled some plugins, maybe that's connected in some way.

@jdavisclark
Copy link
Owner

hmm...Im on build 2165, ill get your version and see how it looks. this shouldnt have anything to do with other plugins or your package control settings

@jdavisclark
Copy link
Owner

I just updated to 2177, everything still works fine for me. I'm running out of ideas. Do you by chance have another machine or VM that you could test on?

Sorry this is taking so long to resolve :(

@ghost
Copy link
Author

ghost commented Feb 14, 2012

I've just reinstalled it and updated with ver 21.19.55 but it doesn't work.

I currently don't have any other machive to test on,
Nevertheless, you were very attentive, thank you.
I'll continue to watch this repo and see in the near future what's going on

@jdavisclark
Copy link
Owner

Thanks for your patience, I am very sorry we have not been able to find a resolution yet.

I tested on 5-6 different machines with sublime installs yesterday, all of which worked normally (however they were all windows 7 or ubuntu). I will find an XP vm in the next day or two to test, but I cant imagine that your issue is related.

I will keep this issue open and post an update if I discover anything else.

@PAEz
Copy link

PAEz commented Feb 26, 2012

Having the same problems in XP.

@jdavisclark jdavisclark reopened this Feb 26, 2012
@jdavisclark
Copy link
Owner

Hmm.. I had a friend test in an XP vm a few days ago and he could not reproduce. I will try and track down an old machine with XP on it and retest myself.

PAEz: can you do two things for me?

  • open the console (ctrl + `)
  • try formatting using both the shortcut (ctrl + alt + f), AND the command pallet (ctrl + shift + p then search for format:javascript)

Let me know if you get any error output.

@PAEz
Copy link

PAEz commented Feb 26, 2012

The shortcut doesnt work, but it does from the command pallet (didnt know I could do that).
Ive changed the short cut and now it works!
Thanks alot for your help, great extension by the way.

@jdavisclark
Copy link
Owner

Ok, this definitely sounds like you have another plugin installed thats stealing the default shortcut. I just tested on an xp machine with no other plugins installed (aside from package control), and it works fine.

Let me know if you have any other issues.

@pipster
Copy link

pipster commented Apr 14, 2012

I am having the same problem. I looked at all the other key bindings and no other uses alt+ctr
I added this to the default windows key map
{ "keys": ["ctrl+alt+f"], "command": "js_formatter" }

works on ctrl _ shift + p but not on keyboard shortcut.

Am I doing something wrong?

@jdavisclark
Copy link
Owner

Damn, I have tested on like 15 different computers with fresh sublime installs and have never been able to reproduce this. What version of sublime and operating system are you using?

@arxpoetica
Copy link

There's an HTML tag formatter that uses the same shortcut. I was having the same problem described here. I just removed the tag package, and it fixed the problem. Here's the tag package. https://github.com/SublimeText/Tag It would be nice to be able to use both. These two packages are in conflict. It seems like someone over here was trying to solve the problem http://www.sublimetext.com/forum/viewtopic.php?f=6&t=4506#p20520

What to do. What to do.

@jdavisclark jdavisclark reopened this Jun 26, 2012
@jdavisclark
Copy link
Owner

This is the largest problem I have run in to with sublime plugins. I don't want to change the shortcut for JsFormat for a few reasons:

  • A) It has a relatively large user-base now, and im betting 90% of the people that use it use the shortcut rather than the command palette. Plus, people can always change the shortcut themselves (I may add this to the readme).
  • B) The other easy shortcuts that make sense are taken, and im not going to use something crazy like "ctrl + alt + f + js".

This is part of the reason I started Format, so people could have an easily installed all in one formatter with a single shortcut (Format chooses the correct formatter based off file extension, then active syntax if the file buffer has no extension or hasn't been saved). Format is still a little beta, but it has support for javascript and html; its pretty stable, one of my co-workers uses it in lieu of JsFormat. Part of the reason I haven't put more time in to this is because it is hard to find pure python formatting libraries that dont suck, my parser/lexer expertise is lacking, and I really don't want people to have to install extra dependencies themselves. Maybe I just need to suck it up and learn antlr with a python target and get good with it, I dunno.

I am 100% open to suggestions on how to handle this issue in JsFormat, but I don't want it to turn into a bitch fest between package maintainers with shit like "my plugin has more people watching it on github, so you should change your shortcut".

So suggestions please?

tl;dr: I don't have a solution off the top of my head, someone please give me one.

@arxpoetica
Copy link

Right, my point (which probably didn't come through clearly) was that the conflict was probably the root of the problem for other people's experiences.

As for solutions, I think you could start by making the shortcut only work on json and js files, but since that's what you're doing with Format, sounds like you're on track. That doesn't necessarily solve the conflict problem, but it gives us a method to go to the other plugin (tag) and make the same request (only work in xml or html files, etc.).

@jdavisclark
Copy link
Owner

you were pretty clear, I'm with you.

I'll spend a little time looking in to it this weekend, and see if I can start coming up with a list of other plugins with conflicting shortcuts.

@jdavisclark
Copy link
Owner

Pushed up a new branch a few days ago ('shortcut_conflict'), which enables/disables JsFormat based on the extension/syntax of the current file buffer, which is configurable in the settings. This should help prevent JsFormat from stealing the keybinding from other plugins, but it won't help with other plugins that steal the same keybinding.

Have a look, send feedback.

@popapps
Copy link

popapps commented Jul 21, 2012

On MacOS X I solved remapping the default binding:

[{ "keys": ["super+ctrl+alt+f"], "command": "js_format"}]

@opensas
Copy link

opensas commented Aug 17, 2012

I can confirm I have the same problem here

I uninstalled "Tag" plugin, but now I get an " Instant file search" plugin messing aroung with my ctrl-alt-f keybinding (I couldn't find which plugin was that)

I added

{ "keys": ["ctrl+alt+f"], "command": "js_format"}

to my key-bindings user file and t worked

ubuntu 12.04
running Linux ubuntu 3.2.0-29-generic #46+kamal5~DellXPS-Ubuntu SMP Sun Jul 29 18:49:08 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
sublime 2.0.1 build 2217

@jdavisclark
Copy link
Owner

I added:
{ "keys": ["ctrl+alt+f"], "command": "js_format"}

My guess is this worked because anything in your user key-bindings file will override any key-bindings specified by plugins.; Which would suggest that you definitely still have another plugin trying to steal ctrl+alt+f.

I have added a wiki page here where we can document some of the offending plugins. Most of these probably dont implement the is_enabled override, which would fix the problem pretty easily. (JsFormat doesnt have it yet either. Its in a feature branch I haven't merged in yet)

@OsemDing
Copy link

OsemDing commented Nov 1, 2012

var obj = {
a: 1, // comment
b: 2,
c: 3
};

comment will move to the new line

@jdavisclark
Copy link
Owner

going to go ahead and close this, its not really productive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants