Open aminimalanimal opened 7 years ago
Unfortunately, the Package Control website uses the README from the master, not the latest release. The keymap has indeed changed, but I haven't released a new version yet.
The correct instructions:
https://github.com/idleberg/sublime-cson-converter/tree/0.6.2
I copy/pasted this repo's sublime-keymap into the user settings file on my machine and restarted Sublime to see that alt
+shift
started working (in that it threw an alert that my CSON was invalid). I cut everything out of the file save for a single object and it still threw the error.
Opened Sublime's console to see that it was complaining about a lack of coffeelint
. npm i -g coffeelint
, reset Sublime, and no more complaints. The key command stopped triggering the alert... but it also didn't convert the file.
If coffeescript and/or coffeelint are needed in the user's node environment, I think that's worth noting in the documentation.
I wonder why Sublime installed a different sublime-keymap than the one in this repo—it shows a link directly to this repo and lists v0.6.2 as well.
(I hadn't been looking at the version 0.6.2 tree when the above statement was made. Sublime indeed installed an identical keymap as the files in the tree.)
Hmm... Removed my changes to Key Bindings > User, verified that my versions of the other keymap files are the same as in the tree you linked me to, restarted Sublime, and I'm still not getting any feedback when using option
+command
+c
, option
+command
+j
. (I'm assuming that by alt
, you mean option
, not that I should hold the fn
key while hitting option
... but I tried that, too.) (I'm also assuming that despite using capital C
or J
that I'm not supposed to hold shift
).
Are there requirements for the file extension? Should it be .coffee
or can it be .cson
? Should I highlight the text I'm trying to convert, or will it just do the entire file?
It's properly labelled in the Command Palette:
It's also worth noting that the keymap only works in the contexts source.json
and source.coffee
– in case you're working with files that don't have the correct scope assigned.
Weird. That's exactly what I would have hoped to find in the command palette, but it doesn't appear for me. I changed my file's extension to .coffee and restarted, and it's still absent.
The file extension is not the key, having installed a syntax highlighter for CoffeeScript is! I recommend ”Better CoffeeScript”. Even without a CoffeeScript package installed, you should be able to convert JSON to CSON.
Is there a folder called cson
in your Packages directory? If not, try running the ”Package Control: Satisfy Dependencies” command.
I have Better CoffeeScript installed and it's set to the default syntax for .coffee files. Double-checked it for this one, too. Even just removed and installed it again to make sure. No such options in the command palette. We're both using Sublime Text build 3126?
I'm using build 3142. At the time of the package's initial release, 3114 was the latest.
Does conversion work when you trigger it from the command palette or the menu? Are there any errors in your console?
Ooh. Okay, I see an error in the console:
reloading plugin CSON Converter.CSON Converter
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 109, in reload_plugin
m = importlib.import_module(modulename)
File "./python3.3/importlib/__init__.py", line 90, in import_module
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 915, in load_module
exec(compile(source, source_path, 'exec'), mod.__dict__)
File "CSON Converter in /Users/[me]/Library/Application Support/Sublime Text 3/Installed Packages/CSON Converter.sublime-package", line 2, in <module>
File "/Users/[me]/Library/Application Support/Sublime Text 3/Packages/cson/all/cson/__init__.py", line 1, in <module>
from .parser import load, loads
File "/Users/[me]/Library/Application Support/Sublime Text 3/Packages/cson/all/cson/parser.py", line 1, in <module>
from speg import peg
ImportError: No module named 'speg'
Sublime Text's website still has 3126 as its main download link. Looks like you're running a dev build and they haven't launched an update to the main version for a year. o_O I may have to go check out that dev build.
There's a missing dependency. As a quick fix, try the following:
cd ~/Library/Application Support/Sublime Text 3/Packages
git clone https://github.com/idleberg/sublime-speg speg
Then relaunch Sublime Text.
Received a nearly identical error (everything but the ImportError was the same), but now it wants peg
, I suppose:
ImportError: cannot import name peg
Alright, I can't release a new version at this point, I first need the Package Control developers to accept a PR of mine.
If you need this package to work urgently, here's what you can do:
cd ~/Library/Application Support/Sublime\ Text 3/Packages
https://github.com/idleberg/sublime-cson-converter "CSON Converter"
cd CSON\ Converter
git checkout tags/0.6.2
dependencies.json
(in the CSON Converter folder) to look like this:{
"*": {
"*": [
"cson", "speg"
]
}
}
Thank you so much for being so responsive.
Followed your manual installation instructions, and it works. Woo!
Interestingly, Sublime didn't give me a chance to run Satisfy Dependencies
before informing me with an alert that it automatically detected two dependencies, installed them, and I should restart. After restarting, it still finds one. Looks like everything's fine, save that I'll receive that warning when I start Sublime. I did run Satisfy Dependencies
, but it didn't make a difference. Hopefully that behavior won't be present once Package Control accepts your PR.
Also, tweaked a couple of things to run your above code snippet. I knew what you were going for, but the corrections may help someone else (though hopefully it won't be long before Package Control accepts the changes):
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone https://github.com/idleberg/sublime-cson-converter "CSON Converter"
(needed spaces to be escaped, forgot to add git clone
)
Again, thank you so much. I've got a lot of converting to do, and you've taken a great deal of weight out of the task. <3
Could you please tell me the exact warning message?
The error that occurs when I open Sublime:
Package Control
Error executing: /usr/bin/git symbolic-ref -q HEAD
Working directory: /Users/[me]/Library/Application Support/Sublime Text 3/Packages/CSON Converter
VCS-based packages can be ignored by changing the "ignore_vcs_packages" setting to true.
Sublime Text will need to be restarted once the setting is changed.
I discovered that this message also opens when I try to run Package Control: Install Package
, and it prevents me from installing new packages. (Still, I've ignored that for the moment... figured I'd just remove the manually installed package and wait for the update after I'm done converting.)
On startup, after I close the above message, I also get:
Package Control
1 missing dependency was just installed. Sublime Text should be restarted, otherwise one or more of the installed packages may not function properly.
Maybe try deleting the .git
folder inside the CSON Converter folder
Sorry, I can't really continue debugging it. I removed the package when Sublime's new version came out yesterday. Good news is I just reinstalled it through Package Control and it works.
Maybe it was somehow related to the older version? Or maybe Package Control has approved your PR? Either way, I think we can close this issue.
The documentation looks like it's internally conflicted as to which keys should be pressed. It states:
None of the items in the table use
Ctrl
+Alt
orCmd
+Alt
. The sublime-keymap that comes with it (when installed via Package Control) usesctrl
+alt
(on OS X). This is different from the sublime-keymap in this repo, which usesalt
+shift
.I attempted to use the plugin today with every possible key combination I could think of. I'm familiar with Sublime's
command
+k
,b
shortcut to hide and show the sidebar, so I think that I'm typing them in correctly (holding the modifier keys, then clickingc
, thenj
).At some point, I hit something that removed all white space from my CSON, but I never did get it to convert into bracketed JSON. I'm not sure if the converter tried to run or I just hit a different key command entirely.
It would be nice if this plugin added commands to Sublime's Command Palette so that I could be sure that I was triggering it.