Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Save snippets in XCode #3

Open
dzenbot opened this issue Jul 19, 2015 · 7 comments
Open

Save snippets in XCode #3

dzenbot opened this issue Jul 19, 2015 · 7 comments

Comments

@dzenbot
Copy link
Owner

dzenbot commented Jul 19, 2015

It would be really useful to also be able to save code snippets into the built-in snippet browser of XCode. There must be some private APIs to be able to achieve this easily 🙏

@pronebird
Copy link
Contributor

Yeah and then I have an idea to initialize git repo in Xcode snippets folder and sync it with github repo. Right now I do that manually but it would be amazing to do that in semi-automatic way.

@dzenbot
Copy link
Owner Author

dzenbot commented Aug 5, 2015

That would be amazing! Automagic stuff are exciting 😎

@pronebird
Copy link
Contributor

We should do it.

@dzenbot
Copy link
Owner Author

dzenbot commented Sep 21, 2015

@pronebird any plan on how achieving this?
It would be great to add another option on the contextual menu such as "Save Snippet in Library".

Once that's done, we could sync Gist snippets directly into Xcode's snippet library, and optionally, any gist or slack snippet shared, would be saved directly unto the library if selected by the user in the form.

Makes sense? Would be great to know how does your manual workflow work right now.

@pronebird
Copy link
Contributor

@dzenbot I am pretty swamped with work at the moment. Currently I commit and push stuff in git repo that I created at ~/Library/Developer/Xcode/UserData/CodeSnippets. This is where Xcode puts all of snippets.

@dzenbot
Copy link
Owner Author

dzenbot commented Sep 27, 2015

I just pushed an initial work on this:
https://github.com/dzenbot/XCSnippetr/tree/xcode-snippet-support

The only remaining thing is to adapt the XCSMainWindowController's UI which is the form to create a new snippet, to be able to set the title, shortcut and other metadata.

@pronebird
Copy link
Contributor

I am slowly pushing more commits to my own fork. I've created a simple NSOperation based Git repository manager.

Currently it's able to initialize snippets repository, stage and commit everything. Push/pull aren't possible yet because I need UI to ask for remote repository URL.

I haven't figured out the way to fail NSOperations yet when git fails to execute the command. Error reporting should be improved in general.

https://github.com/pronebird/XCSnippetr/blob/xcode-snippet-support/XCSnippetr/Class/XCSKit/Source/Managers/XCSSnippetRepository.m#L65

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

No branches or pull requests

2 participants