Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. VS 2022 a genuine wow moment

VS 2022 a genuine wow moment

Scheduled Pinned Locked Moved The Lounge
visual-studiocsharpjavascriptcom
39 Posts 20 Posters 0 Views 1 Watching
  • 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.
  • D dan sh

    I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

    // Replace all the commas that are between double quotes
    char[] linechars = line.ToCharArray();
    bool isInQuotes = false;

    for (int i = 0; i < linechars.Length; i++)
    {
    if (linechars[i] == '"')//This was predicted by Visual Studio

    This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

    "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #3

    It is pretty amazing sometimes - takes a bit of getting used to but it can really speed up your code. But even for a quick'n'dirty, that's rather long winded - especially if it's a long string as ToCharArray allocates memory and copies string content into it. You can index directly into a string, remember?

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    1 Reply Last reply
    0
    • D dan sh

      I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

      // Replace all the commas that are between double quotes
      char[] linechars = line.ToCharArray();
      bool isInQuotes = false;

      for (int i = 0; i < linechars.Length; i++)
      {
      if (linechars[i] == '"')//This was predicted by Visual Studio

      This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

      "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu Peter
      wrote on last edited by
      #4

      It is amazing... until it is not... Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

      “Real stupidity beats artificial intelligence every time.” ― Terry Pratchett, Hogfather

      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

      D L 2 Replies Last reply
      0
      • D dan sh

        I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

        // Replace all the commas that are between double quotes
        char[] linechars = line.ToCharArray();
        bool isInQuotes = false;

        for (int i = 0; i < linechars.Length; i++)
        {
        if (linechars[i] == '"')//This was predicted by Visual Studio

        This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

        "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #5

        Yeah, But I wonder how that works out for intellectual property and patents. AI-assisted development brings new legal challenges. U.S. appeals court says artificial intelligence can't be patent inventor[^]

        1 Reply Last reply
        0
        • D dan sh

          I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

          // Replace all the commas that are between double quotes
          char[] linechars = line.ToCharArray();
          bool isInQuotes = false;

          for (int i = 0; i < linechars.Length; i++)
          {
          if (linechars[i] == '"')//This was predicted by Visual Studio

          This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

          "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

          C Offline
          C Offline
          Calin Negru
          wrote on last edited by
          #6

          Quote:

          This IDE can read my code and comments and predict the next if statement.

          I`m not using VS 2022, a feature like that belongs to the realm of SF, really. Very original. Of course old fashion people (me included) might display appreciation towards this advancement in intellisense/autocomplete but will never actually use it in their projects.

          OriginalGriffO 1 Reply Last reply
          0
          • C Calin Negru

            Quote:

            This IDE can read my code and comments and predict the next if statement.

            I`m not using VS 2022, a feature like that belongs to the realm of SF, really. Very original. Of course old fashion people (me included) might display appreciation towards this advancement in intellisense/autocomplete but will never actually use it in their projects.

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #7

            You might be surprised - it's actually pretty good. I'm not young - 63 - but I'm finding it handy to "fill in the blanks" with the drudge stuff: it works out what they heck you are likely to be trying to do and provides a default text that uses sensible variables you used earlier and suchlike. It does appear to use the variable names to help it decide as well, which is a damn good reason for using sensible names at all times instead of "quick to type" ones ... :-D Give it a try (the Community edition is free so there's not a lot of excuse) - it might surprise you! (It did me.)

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            pkfoxP C 3 Replies Last reply
            0
            • OriginalGriffO OriginalGriff

              You might be surprised - it's actually pretty good. I'm not young - 63 - but I'm finding it handy to "fill in the blanks" with the drudge stuff: it works out what they heck you are likely to be trying to do and provides a default text that uses sensible variables you used earlier and suchlike. It does appear to use the variable names to help it decide as well, which is a damn good reason for using sensible names at all times instead of "quick to type" ones ... :-D Give it a try (the Community edition is free so there's not a lot of excuse) - it might surprise you! (It did me.)

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

              pkfoxP Offline
              pkfoxP Offline
              pkfox
              wrote on last edited by
              #8

              I use it for my hobby projects Paul and find it good - but I've never known a bad release of VS

              Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

              1 Reply Last reply
              0
              • D dan sh

                I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

                // Replace all the commas that are between double quotes
                char[] linechars = line.ToCharArray();
                bool isInQuotes = false;

                for (int i = 0; i < linechars.Length; i++)
                {
                if (linechars[i] == '"')//This was predicted by Visual Studio

                This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #9

                The {get; set;} auto-complete is great, and yes, the prediction is 80% amazing and 20% annoying in my experience. And the annoying isn't too annoying.

                dan!sh wrote:

                I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                Well, in my experience, paying attention to code quality, no matter the requirements, always pays off. ;P Converting the string to a char array and then iterating over it with a for loop is a bit like walking away from the pilot seat without setting the auto-pilot. :laugh:

                Latest Article:
                Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

                Greg UtasG 1 Reply Last reply
                0
                • M Marc Clifton

                  The {get; set;} auto-complete is great, and yes, the prediction is 80% amazing and 20% annoying in my experience. And the annoying isn't too annoying.

                  dan!sh wrote:

                  I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                  Well, in my experience, paying attention to code quality, no matter the requirements, always pays off. ;P Converting the string to a char array and then iterating over it with a for loop is a bit like walking away from the pilot seat without setting the auto-pilot. :laugh:

                  Latest Article:
                  Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

                  Greg UtasG Offline
                  Greg UtasG Offline
                  Greg Utas
                  wrote on last edited by
                  #10

                  Perhaps you or someone else can explain this {get; set;} thing to me. There are times when having a getter is appropriate, but far fewer times when having a setter is appropriate. I'm surprised that they make it so easy to mindlessly provide one.

                  Robust Services Core | Software Techniques for Lemmings | Articles
                  The fox knows many things, but the hedgehog knows one big thing.

                  <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                  <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                  M M 2 Replies Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    You might be surprised - it's actually pretty good. I'm not young - 63 - but I'm finding it handy to "fill in the blanks" with the drudge stuff: it works out what they heck you are likely to be trying to do and provides a default text that uses sensible variables you used earlier and suchlike. It does appear to use the variable names to help it decide as well, which is a damn good reason for using sensible names at all times instead of "quick to type" ones ... :-D Give it a try (the Community edition is free so there's not a lot of excuse) - it might surprise you! (It did me.)

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                    C Offline
                    C Offline
                    Calin Negru
                    wrote on last edited by
                    #11

                    nice, soon you will only need to write the first half of your program, the IDE will figure out the other half on his own

                    OriginalGriffO 1 Reply Last reply
                    0
                    • C Calin Negru

                      nice, soon you will only need to write the first half of your program, the IDE will figure out the other half on his own

                      OriginalGriffO Offline
                      OriginalGriffO Offline
                      OriginalGriff
                      wrote on last edited by
                      #12

                      :laugh: It's not quite that good, but if you do something like this:

                      var bananas = Fruit.GetFruits(Color.Yellow);

                      Then later in the method type foreach(it will autofill with this:

                      foreach(var f in bananas)

                      If (as I much prefer) you use an explicit type:

                      List bananas = Fruit.GetFruits(Color.Yellow);

                      Then the autofill is explicit as well:

                      foreach(Fruit fruit in bananas)

                      All on a single TAB press. Once you are used to it, it takes the typing out of the simple stuff, and it leaves you free to concentrate on the "why" you are doing it, instead of the "what".

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                      C 1 Reply Last reply
                      0
                      • OriginalGriffO OriginalGriff

                        You might be surprised - it's actually pretty good. I'm not young - 63 - but I'm finding it handy to "fill in the blanks" with the drudge stuff: it works out what they heck you are likely to be trying to do and provides a default text that uses sensible variables you used earlier and suchlike. It does appear to use the variable names to help it decide as well, which is a damn good reason for using sensible names at all times instead of "quick to type" ones ... :-D Give it a try (the Community edition is free so there's not a lot of excuse) - it might surprise you! (It did me.)

                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                        C Offline
                        C Offline
                        Calin Negru
                        wrote on last edited by
                        #13

                        I this thing does everything for you soon no knowledge of programing will be required to write a program.

                        L OriginalGriffO 2 Replies Last reply
                        0
                        • C Calin Negru

                          I this thing does everything for you soon no knowledge of programing will be required to write a program.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #14

                          There are plenty of people who already think that is true.

                          1 Reply Last reply
                          0
                          • C Calin Negru

                            I this thing does everything for you soon no knowledge of programing will be required to write a program.

                            OriginalGriffO Offline
                            OriginalGriffO Offline
                            OriginalGriff
                            wrote on last edited by
                            #15

                            There are enough people trying to produce code without any knowledge or thought already: check out QA some day ... :sigh:

                            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                            1 Reply Last reply
                            0
                            • D dan sh

                              I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

                              // Replace all the commas that are between double quotes
                              char[] linechars = line.ToCharArray();
                              bool isInQuotes = false;

                              for (int i = 0; i < linechars.Length; i++)
                              {
                              if (linechars[i] == '"')//This was predicted by Visual Studio

                              This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                              "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                              D Offline
                              D Offline
                              dandy72
                              wrote on last edited by
                              #16

                              Now redo another block of code, but change "commas" in your comment to something else...then as you're typing the actual code, see if it picks up what your comment said as you're suggesting...

                              D 1 Reply Last reply
                              0
                              • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                                It is amazing... until it is not... Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

                                “Real stupidity beats artificial intelligence every time.” ― Terry Pratchett, Hogfather

                                D Offline
                                D Offline
                                Dan Neely
                                wrote on last edited by
                                #17

                                Kornfeld Eliyahu Peter wrote:

                                Wait and see - after enough suggestions you will find that most of them are plain stupid repetition of what you done before (a true no-brain op)...

                                I had more obviously wrong suggestions than cases where it generated what I wanted, but that's not why I turned it off after a few weeks. I pulled the plug because about 5-10% of the suggestions were dangerously wrong. Things that looked OK at first glance, but which had subtle logic errors in them. Trying to debug my own wrong think is bad enough, when the code running is ever so slightly off of what I intended was far worse.

                                Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

                                M 1 Reply Last reply
                                0
                                • D dandy72

                                  Now redo another block of code, but change "commas" in your comment to something else...then as you're typing the actual code, see if it picks up what your comment said as you're suggesting...

                                  D Offline
                                  D Offline
                                  dan sh
                                  wrote on last edited by
                                  #18

                                  Yes it does! It does not figure what the new condition should be but it at least does not recommend checking for quote. I love VS. Mostly due to other IDEs I need to use.

                                  "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                                  1 Reply Last reply
                                  0
                                  • D dan sh

                                    I was writing a little bit of code today to replace commas within double quotes enclosed text in a huge string. This string could have multiple segments of double quoted text. I had only written this bit

                                    // Replace all the commas that are between double quotes
                                    char[] linechars = line.ToCharArray();
                                    bool isInQuotes = false;

                                    for (int i = 0; i < linechars.Length; i++)
                                    {
                                    if (linechars[i] == '"')//This was predicted by Visual Studio

                                    This IDE can read my code and comments and predict the next if statement. This is amazing. P.S. Before someone points out miserable string handling, I really do not care about code quality. This is a one time use (quick or slow) and dirty utility.

                                    "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                                    D Offline
                                    D Offline
                                    Daniel Pfeffer
                                    wrote on last edited by
                                    #19

                                    With the possible exception of auto-complete for method names etc., I distrust such suggestions. No IDE, irrespective of how much "AI" it is using, can truly understand my thought processes.

                                    Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                    K 1 Reply Last reply
                                    0
                                    • D Daniel Pfeffer

                                      With the possible exception of auto-complete for method names etc., I distrust such suggestions. No IDE, irrespective of how much "AI" it is using, can truly understand my thought processes.

                                      Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                      K Offline
                                      K Offline
                                      k5054
                                      wrote on last edited by
                                      #20

                                      Is that a reflection of the state of AI, or your thought processes, I wonder.

                                      Keep Calm and Carry On

                                      D 1 Reply Last reply
                                      0
                                      • Greg UtasG Greg Utas

                                        Perhaps you or someone else can explain this {get; set;} thing to me. There are times when having a getter is appropriate, but far fewer times when having a setter is appropriate. I'm surprised that they make it so easy to mindlessly provide one.

                                        Robust Services Core | Software Techniques for Lemmings | Articles
                                        The fox knows many things, but the hedgehog knows one big thing.

                                        M Offline
                                        M Offline
                                        Marc Clifton
                                        wrote on last edited by
                                        #21

                                        Greg Utas wrote:

                                        There are times when having a getter is appropriate, but far fewer times when having a setter is appropriate. I'm surprised that they make it so easy to mindlessly provide one.

                                        Agreed, however in the 99% of the cases that I work with, I'm either serializing/deserializing JSON or working with EF or Linq2SQL, both of which require setters on the model.

                                        Latest Article:
                                        Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

                                        1 Reply Last reply
                                        0
                                        • K k5054

                                          Is that a reflection of the state of AI, or your thought processes, I wonder.

                                          Keep Calm and Carry On

                                          D Offline
                                          D Offline
                                          Daniel Pfeffer
                                          wrote on last edited by
                                          #22

                                          Yes. :|

                                          Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups