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. General Programming
  3. C#
  4. VS20087 AddIn Problem

VS20087 AddIn Problem

Scheduled Pinned Locked Moved C#
csharpvisual-studiohelpquestion
2 Posts 1 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.
  • C Offline
    C Offline
    cecildt
    wrote on last edited by
    #1

    Hi, I busy fixing a Addin for Visual Studio. Basically generating a source file. The class with its methods get generated fine, but when I save the generated source it get additional closing brackets. This line cause additional bracket to be inserted: applicationObject.ActiveDocument().Save(""); Can anyone please tell me why? Regards Full Code: TextSelection testSelection = applicationObject.GetActiveDocument().Selection as TextSelection; if (testSelection != null) { testSelection.SelectAll(); string val = GenerateCode(targetNamespace,targetClass, testClassName); testSelection.Text = val; } applicationObject.GetActiveDocument().Save("");

    C 1 Reply Last reply
    0
    • C cecildt

      Hi, I busy fixing a Addin for Visual Studio. Basically generating a source file. The class with its methods get generated fine, but when I save the generated source it get additional closing brackets. This line cause additional bracket to be inserted: applicationObject.ActiveDocument().Save(""); Can anyone please tell me why? Regards Full Code: TextSelection testSelection = applicationObject.GetActiveDocument().Selection as TextSelection; if (testSelection != null) { testSelection.SelectAll(); string val = GenerateCode(targetNamespace,targetClass, testClassName); testSelection.Text = val; } applicationObject.GetActiveDocument().Save("");

      C Offline
      C Offline
      cecildt
      wrote on last edited by
      #2

      Don't worry, fixed it myself. Was related to TextSelection and Resharper being clever. When assigning TextSelection.Text, Reshaper try to insert the correct matching brackets. The right use for TextSelection is to use the Insert method. testSelection.Insert(val, (int)vsInsertFlags.vsInsertFlagsInsertAtStart);

      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