Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

initial ST3 support #38

Merged
merged 4 commits into from
@kevinsperrine

No description provided.

@Geczy

Yess! Thank you!

Not only does this fix ST3 compatibility, this pull also makes CTRL + ALT + A on Windows work without having to change anything. Also fixes #33

@kevinsperrine

If it fixes the ctrl+alt+a issues, that's only a fortunate side effect of the ST3 switch (or related so something else entirely), because I didn't touch anything dealing with it.

@Geczy

Yeah I realized that when checking your commit, maybe ST3 fixed it.

@kevinsperrine kevinsperrine referenced this pull request
Closed

ST3 version? #36

@wbond
Owner

Have you tested this with both ST2 and ST3? I don't think this will work in ST2 as it stands.

@wbond
Owner

@Geczy The ctrl+alt+a issues are usually some sort of .pyc caching issue. If you open the .py file and save it, that should fix it too.

@kevinsperrine

@wbond, I had not, so this pull should take care of that. I've tested on Mac OSX ST2 and ST3.

@wbond
Owner

It would probably be cleaner and more pythonic to use a try/except clause instead of if/else. You can catch an ImportError I believe since Default.indentation won't be available on ST2.

You are correct, but I, being the Python newb that I am, did not know that. Thank You, sir. I have updated the code.

Owner

No worries, I appreciate you taking the time to test this out and get it working. It is easy for me to take a few seconds and review things, but with so many things going on it can be harder for me to get the time to sit down and open up different versions of ST and test things.

@wbond
Owner

I hope you don't mind my suggestions, but I was just looking over this, and for the ST3 try portion, you should be able to do:

from Default.indentation import line_and_normed_pt as normed_rowcol

Unfortunately the same thing is not possible with the ST2 part since it is more manually importing the Default package.

I don't mind. It's a great way for me a expand my python knowledge, and yes, that does work on ST3.

@jbrooksuk

@wbond please pull, I can't live without alignment, I'm such an OCD freak.

@Anahkiasen

No news on this ?

@wbond
Owner

I'm slogged down in the details of getting Package Control fully working on ST3. Hopefully after all of that infrastructure and changes are in place, it will be much simpler to do new releases. Sorry for the delay.

@LeonB

@wbond: thanks for all the hard work!

@Anahkiasen

Can't wait for this to get merged and thanks @wbond for making Sublime such a great tool.

@LeonB

@kevinsperrine Installed your python3 branch. Works greatforme :tm:

@zchrykng

Well... I was about to do a pull request of my own for this, but it is nearly identical to this one XD

@xrstf

This plugin is one of the blockers for my switch to ST3, so it would be great to see this merged :-)

@Anahkiasen

This souldn't stop anyone from switching, you can easily use the fixed version of Alignment by doing this (you'll need to have Alignment installed via Package Control first, this will just override the files) :

git clone -b python3 git://github.com/kevinsperrine/sublime_alignment.git "/Users/YOURUSER/Library/Application Support/Sublime Text 3/Packages/Alignment"
@nifr

This seems to make it work under ST3 Windows 7 x64 but it does not fix the ctrl+alt+a keybinding for me.

I have a fresh install of ST 3.0.48-x64 with no other plugin and ctrl+alt+a doesn't do anything. Binding alignment to another key combination works. executing from commandline ( view.run_command('alignment') ) does work too.

Opened and saved Alignment.py ,deleted everything in the Data\Cache folder , restarted ST3 with no result.

Any ideas?

@EHadoux

The tip from @Anahkiasen worked flawlessly for me in ST3, even with the default ctrl+alt+a keybinding.
Thanks :)

@wbond wbond merged commit b93ba6b into wbond:master
@jbrooksuk

Woo! Thanks @wbond!

@mogab9

Thank you guys!

@kevinsperrine kevinsperrine deleted the kevinsperrine:python3 branch
@Gavrisimo

Just FYI, tip from @Anahkiasen didn't work for me. I had Alignment installed via Package Controll.

What did work for me is this:

  1. I removed Alignment from Package Controll
  2. cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
  3. git clone git@github.com:wbond/sublime_alignment.git Alignment

And then cmd+ctrl+a is wooooooorking! WooooOOoooOOooo! :)

@Anahkiasen

Alignement works directly from Package Control now so that's why.

@Gavrisimo

Hmmm that's weird, it didn't work for me when I installed it via Package Controll. O_o

@callumlocke

Thank you @Gavrisimo, that finally got it working again.

I had previously tried to install it via Package Control, but it never worked. So this morning I removed it, and tried reinstalling it, and the installation seemed to finish, but when I checked under installed packages, it wasn't even there. (That's when I gave up on Package Control and followed @Gavrisimo's steps instead.) Anyone else have this problem? Should I open a bug for it?

@wbond
Owner

@callumlocke Alignment has supported ST3 for almost 6 months now. If you are having trouble installing it, be sure to turn on the Package Control debug setting (https://sublime.wbond.net/docs/settings#setting-debug). If you can't figure out why it isn't installing, post the full debug log from your Console on the Package Control issue tracker.

@Eptis

I'm getting this error when trying to install through package control:

Package Control: Unable to find a sublime-package file for Alignment
Package Control: Unable to find file package-metadata.json in the package Alignment
Package Control: Download Debug
URL: https://codeload.github.com/wbond/sublime_alignment/zip/2.1.0
Resolved IP: 192.30.252.147
Timeout: 30
Package Control: Urllib Debug Proxy
http_proxy:
https_proxy:
proxy_username:
proxy_password:
Package Control: Urllib HTTPS Debug General
Connecting to codeload.github.com on port 443
reloading Packages/User/Preferences.sublime-settings
found 1 files for base name Spacegray.sublime-theme
theme loaded
Package Control: Urllib HTTPS Debug General
Connecting to codeload.github.com on port 443
CA certs file at /Users/dennis/Library/Application Support/Sublime Text 3/Packages/User/Package Control.ca-bundle
Successfully upgraded connection to codeload.github.com:443 with SSL
Server SSL certificate:
subject: CN=*.github.com,O=GitHub, Inc.,L=San Francisco,S=California,C=US
common name: *.github.com
expire date: Jul 9 12:00:00 2014 GMT
Certificate validated for codeload.github.com
Package Control: Urllib HTTPS Debug Write
GET /wbond/sublime_alignment/zip/2.1.0 HTTP/1.1
Connection: Keep-Alive
Accept-Encoding: gzip,deflate
Host: codeload.github.com
User-Agent: Sublime Package Control v2.0.0-alpha7
Package Control: Urllib HTTPS Debug Read
HTTP/1.1 200 OK
Content-Length: 7639
Content-Type: application/zip
Content-Disposition: attachment; filename=sublime_alignment-2.1.0.zip
Date: Tue, 28 Jan 2014 11:25:15 GMT
Exception in thread Thread-17:
Traceback (most recent call last):
File "X/threading.py", line 639, in _bootstrap_inner
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/package_installer.py", line 241, in run
self.result = self.manager.install_package(self.package)
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/package_manager.py", line 489, in install_package
package_bytes = download_manager.fetch(url, 'Error downloading package.')
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/download_manager.py", line 180, in fetch
return self.downloader.download(url, error_message, timeout, 3, prefer_cached)
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/downloaders/urllib_downloader.py", line 113, in download
http_file = self.opener.open(request, timeout=timeout)
File "X/urllib/request.py", line 473, in open
File "X/urllib/request.py", line 491, in _open
File "X/urllib/request.py", line 451, in _call_chain
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/http/validating_https_handler.py", line 44, in https_open
return self.do_open(http_class_wrapper, req)
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/http/persistent_handler.py", line 94, in do_open
if r.is_keep_alive():
File "/Users/dennis/Library/Application Support/Sublime Text 3/Packages/Package Control/package_control/http/debuggable_http_response.py", line 58, in is_keep_alive
if connection.lower() == 'keep-alive':
AttributeError: 'NoneType' object has no attribute 'lower'

@jbrooksuk

@Eptis can you clone the repository manually?

@Eptis
@jbrooksuk

Maybe a firewall issue or something is wrong with your installation of PC?

@Eptis
@wbond
Owner

@Eptis You are using a very old alpha version of Package Control. Please wipe all traces from the Packages/ and Installed Packages/ folders and then install fresh from https://sublime.wbond.net/installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 9 deletions.
  1. +10 −9 Alignment.py
View
19 Alignment.py
@@ -5,14 +5,15 @@
import os
import sys
-# This is necessary due to load order of packages in Sublime Text 2
-sys.path.append(os.path.join(sublime.packages_path(), 'Default'))
-indentation = __import__('indentation')
-reload(indentation)
-del sys.path[-1]
-
-normed_rowcol = indentation.line_and_normed_pt
-
+try:
+ from Default.indentation import line_and_normed_pt as normed_rowcol
+except ImportError:
+ # This is necessary due to load order of packages in Sublime Text 2
+ sys.path.append(os.path.join(sublime.packages_path(), 'Default'))
+ indentation = __import__('indentation')
+ reload(indentation)
+ del sys.path[-1]
+ normed_rowcol = indentation.line_and_normed_pt
def convert_to_mid_line_tabs(view, edit, tab_size, pt, length):
spaces_end = pt + length
@@ -182,4 +183,4 @@ def run(self, edit):
view.insert(edit, region.b, ' ' * length)
if settings.get('mid_line_tabs') and not use_spaces:
convert_to_mid_line_tabs(view, edit, tab_size, region.b,
- length)
+ length)
Something went wrong with that request. Please try again.