Almost perfect. Too bad setting a different line color cannot be done once for all the profiles (what do "Default", "Unaligned", "#1", "#2", .. "#30" mean by the way ?)
Best way to do that is to delete the profiles, set it in default, and then recreate the profiles (sorry). Honestly, I wasn't even aware that people were using them :)
#1, #2... are the depths of lines, so if you want the 3rd line to be a different colour or to only be visible when highlighted you can modify #3. "Default" applies to all lines that haven't been set manually, and "Unaligned" is for lines that don't appear at multiples of your Indent Size setting.
Great extension, thanks for taking the time to create it. Is it possible to disable the extension per language? I really only need it for CoffeeScript files, and the only way to found to turn it off for .cs was to first make a CoffeeScript Content Type and to then make all the lines in Default invisible. I just figured there'd be a more elegant way to do that.
Thanks!
I'm afraid not, you've found the most elegant way. You should only have to make the Default line style invisible and the rest will pick up the setting automatically - only lines that are already different to the default will keep their setting, and this is where that "Reset" button becomes useful.
Glad you like it!
I usually try to wrap comments, documentation or partially other code at 100 characters to keep it readable on smaller screens. The 100 is just an even number that I can remember well and 80 seems a bit outdated these days. But I always need to move the cursor and watch the current column number in the status bar to see how long my line space is.
It would be great if the extension could also add an additional line (or maybe multiple?) with customisable style at configurable columns. This line should always be visible, in every line of the document, not only where there's text.
Maybe this could be specific to document types like .cs or .xaml if that's possible and doesn't get too complicated to set up.
That's certainly an idea that I've thought about before, but haven't taken the time to do (the line itself is incredibly easy - the options UI for it is much more involved...).
The VS PowerTools extension has a similar feature, though it does not allow much styling of the lines. That's the one that I use myself at the moment.
VS PowerTools is a bundle of a whole lot of things which I've tried out and eventually dumped again. Most of it is not for me. I've searched the individual extensions and installed a few of them, the Guide extension being one of them. But I don't like that sparsely dotted line and one (actually two, for the UI of it) extensions less would be easier.
So I was working on another bug and I realized that this was easier even than I expected, so I went ahead and did it. There's a new beta at indentguide.codeplex.com that has this feature, so check it out and let me know what you think.
I encountered this today while editing an XML file.
Exception Type: System.AggregateException
Exception Message: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
Exception Stack Trace: at System.Threading.Tasks.TaskExceptionHolder.Finalize()
Inner Exception:
Exception Type: System.InvalidOperationException
Exception Message: The calling thread cannot access this object because a different thread owns it.
Exception Stack Trace: at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Controls.Panel.get_IsItemsHost()
at System.Windows.Controls.Panel.VerifyBoundState()
at System.Windows.Controls.Panel.get_InternalChildren()
at Microsoft.VisualStudio.Text.Editor.Implementation.AdornmentLayer.RemoveTranslatableVisual(AdornmentAndData data)
at Microsoft.VisualStudio.Text.Editor.Implementation.AdornmentLayer.RemoveAllAdornments()
at IndentGuide.IndentGuideView.UpdateAdornments()
at IndentGuide.IndentGuideView.UpdateAdornmentsCallback(Task task)
at System.Threading.Tasks.Task.<>c__DisplayClassb.<ContinueWith>b__a(Object obj)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
I installed the latest Indent Guide (12.1) on top of VS 2012 Ultimate RTM. I get the following error on launch of VS as recorded in ActivityLog.xml:
<entry>
<record>572</record>
<time>2013/01/02 18:23:17.890</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.NullReferenceException: Object reference not set to an instance of an object.
 at q.TextViewCreated(IWpfTextView textView)
 at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.<>c__DisplayClassc.<BindContentTypeSpecificAssets>b__9()
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)</description>
</entry>
Is this a known issue?
Thanks.
Sorry for the delayed response - your question came in at a time when email notifications weren't being sent.
The bit of the stack trace you have there doesn't seem to include my extension, but that does look like the point where I hook into the text view. There's a newer version at http://indentguide.codeplex.com/ that may have fixed this, but I don't recall specifically addressing the issue (I don't spend much time coding outside of work any more).
hi
Would you like to add an function to avoid broken highlight when encounter preprocessor def.?
something like this:
int i;
|
while(1){
|
|
| int x;
| |
#ifndef XXX //<---highlight been broken here
|
|
thanks in advance.
Thanks! I wasn't entirely happy about the highlight not continuing through preprocessor commands, but there's quite a bit of work needed to make it happen (and it's probably all language specific, which I've been trying really hard to avoid).
I've added an issue for this, and since I don't really have much else to work on for this it should be in v13 (though I don't have a planned release date yet).
There's an improved release over on http://indentguide.codeplex.com/ for Visual Studio 2012. I will upload it here if/when I can provide different downloads for each version.
Hi,
This is a great control and have used it for a while, when I moved to VS 11 Beta I was pleased to see that this tool was supported and worked well. I upgraded to V12 of indent guides this morning and nothing no guides at all tried both light and dark theme, un-installed it, reinstalled several times with and without admin permissions. Anybody else experienced this behaviour?
I have tried to go back to V11 from CodePlex but no joy this now no longer works either.
Thanks. It looks like the View Indent Guides menu item (inside Edit->Advanced when you've got an editor open) is deselecting when some people upgrade from an earlier version, so you may be able to use that menu to bring them back.
Otherwise, a settings reset should fix all issues (though it will lose colours, but if you need to get it working...): delete HKCU\Software\Microsoft\VisualStudio\10.0\IndentGuide or ...\11.0\IndentGuide while VS is closed.
The VisualStudio 2010 ActivityLog.xml provided the following information:
VS Version: 10.0.40219.1
System.InvalidOperationException: The current SynchronizationContext may not be used as a TaskScheduler.
at System.Threading.Tasks.SynchronizationContextTaskScheduler..ctor()
at IndentGuide.DocumentAnalyzer.Reset()
at IndentGuide.IndentGuideView.UpdateAdornments()
at IndentGuide.IndentGuideView.UpdateAdornments(Task task)
at IndentGuide.IndentGuideView.View_LayoutChanged(Object sender, TextViewLayoutChangedEventArgs e)
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)
I've fixed this issue and pushed the update to everyone. Now if we can't run the document analysis asynchronously, the exception is caught and the analysis is synchronous.
Ok, it is now working, I un-installed it, and downloaded & installed from here, but now all the indent lines are the same black colour rather than different colours as before.
Thanks guys. It looks like the View Indent Guides menu item (inside Edit->Advanced when you've got an editor open) is deselecting when some people upgrade from an earlier version.
Otherwise, a settings reset should fix all issues (though it will lose colours, but if you need to get it working...): delete HKCU\Software\Microsoft\VisualStudio\10.0\IndentGuide while VS is closed.
Very nice. Thanks!
One thought; I did notice unexpected behavior regarding which indent is designated as current and therefore highlighted;
if my editor caret is adjacent to, and to the right of, one of the brackets that defines a block, the highlight is applied to the indentation that is hierarchically 'higher' i.e. one extra tab/column to the left.
I realize that could be by design, but an option to adjust might be nice. Some other editors do work this way.
I did also notice if the caret is in any blank line following an open bracket with no coded lines between, or if I am in a block that has only one coded line the same thing happens. Its not much of an issue, neither condition is common.
Wish I could insert an image here but I think this will do;
COLUMNS > 1 2 3
if (someCondition)
{
foreach (int i in someCollectionOfInts)
{ <-- If my caret is here it highlights column 1 instead of
column 2. An option to change that would be nice.
// There is no place you can put the caret within this
// next block that will highlight column 3.
if (someOtherCondition)
{
doSomethingCool();
}
} <-- If my caret is here it highlights column 1 instead of
column 2. An option to change that would be nice.
}
So what's happening here is that the guideline will only be highlighted if it's been drawn on the line of text with the caret (excluding when "Visible at text" is on). I may be able to handle "guessing" when to highlight a guideline from an adjacent line, but there's no code analysis going on at all (only the leading whitespace is ever used) and I intend to keep it that way.
I suspect that there may be too many cases that can't be handled. For example, if you put the caret before the first "//", should it highlight column 2 (the entire foreach block) or column 3 (from the foreach to the comment)?
I've created an issue at the CodePlex site (http://indentguide.codeplex.com/workitem/33), so when I have a chance I'll try a few things out.