Code view is cut from Whidbey HTML Editor

Those of you at TechEd as well as any other who already received May 2004 Community Preview of Whidbey may have noticed that Code view is gone from the Web Form editor. What happened? Well, we encontered quite a few problems implementing Code view. If you recall, the view was used to hide indent at the left, so

        <script runat=“server“>
              Sub Foo
              End Sub

appeared in Code view as

Sub Foo
End Sub

i.e. indent inherited from <script> block would be hidden. Unfortunately, current VS IDE architecture does not have ability to arbitrarily position view window over the underlying text buffer. IDE has concept of hidden text that is used in code outlining and we did try to hide characters but in case of mixed indent (i.e. part spaces part tabs) things quickly get of control and then implementation becomes too complex. We tried to physically remove indentation effectively producing separate text buffer (Alpha release of Whidbey contained this implementation), but VS debugger as well as IDE were not able to associate two physically separate text buffers with the same document so breakpoints and bookmarks didn't work. We would have to duplicate everything in two documents in order to make it work, but debugger would be hitting breakpoints in only one of the documents. In addition separate code view didn't make much sense for render block and inline expressions.

So decision was made to remove the view so if you are working in the code-inline model, you will have to edit code in the Source (HTML) view. If you have a lot of code and want to see it separately from the markup, you probably should be using code separation model (code beside).

I have mixed feeling about this since I have spent considerate amount of my time on the feature. Oh well...

Comments (5)

  1. Frans Bouma says:

    What is the factor that makes removal of indentation complex? I mean: the lines in the view window correspond with lines in the HTML editor, they just don’t have html tags and prefix strings on a line…

    I also don’t see why a read-only buffer for the code view wouldn’t work, as hte lines in the codeview correspond with lines in the html, so setting a breakpoint in the codeview, will then result in a breakpoint on the corresponding line in the main editor.

    Or do I miss something?

  2. Stefán Jökull Sigurðarson says:

    I really hate to see this feature cut. I was looking forward to using this to cut down the number of files in my project considerably (i know i can still do that.. this just makes it so much cleaner while editing). Since i mainly create a separate class library for all the business logic in my apps there usually isn’t much logic in the code-behind files except for minor input checking, output formatting etc..

    Is there any chance of this not being completely cut out?

  3. Paul Wilson says:

    What’s going to be the next thing cut?

  4. I feel your pain, it is not easy to see something that you’ve spent so much time and effort on being cut …

    On the other hand, I say good riddance. This feature would only encourage mixing server-side code with client-side code, which I think is evil anyway 🙂

  5. Mikhail Arkhipov (MSFT) says:

    To Frans: spec called for indent to be hidden. It is indeed easy to hide the markup. Actually, VS 2003/2003 had that feature called ‘script only view’. However, if we just hide the markup server code will look a bit odd with that huge indent at the left.

    Also, hiding text apparently caused troubles in other areas of VS. For instance, text outlining (as in Edit | Advanced | Hide selection) also hides text. When hidden regions overlap bad things happen. Word wrapping code also didn’t like us much. Architectually this should be solve, IMHO, by implementing movable view which we would simply reposition instead of doing all this acrobatics with hidden regions.

Skip to main content