This bike-shedding proven pretty constructive for me anyway, noticed some bugs in the gist code, and the edit preferences code.
I’m going to merge ideas/insights from both of them and slap some unit tests on em at some point.
This bike-shedding proven pretty constructive for me anyway, noticed some bugs in the gist code, and the edit preferences code.
I’m going to merge ideas/insights from both of them and slap some unit tests on em at some point.
There seems to be a bug with path return. If path was not recursive, you would return the path as a boolean. I have fixed it below.
[pre=#2D2D2D]def get_package_asset(package_name, file_name, get_path=False, recursive_search=False):
packages_path = sublime.packages_path()
sublime_package = package_name + “.sublime-package”
path = None
if os.path.exists(os.path.join(packages_path, package_name)):
if recursive_search:
path = _find_file(os.path.join(packages_path, package_name), file_name)
elif os.path.exists(os.path.join(packages_path, package_name, file_name)):
path = os.path.join(packages_path, package_name, file_name)[/pre]
bike-shedding, that was a new one for me; had to consult google . Yeah, I try not to get too invested in my stylistic opinions. Usually, I throw it out there and if people ignore it, I shrug it off. I realize my opinion doesn’t govern the world
.
[quote=“castles_made_of_sand”]https://github.com/sublimator/PackageResources/blob/master/package_resources.py
My shed got purple [/quote]
Cool. I will give it a try.
Send us a pull request when you find bugs or add features eh …
The globber aint finished btw …
[quote=“facelessuser”]I do do a number of score selectors, but not as many as you would think.
I grab the scope name from the selection and then compare all of the theme scopes with score_selector. Once I determine the best matches, I add the scope name with the best theme scope matches for foreground, background, etc. to the dictionary and never have to run score_selector on the same scope again.
I don’t notice much of a difference with the ST2 version and the ST3 version for this plugin.[/quote]
That’s a clever use of memoization
[quote=“facelessuser”]There seems to be a bug with path return. If path was not recursive, you would return the path as a boolean. I have fixed it below.
[/quote]
Woops, that was bad.
Is it possible to have assets outside of one of the sublime text paths (as specified in the following test)
r2 = (tc("/Abs/Packages/ZipPseudo.sublime-package/nested/sort.py"))
Made a couple updates. Used walk’s recursion rather than my own. get_package_and_asset_name should now
Think I’ve taken everything that has been mentioned. get_package_asset now defaults to returning files UTF-8 encoded. In addition, there are two new parameters, a boolean to return the data in it’s binary form (default false) and a string for encoding type (default utf-8).
[quote=“skuroda”]
Is it possible to have assets outside of one of the sublime text paths (as specified in the following test)
CODE: SELECT ALL
r2 = (tc("/Abs/Packages/ZipPseudo.sublime-package/nested/sort.py"))[/quote]
I don’t think so, not meaningfully anyway. If your routine relies on removing the install path prefixes just kill the test case.
In contrast to a path like Packages/Yes/no.yes
Abs
there was just symbolic of an absolute path to the executable folder or installed_packages_path()
**“De”**coded
gist.github.com/skuroda/4965913 … set-py-L62
Not sure if you wanted this to work on ST2 as well as ST3, but afaik, the open builtin on python2 doesn’t take an encoding kwarg.
I think codecs.open, on the other hand, works
encoding String representing the encoding to use when reading.
Only takes affect when return_binary is True
(default utf-8).
I think that was meant to be when return binary is False
Okay fine UTF-8 decoded by default. Yup definitely should be False. Hmm I should fix that, no reason this shouldn’t work for ST2 and 3. I guess if I was thinking beforehand I would have written something like this earlier. I should take a closer look at your PackageResources stuff. It’s probably a lot better than mine. Though if I only wrote code where it was better than everyone else’s, well I wouldn’t be writing very much. And that’s no fun. Thanks for all the feedback.
I stole some of your ideas
There’s some other functionality in there (that I eventually want to finish … one of these days ) re: globbing
Was doing flat globbing until you made me realize that settings / keymaps could be nested.
re: package assets:
Turn on sublime.log_commands(True) and run the menu item Preferences -> Default keybindings
Take note of the command and args.
You can use that ${packages}/Path/to.file
form to open package assets, be they zipped or not. If they zipped they are open in read only mode.
Dunno if that’s interesting to you for anything but I think it’s kinda neat.
Everybody’s stuff seems to work great for what I am doing. I didn’t really have to do anything…I could get used to this . I will probably roll out a new ExportHtml rev tomorrow. Got too much stuff tonight going on.
[quote=“castles_made_of_sand”]
Turn on sublime.log_commands(True) and run the menu item Preferences -> Default keybindings
Take note of the command and args.
You can use that ${packages}/Path/to.file
form to open package assets, be they zipped or not. If they zipped they are open in read only mode.
Dunno if that’s interesting to you for anything but I think it’s kinda neat.[/quote]
That is interesting. I have to say, I’m glad ST3 was updated to make those files read only if they were read from sublime-packages.
Haha. Don’t tell me you want to try to do something like this person did (link)
[quote=“skuroda”]
Haha. Don’t tell me you want to try to do something like this person did (link)[/quote]
That sounds awesome…if only I could get away with it… .
New version published with the ability to find color schemes in zip files. Thanks everyone for your contributions.
Looks like a couple of my plugins don’t work when they are archived as .sublime-package. This should be fixed for ExportHtml now.
I’m currently using build 3020 and can not seem to override nor access the default settings. Is this an ExportHTML issue or a ST3 package issue? Is the master branch compatible with ST3 now?
Overriding the settings file on 3020 should not be a problem. I know that at work on my Windows machine it is working fine. What platform are you on: windows, mac, linux?
As for accessing the default, I have just pushed a commit that allows for access to default settings via the menu at Preferences->Packages->ExportHtml.
As for branches, none of the main branches support ST3 at this time. I am waiting to see how Package Control sorts all of this out. It is way too much work to make these plugins (especially the complicated ones) support both ST2 and ST3. While possible, it may become pretty fragile, ugly, and troublesome in the future with new features etc. With that said, supporting multiple branches is also going to become tiresome as well, and I have full intentions to kill off support for the ST2 branches no later than the official ST3 release (if not sooner). While I won’t delete ST2 branches, I plan on providing no future work on them either as long as they are stable. They may get moved somewhere else, and the main branch might just become the ST3 branch.