Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1651

Adding syntax highlighing and code completion of different languages inside strings (C/C++)

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Next
    • Fix Version/s: None
    • Labels:
      None

      Description

      As of today, we can have a lot of languages inside strings like SQL or JS or HTML. If we have to add such code inside strings in C++, it is really hard to "debug" or to figure out what you have forgotton and not really readable because it is still a string.

      For this, NetBeans has embedded languages support and to not say I want exact this language inside a string, which doesn't make sense, because In C++ I can have HTML, XML, JS, SQL and whatever inside of a string, I should change it via a hint inside of the editor.

      So when I have a java file with code like this:

      string testSQL = "SELECT * FROM"; // Database access
      

      I would expect, that the code looks like a normal string, but when I click inside the string, I should get a hint where I can "Choose embedded language". After running this hint, a very small not disturbing dialog (Like the insert code dialog from java) should come up and should show me all supported languages like SQL, C/C++, Java, HTML, XML, CSS, JS, Regex, etc.

      This is a dynamic approach because setting it to a default language is not right. In the next line maybe you have this code:

      string myWhatever = "<h3>Nice</h3>"; // To render HTML ins a gui or smth like that
      

      And it should not look like SQL, it should still looks like a string, until I want to change it to HTML.

      This is the same approach as IntelliJ does and it works very well: https://d3nmt5vlzunoa1.cloudfront.net/c/c++storm/files/2018/09/DQL_inject.gif

      Maybe not every language makes sense there and an option for that is needed as well but for an MVP all is ok. IMHO.

      I don't know whether C makes sense but C++.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chrizzly Christian Lenz
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: