Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    // Javascript files don't show even background in ver. 7.7 //

    Help wanted · · · – – – · · ·
    3
    12
    102
    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.
    • Ricardo E. Trelles 0
      Ricardo E. Trelles 0 last edited by

      Hi!

      I very much like NP++ ability to show a different background for code in different languages.

      Currently I have a project loaded in ver. 7.7 and I have managed to make it show the background I want for PHP and another background for Javascript. JS embedded is OK, but JS files are shown with the selected background only behind the lines with code. Empty lines and final spaces of lines are shown white. I don’t like it at all.

      Can anybody help me with that, please. Thank you.

      Ricardo E. Trelles 0 2 Replies Last reply Reply Quote 0
      • Ricardo E. Trelles 0
        Ricardo E. Trelles 0 @Ricardo E. Trelles 0 last edited by Ricardo E. Trelles 0

        @Ricardo-E-Trelles-0

        In Style Configurator > JavaScript > DEFAULT I have the background I want.
        Same for JavaScript (embedded) > DEFAULT

        1 Reply Last reply Reply Quote 0
        • Ricardo E. Trelles 0
          Ricardo E. Trelles 0 @Ricardo E. Trelles 0 last edited by

          @Ricardo-E-Trelles-0 Switched to ver. 7.8.6
          Same problem with JavaScript files.
          Please help!!!
          Thank you.

          Ekopalypse 1 Reply Last reply Reply Quote 0
          • Ekopalypse
            Ekopalypse @Ricardo E. Trelles 0 last edited by

            @Ricardo-E-Trelles-0

            Your second post made me believe you’ve solved your problem but this doesn’t seem to be the case. I’m still confused about what works and what not,
            so I would suggest you post a picture about to explain it.
            Posting a picture is as easy as with normal copy and paste operations. And post your debug info from the ? menu, the last menu item.

            Ricardo E. Trelles 0 1 Reply Last reply Reply Quote 1
            • Ricardo E. Trelles 0
              Ricardo E. Trelles 0 @Ekopalypse last edited by

              @Ekopalypse Thank you very for your attention!

              Yes, my second post could be interpreted as that I had solved the problem, but I hasn’t.

              Again, the problem is that when I set the background color in JavaScript, the same for embedded and regular file, embedded code looks well but regular files show the background color only close to the characters, blank lines and empty ends are shown white. That’s annoying .

              Funny thing is that for PHP both embedded code and regular files look fine, with their background color filling everything.

              Now I found an installation of NP++ ver 5.1 where that problem doesn’t show. In ver. 5.1 System Configurator > Language > Javascript doesn’t have also “Javascript (embedded)”. I’m thinking that problem started with new versions, offerening both options.

              I hope you understand the description of the problem above or can see the difference JS/PHP in the capture included.JS-PHP-backcolor.jpg I emphasized the blue in JS to make it more noticeable in this sample.

              What do you think?

              Thank you.

              Ekopalypse 1 Reply Last reply Reply Quote 0
              • Ekopalypse
                Ekopalypse @Ricardo E. Trelles 0 last edited by

                @Ricardo-E-Trelles-0

                So do I understand correctly if I say you want to have a different theme
                based on the programming language used?
                Like for example this

                Python:
                3df62f5e-da4c-41b1-a6f6-5f4b7919475b-image.png

                JavaScript:
                146c881f-28de-4c65-89ae-2501330b68cf-image.png

                1 Reply Last reply Reply Quote 1
                • Ricardo E. Trelles 0
                  Ricardo E. Trelles 0 last edited by

                  @Ekopalypse No, my only concern is with the background color in Javascript. It doesn’t fill all the background when a JS file is shown (left in my first picture). To the right you see a PHP file, background fills everything between “<?php>” and “?>”.

                  However, in embedded JS background fills everything between “<script>” and “</script>”.

                  In the past, with NP++ v5.1, we had Style Configurator > JavaScript to select colors, then we started to have Style Configurator > JavaScript (embedded) too. See new picture, with NP++ v5.1 background color fills everything in all JS code.

                  Now you see what is happening?

                  JS-PHP-backcolor-2.jpg ing in the newer versions?

                  Thank you.

                  1 Reply Last reply Reply Quote 0
                  • PeterJones
                    PeterJones last edited by

                    For javascript embedded, when there is a script inside an HTML or (per your experiment) PHP:

                    By default, they manually set every background to RGB=(242,244,255)
                    3eda117a-b8a3-4fc6-847b-8e31ad10889f-image.png

                    If I change one of them to orange, it works as expected.:
                    ab9c1a62-85ec-400e-ae99-e6010ff9b4f3-image.png

                    I would have to change all the backgrounds inside javascript (embedded) to completely change the background

                    For pure javascript files (*.js), all the backgrounds are set to white; if you change just JavaScript > DEFAULT to yellow, only some will be backgrounded as yellow; if you change all the javascript styles to yellow (like shown below), then all of the .js characters will have a background of yellow, except empty space and unused characters, because that background is set by the theme’s GlobalStyle > DEFAULT style.
                    a5311e95-78c6-4da1-a4a6-ab68758162d8-image.png

                    The javascript (embedded) was coded uniquely, to allow the JavaScript(embedded)>DEFAULT style to affect the background of the whole region including spaces and unused. The standalone javascript was not coded that way, because you do not need to highlight the difference between the <script> section and the non-<script> section in a file that’s completely javascript.

                    1 Reply Last reply Reply Quote 1
                    • Ricardo E. Trelles 0
                      Ricardo E. Trelles 0 last edited by

                      @PeterJones said in // Javascript files don't show even background in ver. 7.7 //:

                      The javascript (embedded) was coded uniquely, to allow the JavaScript(embedded)>DEFAULT style to affect the background of the whole region including spaces and unused. The standalone javascript was not coded that way…

                      Sorry, in a Javascript file (not embedded, of course) one should see also blank lines and ends of lines with the same background that around characters. Do you see the effect in the left of my first picture? (I have set the same color for JavaScript > DEFAULT and everything there).

                      PHP files are shown with all background filled uniform (right of that same first picture). Why JS files would be different?

                      PeterJones 1 Reply Last reply Reply Quote 0
                      • PeterJones
                        PeterJones @Ricardo E. Trelles 0 last edited by

                        @Ricardo-E-Trelles-0 said in // Javascript files don't show even background in ver. 7.7 //:

                        Sorry, in a Javascript file (not embedded, of course) one should see also blank lines and ends of lines with the same background that around characters.

                        Sorry, I already said, “except empty space and unused characters, because that background is set by the theme’s GlobalStyle > DEFAULT style.”. The main background for a theme (whitespace and empty space) is set by the theme’s GlobalStyle > DEFAULT, not by any language-specific settings. So you cannot do what you have asked.

                        The source code in the “embedded-javascript lexer” (I assume it’s actually source code in each of the individual lexers like HTML and PHP which can handle embedded-javascript; as far as I know, there isn’t a standalone parser for “embedded javascript”) makes a special, unusual, non-standard exception which overrides the background even on blank/empty, for just the portions of the main file that are in embedded-javascript-mode; this is not something that the standalone javascript lexer does.

                        The whole point of the GlobalStyle > DEFAULT style is that it is the style that sets the background color for empty space, not any language-specific setting. That is core to the design of the syntax highlighter in Notepad++.

                        PHP files are shown with all background filled uniform (right of that same first picture).

                        Oh, I see your confusion now. It’s because they aren’t shown with “all background filled uniform”. You just think they do because all of your PHP syntax occurs within the <?php … ?> pseudo-tag. Anything outside that tag does not get that background color, even though it’s not part of the same file.

                        aaa1daaf-85a8-4580-9aec-45f0dfcb0421-image.png

                        JavaScript doesn’t have the same sort of all-wrapping tag around the source code that PHP has, so it doesn’t violate Notepad++'s intent of GlobalStyle > DEFAULT setting the background color for the whole document, and every other per-language style only making minor exceptions to that default. Personally, I would vote for PHP’s syntax highlighter to not violate that principle, and instead I think that PHP shouldn’t take over empty-space backgrounds.

                        1 Reply Last reply Reply Quote 1
                        • Ricardo E. Trelles 0
                          Ricardo E. Trelles 0 last edited by

                          OK. So you prefer the look of JS (left) to PHP (right) in my first picture. I only hope they don’t make my PHP code look like the JS there. If so, I would have to revert to version 5.1, where JS files, no being embedded, have a clean uniform background and look the same to the embedded one.

                          Thank you. You made me know that problem (for my taste) isn’t a mistake, it’s a “feature”.

                          PeterJones 1 Reply Last reply Reply Quote 0
                          • PeterJones
                            PeterJones @Ricardo E. Trelles 0 last edited by

                            @Ricardo-E-Trelles-0 ,

                            If you don’t like the background, change the default background. I’ve pointed you to the setting multiple times.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright © 2014 NodeBB Forums | Contributors