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

Ability to set the type of snippet #1

Open
Anahkiasen opened this issue Apr 10, 2014 · 4 comments
Open

Ability to set the type of snippet #1

Anahkiasen opened this issue Apr 10, 2014 · 4 comments

Comments

@Anahkiasen
Copy link

In Slack now you can specify the type of the snippet (PHP, JSON, etc). Any way to add a way to set that (or recognize it automatically) when sending files and stuff ?

@simion
Copy link
Owner

simion commented Apr 16, 2014

Actually the chat.postMessage method does not have an option to send a code snippet (or i cannot see it).

@simion
Copy link
Owner

simion commented Apr 18, 2014

Also when sending files they are recognized automatically by their extension i think.

@mattparcher
Copy link

Thanks for the awesome plugin, @simion!

Based on my reading of the files.upload docs at https://api.slack.com/methods/files.upload:

It looks like with files.upload you can specify the filetype, which overrides the automatic filetype generated from the file extension.

It also seems that files.upload would be the right way to send a code snippet—basically sending the currently selected text in Sublime as the "content" of a new file to Slack, and optionally specifiying the filetype of the snippet (especially since filename and title are both optional in the Slack API).

Maybe I’m mistaken? My Python is pretty limited, or else I would try to test this myself.

@simion
Copy link
Owner

simion commented Jun 22, 2014

@mattparcher Honestly, I thought about this method, to upload a file containing the current selection and the name of the file you selected code from. This way, you will have automatic syntax highlighting.

As a workaround, I've added "pre" wrappers, temporarily. http://simionbaws.ro/sublime-slack/sublime-slack-preformatted-text/

Soon, i will implement your suggestion.

Thanks for your feedback.

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

No branches or pull requests

3 participants