b-sharpe / SlackStorm

PHP Storm (IntelliJ) plugin that allows posting code snippets to a Slack channel
GNU General Public License v2.0
21 stars 12 forks source link

add syntax highlighting #14

Open gerbenvandijk opened 8 years ago

gerbenvandijk commented 8 years ago

Slack usually let's you set a syntax for snippets, perhaps this is possible with the plugin as well?

Thanks, super useful plugin!

gerbenvandijk commented 8 years ago

And linenumbers corresponding to the actual ones would be amazing

b-sharpe commented 8 years ago

currently there is no way to beautify input via snippets. The API only allows attachments or pre-text unfortunately. For the line numbers, I'm not sure what you mean, it currently does display the lines selected within the file?

Nguimjeu commented 7 years ago

@b-sharpe I yeah that would be really if there were some kind of syntax highlighting option (Integrate Markdown support?). As for the line numbers I think @gerbenvandijk had something like in the attached screenshot in mind (which would also be really cool to have)

Snippet styled with Markdown

public function sendToSlack($message)
{
    $this->submit($message);
}

PhpStorm screenshot: line numbers.

line_number_syntax_high

qikkeronline commented 7 years ago

i might be wrong here, but isn't it possible by setting the file type of a snippet @b-sharpe ?

https://api.slack.com/types/file -> scroll down to "file types":

Possible filetype values include, but are not limited to the following:\
auto    Auto Detect Type
text    Plain Text
applescript AppleScript
boxnote BoxNote
c   C
csharp  C#
cpp C++
css CSS
csv CSV
clojure Clojure
coffeescript    CoffeeScript
cfm Cold Fusion
d   D
dart    Dart
diff    Diff
dockerfile  Docker
erlang  Erlang
fsharp  F#
fortran Fortran
go  Go
groovy  Groovy
html    HTML
handlebars  Handlebars
haskell Haskell
haxe    Haxe
java    Java
javascript  JavaScript/JSON
kotlin  Kotlin
latex   LaTeX/sTeX
lisp    Lisp
lua Lua
markdown    Markdown (raw)
matlab  MATLAB
mumps   MUMPS
ocaml   OCaml
objc    Objective-C
php PHP
pascal  Pascal
perl    Perl
pig Pig
post    Slack Post
powershell  PowerShell
puppet  Puppet
python  Python
r   R
ruby    Ruby
rust    Rust
sql SQL
sass    Sass
scala   Scala
scheme  Scheme
shell   Shell
smalltalk   Smalltalk
swift   Swift
tsv TSV
vb  VB.NET
vbscript    VBScript
velocity    Velocity
verilog Verilog
xml XML
yaml    YAML
b-sharpe commented 7 years ago

@Nguimjeu @qikkeronline Unfortunately inline line numbers and code formatting are not something you can do via a incoming webhook, basically you are bound to what can be done here: https://api.slack.com/docs/messages/builder

The file types link is for attaching actual files via https://api.slack.com/methods/files.upload which is using the Web API + OAuth rather than webhooks

qikkeronline commented 7 years ago

Clear, thanks for explaining @b-sharpe 👍