Sunday, February 20, 2011

smali syntax highlighting for notepad++

update 10/8/2013:
thanks to Ádám Tóth for creating a dark themed version. i've linked to it next to the main version.

update: 11/10/2011:
thanks to Jho for pointing out how to get code folding to work. i updated the syntax file and made a few other tweaks. the link and picture have been updated and here are the instructions for installing (tested with v5.9.6.1):
View -> User-Defined Dialogue...


Click Import


Select smali_npp.xml
       no picture here, use imagination

There will be a message box that says "Import successful."
Any new files you open should have syntax highlighting.



several people have asked for smali highlighting for notepad++. thanks to furrelkt for having already sent me an example. here's what i've come up with: https://sites.google.com/site/lohanplus/files/smali_npp.xml
for dark backgrounds, try this:  https://sites.google.com/site/lohanplus/files/smali_npp_darkbg.xml


there are many limitations for notepad++'s user defined language. i could not get many tokens to highlight correctly, or as well as ultraedit or the highlighter used on this blog. perhaps a full lexer plugin could handle it. if you write one or make improvements to this xml, let me know.

25 comments :

  1. Thank you so much for this!!!

    This is sure to be an absolute blessing on my tired eyes when spending all day digging through smali code now.

    Cheers, =)

    ReplyDelete
  2. U are just an asshole u know? just little crapy asshole. your blog sucks, you suck and all your life sucks too. people like me work many days to leave from android apps and what do you? hey asshole, think about your lifetime

    ReplyDelete
  3. @Anonymous: i'd like to help, but i am not sure what the problem is.

    ReplyDelete
  4. Lohan check your email please.

    ReplyDelete
  5. Thank you!

    Here a highlighting file for Vim
    http://codetastrophe.com/smali.vim

    ReplyDelete
  6. ah very good jon! do you mind if i make a post linking to this? i have been working on my own, but yours is more fleshed out. we even named several things exactly the same. the only thing i could think to add is code folding (ex: '.method' -> '.end method')

    ReplyDelete
  7. Awesome, Thanks!!

    I have only 2 suggestions:

    1. Publish your work in the Notepad++ official list of User Defined Language Files:
    http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=User_Defined_Language_Files

    2. Add install instructions.

    ReplyDelete
  8. @Anonymous:

    Not everyone uses this information to "crack" apps. In fact, most I know use it to tweak and customize system files.

    @lohan:
    Install instructions please? I can't seem to get Notepad++ to actually use this file. I've tried import style theme, i've tried copying the file into the notepad++ folder along with the other themes, everything... I just CANNOT get it to actually use it.

    ReplyDelete
  9. aelfwyne, i do not actually use (or like) notepad++. have you tried moving userDefineLang.xml to %APPDATA%\Notepad++\ ? this intolerably weird handling of highlighting is just one of the reasons i don't care much for it.

    ReplyDelete
  10. doesn't work for notepad++ 5
    (notepad++ 5 hangs out )

    ReplyDelete
  11. If you add these lines:

    <Keywords name="Folder+">.method .annotation</Keywords>
    <Keywords name="Folder-">.end\ method .end\ annotation</Keywords>

    and remove all the keywords found here (.method, .annotation, etc) from the other lists, then code block collapsing works

    ReplyDelete
  12. thanks Jho. everything updated and much appreciated.

    ReplyDelete
  13. Still does not work on Notepad++... Import gives no errors but there is NO hiliting at all. Why is it so difficult to actually make something that works?

    ReplyDelete
  14. @Anonymous:
    1) i have no idea what "hiliting" is. is it a sport? is it good or bad that there is none of it?

    2) if it does not work, then i'm very, very curious as to how i was able to get those screen shots. what a mystery, indeed!!

    3) your last question seems to be more of a philosophical / personal crisis that i can't help you with.

    i'd be more helpful if you didn't come off sounding like an ass.

    ReplyDelete
  15. is there any way to remove ads from apk file ?
    Thanks !

    ReplyDelete
  16. Notepad++ highlighting doesn't work after "\"" in a smali file. Maybe it thinks everything thereafter is a string. Can we avoid it ?

    ReplyDelete
    Replies
    1. 1. Run Notepad
      2. Import user defined language from this topic
      3. Language > Define your language..
      4. Select Smali
      5. Operators
      5. Delimeters 2 > Escape
      6. Write \
      7. Close.
      8. Sucess

      Delete
    2. Thanks. It worked.

      Delete
    3. Thank Youu :)

      Delete
  17. Well, for me it works perfect! Thanks! :)

    ReplyDelete
  18. I've modified your highlight to create a highlight that works better with dark themes..
    https://dl.dropboxusercontent.com/u/52395293/smali_npp_darkbg.xml
    you can change to a dark theme in Settings\Style Configurator...

    ReplyDelete
  19. thank you for sharing this!

    ReplyDelete
  20. When I click on view in notepad++ there is no "user defined dialog" option to select. Do I need to enable something in Notepad++ for this option to show?

    ReplyDelete

Do NOT post about or link to specific apps!