Community
    • Login

    Styles for *.java language (android studio)

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 5 Posters 1.8k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SoCuS Offline
      SoCu
      last edited by

      What styles should be added to the java language, so that it appears with the same colors as in Android Studio programming?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @SoCu
        last edited by

        @socu ,

        We in the Notepad++ Community Forum are experts at Notepad++; that doesn’t mean that we also know anything about Android Studio. I have no idea what styles Android Studio uses.

        Notepad++ has the following in Settings > Style Configurator > Java:

        f439dc58-2fbc-4acd-9702-7020a5a588d3-image.png

        And here are examples of how it styles many of them (sorry, I don’t know Java, and don’t know how to include syntax that will show all the STYLES that Notepad++ defines for Java):
        bf0815b1-9986-4b25-813f-ab7955875cdf-image.png

        You may or may not be able to adjust the colors in the Style Configurator to match what you remember from Android Studio.

        SoCuS 1 Reply Last reply Reply Quote 3
        • SoCuS Offline
          SoCu @PeterJones
          last edited by

          Thanks PeterJones, what happens is that in the style configurator there are options that are not there, I do not know if you could add more styling options, such as putting color to the variables.

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP Offline
            PeterJones @SoCu
            last edited by

            @socu ,

            The languages in the style configurator have their definitions (“lexers”) compiled into the Notepad++ applications, so you cannot add a new category (“style”) using a config file. So you cannot tell a lexer “here’s a brand new rule for syntax; highlight that differently than anything else you already do”.

            However, you can add extra highlighting on top of (in addition to) a built-in lexer using regexes via the PythonScript plugin in conjunction with the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo . Install the Python Script plugin from Plugins > Plugins Admin, then download and save Ekopalypse’s script, and modify it per the instructions embedded in that script to apply it to your specific language, and derive a regex that would match the syntax you’d like.

            (However, I thought in java that variables were just plaintext sequences; you might be able to get away with just changing the style for DEFAULT, because as far as I can think of, anything that isn’t already defined as a keyword would be a variable or user-defined function. But I am not a Java expert, so maybe I’m not thinking of some obvious exception and what I’m saying is completely wrong and should be ignored.)

            1 Reply Last reply Reply Quote 2
            • EkopalypseE Offline
              Ekopalypse
              last edited by

              This is just to let everyone know that there is a [dedicated plugin] (https://github.com/Ekopalypse/EnhanceAnyLexer/releases) available.
              The advantage is that it should be faster than the PS solution, but it also has the disadvantage that it cannot handle sub-matches.

              1 Reply Last reply Reply Quote 4
              • guy038G Offline
                guy038
                last edited by guy038

                Hi, @ekopalypse,

                Just a small detail : in order to get the default correct syntax of links, of our forum, you should delete the space char between [dedicated plugin] and the link within parentheses !

                BR

                guy038

                EkopalypseE 1 Reply Last reply Reply Quote 3
                • EkopalypseE Offline
                  Ekopalypse @guy038
                  last edited by

                  @guy038

                  Yes, I know, and I usually do, but for whatever reason I added this space this time. And worse, I didn’t realise it when I posted it.

                  1 Reply Last reply Reply Quote 1

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors