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

Colorcoder now allows saving to custom directory locations #35

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Colorcoder now allows saving to custom directory locations #35

wants to merge 12 commits into from

Conversation

Sawtaytoes
Copy link

Modified Colorcoder to allow saving custom (Colorcoded) color schemes to custom directory locations.

I also added a custom max_size so people who have beefier machines can have it automatically turn on for larger files.

@@ -64,13 +64,13 @@ def on_load(self,view):
view.settings().set('colorcode',False)
return

if view.size() > set.get('max_size',10000) and not view.settings().get('forcecolorcode',False):
if view.size() > set.get('max_size',colorshemeemodifier.get_max_size()) and not view.settings().get('forcecolorcode',False):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sublime API states:

get(name, default) Returns the named setting, or default if it's not defined.

what you are doing here is essentially

 set.get('max_size',set.get('max_size'))

which is redundant
please revert this and following changes of same manner

@@ -204,9 +230,9 @@ def modify_color_scheme(l,s,read_original = False):
)
))

newname = "/Colorcoder/%s (Colorcoded).tmTheme" % re.search("/([^/]+).tmTheme$", name).group(1)
newname = "/%s (Colorcoded).tmTheme" % re.search("/([^/]+).tmTheme$", name).group(1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the way you populate newname will lead to problems in L#238, as color_scheme setting expects to have an sublime.load_resource compatible path eg Packages/Colorcoder/Obsidian (Colorcoded).tmTheme

i guess it would be simpler just to do

newname = "/%s/%s (Colorcoded).tmTheme" % (set.get('colorcoder_schemas_dir').strip("/\\"), re.search("/([^/]+).tmTheme$", name).group(1))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it. It has a relative and full path now. Phew! You were completely right. I was missing something huge!

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

Successfully merging this pull request may close these issues.

2 participants