├── art
└── adornment.png
├── src
├── Resources
│ ├── icon.png
│ └── preview.png
├── source.extension.ico
├── packages.config
├── Properties
│ └── AssemblyInfo.cs
├── source.extension.cs
├── source.extension.vsixmanifest
├── ErrorHighlighterFactory.cs
├── Adornment.cs
├── ErrorHighlighter.cs
├── source.extension.resx
└── ErrorHighlighter.csproj
├── .github
├── ISSUE_TEMPLATE.md
└── CONTRIBUTING.md
├── .gitattributes
├── LICENSE
├── appveyor.yml
├── README.md
├── ErrorHighlighter.sln
└── .gitignore
/art/adornment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/ErrorHighlighter/master/art/adornment.png
--------------------------------------------------------------------------------
/src/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/ErrorHighlighter/master/src/Resources/icon.png
--------------------------------------------------------------------------------
/src/source.extension.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/ErrorHighlighter/master/src/source.extension.ico
--------------------------------------------------------------------------------
/src/Resources/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/madskristensen/ErrorHighlighter/master/src/Resources/preview.png
--------------------------------------------------------------------------------
/src/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Installed product versions
2 | - Visual Studio: [example 2015 Professional]
3 | - This extension: [example 1.1.21]
4 |
5 | ### Description
6 | Replace this text with a short description
7 |
8 | ### Steps to recreate
9 | 1. Replace this
10 | 2. text with
11 | 3. the steps
12 | 4. to recreate
13 |
14 | ### Current behavior
15 | Explain what it's doing and why it's wrong
16 |
17 | ### Expected behavior
18 | Explain what it should be doing after it's fixed.
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2015 Mads Kristensen
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using ErrorHighlighter;
4 |
5 | [assembly: AssemblyTitle(Vsix.Name)]
6 | [assembly: AssemblyDescription(Vsix.Description)]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany(Vsix.Author)]
9 | [assembly: AssemblyProduct(Vsix.Name)]
10 | [assembly: AssemblyCopyright(Vsix.Author)]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: AssemblyVersion(Vsix.Version)]
16 | [assembly: AssemblyFileVersion(Vsix.Version)]
17 |
--------------------------------------------------------------------------------
/src/source.extension.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This file was generated by Extensibility Tools v1.10.188
4 | //
5 | // ------------------------------------------------------------------------------
6 | namespace ErrorHighlighter
7 | {
8 | static class Vsix
9 | {
10 | public const string Id = "0798393f-f7b0-4283-a36e-c57a73f031c4";
11 | public const string Name = "Error Catcher";
12 | public const string Description = @"The easiest way to make sure not to miss any errors or warnings in any code file.";
13 | public const string Language = "en-US";
14 | public const string Version = "2.0";
15 | public const string Author = "Mads Kristensen";
16 | public const string Tags = "error, exception";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | image: Visual Studio 2015
2 |
3 | install:
4 | - ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex
5 |
6 | before_build:
7 | - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion
8 | - ps: Vsix-TokenReplacement src\source.extension.cs 'Version = "([0-9\\.]+)"' 'Version = "{version}"'
9 |
10 | build_script:
11 | - nuget restore -Verbosity quiet
12 | - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
13 |
14 | after_test:
15 | - ps: Vsix-PushArtifacts | Vsix-PublishToGallery
16 |
17 | before_deploy:
18 | - ps: Vsix-CreateChocolatyPackage -packageId errorcatcher
19 |
20 | deploy:
21 | - provider: Environment
22 | name: Chocolatey
23 | on:
24 | branch: master
25 | appveyor_repo_commit_message_extended: /\[release\]/
--------------------------------------------------------------------------------
/src/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Error Catcher
6 | The easiest way to make sure not to miss any errors or warnings in any code file.
7 | https://github.com/madskristensen/ErrorHighlighter/
8 | Resources\LICENSE
9 | Resources\icon.png
10 | Resources\preview.png
11 | error, exception
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Error Watcher
2 | ================
3 |
4 | [](https://ci.appveyor.com/project/madskristensen/errorhighlighter)
5 |
6 | This is the home of the Visual Studio extension "Error Watcher".
7 |
8 | Download from the [VS Gallery](http://visualstudiogallery.msdn.microsoft.com/a85f155f-b519-44a8-b56b-07611cf78393)
9 | or get the [nightly build](http://vsixgallery.com/extension/0798393f-f7b0-4283-a36e-c57a73f031c4/).
10 |
11 | **Note**: For a version that works in VS 2015 and newer, get the [Error Catcher II](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ErrorCatcherII)
12 |
13 | Sometimes it can be hard to tell if the file you're editing
14 | contains errors. Perhaps the error is all the way to the bottom
15 | of the file and you don't notice it. You might save the file
16 | containing the error and something bad happens when you then
17 | try to run your application.
18 |
19 | 
20 |
21 | Here's how it works:
22 |
23 | 1. Displays errors at the top right corner of the editor
24 | 2. Displays both the number of Errors, Warnings and Messages
25 | 3. Flashes quickly if the file contains Errors when you save the file
26 | 4. Click on the in-editor error list to open the Visual Studio Error List
27 |
--------------------------------------------------------------------------------
/ErrorHighlighter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErrorHighlighter", "src\ErrorHighlighter.csproj", "{7DF9D311-F64F-431E-BE02-427B17FFB749}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DBDA5483-6B28-4EB2-BE9F-8CFC0B97B1FA}"
9 | ProjectSection(SolutionItems) = preProject
10 | appveyor.yml = appveyor.yml
11 | README.md = README.md
12 | EndProjectSection
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {7DF9D311-F64F-431E-BE02-427B17FFB749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {7DF9D311-F64F-431E-BE02-427B17FFB749}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {7DF9D311-F64F-431E-BE02-427B17FFB749}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {7DF9D311-F64F-431E-BE02-427B17FFB749}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/src/ErrorHighlighterFactory.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Shell;
2 | using Microsoft.VisualStudio.Shell.Interop;
3 | using Microsoft.VisualStudio.Text;
4 | using Microsoft.VisualStudio.Text.Editor;
5 | using Microsoft.VisualStudio.Utilities;
6 | using System.ComponentModel.Composition;
7 |
8 | namespace ErrorHighlighter
9 | {
10 | [Export(typeof(IWpfTextViewCreationListener))]
11 | [ContentType("code")]
12 | [TextViewRole(PredefinedTextViewRoles.Interactive)]
13 | internal sealed class ErrorHighlighterFactory : IWpfTextViewCreationListener
14 | {
15 | public const string LayerName = "ErrorHighlighter";
16 | [Import]
17 | public SVsServiceProvider serviceProvider { get; set; }
18 |
19 | [Import]
20 | public ITextDocumentFactoryService TextDocumentFactoryService { get; set; }
21 |
22 | [Export(typeof(AdornmentLayerDefinition))]
23 | [Name(LayerName)]
24 | [Order(After = PredefinedAdornmentLayers.Caret)]
25 | public AdornmentLayerDefinition editorAdornmentLayer = null;
26 |
27 | public void TextViewCreated(IWpfTextView textView)
28 | {
29 | IVsTaskList tasks = serviceProvider.GetService(typeof(SVsErrorList)) as IVsTaskList;
30 |
31 | ITextDocument document;
32 | if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
33 | {
34 | var highlighter = new ErrorHighlighter(textView, document, tasks, serviceProvider);
35 |
36 | // On file save
37 | document.FileActionOccurred += (s, e) =>
38 | {
39 | if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
40 | highlighter.Update(true);
41 | };
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Adornment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 | using System.Windows.Media;
7 | using System.Windows.Threading;
8 |
9 | namespace ErrorHighlighter
10 | {
11 | class Adornment : Border
12 | {
13 | private TextBlock _errors = CreateBlocks(Colors.Red);
14 | private TextBlock _warnings = CreateBlocks(Colors.DarkOrange);
15 | private TextBlock _messages = CreateBlocks(Colors.CornflowerBlue);
16 | private StackPanel _panel = new StackPanel();
17 |
18 | public Adornment()
19 | {
20 | BorderThickness = new Thickness(0, 0, 0, 2);
21 | Padding = new Thickness(0, 0, 0, 3);
22 | Child = _panel;
23 |
24 | _panel.Children.Add(_errors);
25 | _panel.Children.Add(_warnings);
26 | _panel.Children.Add(_messages);
27 |
28 | Cursor = Cursors.Hand;
29 | ToolTip = "Click to open the Error List";
30 | }
31 |
32 | public void SetValues(int errors, int warnings, int messages)
33 | {
34 | if (errors > 0 || warnings > 0 || messages > 0)
35 | {
36 | SetValue(_errors, errors, "error", "errors");
37 | SetValue(_warnings, warnings, "warning", "warnings");
38 | SetValue(_messages, messages, "message", "messages");
39 | Visibility = Visibility.Visible;
40 | }
41 | else
42 | {
43 | Visibility = Visibility.Collapsed;
44 | }
45 | }
46 |
47 | private void SetValue(TextBlock block, int count, string singular, string plural)
48 | {
49 | block.Visibility = count == 0 ? Visibility.Collapsed : Visibility.Visible;
50 |
51 | if (count > 0)
52 | {
53 | string text = count == 1 ? singular : plural;
54 | block.Text = count.ToString().PadLeft(3, ' ') + " " + text + " ";
55 | }
56 | }
57 |
58 | private static TextBlock CreateBlocks(Color color)
59 | {
60 | return new TextBlock
61 | {
62 | FontSize = 16,
63 | Foreground = new SolidColorBrush(color),
64 | FontWeight = FontWeights.Bold,
65 | TextAlignment = TextAlignment.Left,
66 | FontFamily = new FontFamily("Consolas"),
67 | };
68 | }
69 |
70 | public async Task Highlight()
71 | {
72 | await Dispatcher.CurrentDispatcher.BeginInvoke(new Action(async () =>
73 | {
74 | if (Visibility == System.Windows.Visibility.Visible)
75 | {
76 | BorderBrush = new SolidColorBrush(Colors.Red);
77 | BorderBrush.Opacity = .5;
78 | await Task.Delay(500);
79 | BorderBrush = null;
80 | }
81 |
82 | }), DispatcherPriority.ApplicationIdle, null);
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 | .vs
9 |
10 | # Build results
11 | [Dd]ebug/
12 | [Dd]ebugPublic/
13 | [Rr]elease/
14 | x64/
15 | build/
16 | bld/
17 | [Bb]in/
18 | [Oo]bj/
19 |
20 | # MSTest test Results
21 | [Tt]est[Rr]esult*/
22 | [Bb]uild[Ll]og.*
23 |
24 | #NUNIT
25 | *.VisualState.xml
26 | TestResult.xml
27 |
28 | # Build Results of an ATL Project
29 | [Dd]ebugPS/
30 | [Rr]eleasePS/
31 | dlldata.c
32 |
33 | *_i.c
34 | *_p.c
35 | *_i.h
36 | *.ilk
37 | *.meta
38 | *.obj
39 | *.pch
40 | *.pdb
41 | *.pgc
42 | *.pgd
43 | *.rsp
44 | *.sbr
45 | *.tlb
46 | *.tli
47 | *.tlh
48 | *.tmp
49 | *.tmp_proj
50 | *.log
51 | *.vspscc
52 | *.vssscc
53 | .builds
54 | *.pidb
55 | *.svclog
56 | *.scc
57 |
58 | # Chutzpah Test files
59 | _Chutzpah*
60 |
61 | # Visual C++ cache files
62 | ipch/
63 | *.aps
64 | *.ncb
65 | *.opensdf
66 | *.sdf
67 | *.cachefile
68 |
69 | # Visual Studio profiler
70 | *.psess
71 | *.vsp
72 | *.vspx
73 |
74 | # TFS 2012 Local Workspace
75 | $tf/
76 |
77 | # Guidance Automation Toolkit
78 | *.gpState
79 |
80 | # ReSharper is a .NET coding add-in
81 | _ReSharper*/
82 | *.[Rr]e[Ss]harper
83 | *.DotSettings.user
84 |
85 | # JustCode is a .NET coding addin-in
86 | .JustCode
87 |
88 | # TeamCity is a build add-in
89 | _TeamCity*
90 |
91 | # DotCover is a Code Coverage Tool
92 | *.dotCover
93 |
94 | # NCrunch
95 | *.ncrunch*
96 | _NCrunch_*
97 | .*crunch*.local.xml
98 |
99 | # MightyMoose
100 | *.mm.*
101 | AutoTest.Net/
102 |
103 | # Web workbench (sass)
104 | .sass-cache/
105 |
106 | # Installshield output folder
107 | [Ee]xpress/
108 |
109 | # DocProject is a documentation generator add-in
110 | DocProject/buildhelp/
111 | DocProject/Help/*.HxT
112 | DocProject/Help/*.HxC
113 | DocProject/Help/*.hhc
114 | DocProject/Help/*.hhk
115 | DocProject/Help/*.hhp
116 | DocProject/Help/Html2
117 | DocProject/Help/html
118 |
119 | # Click-Once directory
120 | publish/
121 |
122 | # Publish Web Output
123 | *.[Pp]ublish.xml
124 | *.azurePubxml
125 |
126 | # NuGet Packages Directory
127 | packages/
128 | ## TODO: If the tool you use requires repositories.config uncomment the next line
129 | #!packages/repositories.config
130 |
131 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
132 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented)
133 | !packages/build/
134 |
135 | # Windows Azure Build Output
136 | csx/
137 | *.build.csdef
138 |
139 | # Windows Store app package directory
140 | AppPackages/
141 |
142 | # Others
143 | sql/
144 | *.Cache
145 | ClientBin/
146 | [Ss]tyle[Cc]op.*
147 | ~$*
148 | *~
149 | *.dbmdl
150 | *.dbproj.schemaview
151 | *.pfx
152 | *.publishsettings
153 | node_modules/
154 |
155 | # RIA/Silverlight projects
156 | Generated_Code/
157 |
158 | # Backup & report files from converting an old project file to a newer
159 | # Visual Studio version. Backup files are not needed, because we have git ;-)
160 | _UpgradeReport_Files/
161 | Backup*/
162 | UpgradeLog*.XML
163 | UpgradeLog*.htm
164 |
165 | # SQL Server files
166 | *.mdf
167 | *.ldf
168 |
169 | # Business Intelligence projects
170 | *.rdl.data
171 | *.bim.layout
172 | *.bim_*.settings
173 |
174 | # Microsoft Fakes
175 | FakesAssemblies/
176 |
177 | # =========================
178 | # Operating System Files
179 | # =========================
180 |
181 | # OSX
182 | # =========================
183 |
184 | .DS_Store
185 | .AppleDouble
186 | .LSOverride
187 |
188 | # Icon must ends with two \r.
189 | Icon
190 |
191 | # Thumbnails
192 | ._*
193 |
194 | # Files that might appear on external disk
195 | .Spotlight-V100
196 | .Trashes
197 |
198 | # Windows
199 | # =========================
200 |
201 | # Windows image file caches
202 | Thumbs.db
203 | ehthumbs.db
204 |
205 | # Folder config file
206 | Desktop.ini
207 |
208 | # Recycle Bin used on file shares
209 | $RECYCLE.BIN/
210 |
211 | # Windows Installer files
212 | *.cab
213 | *.msi
214 | *.msm
215 | *.msp
216 |
--------------------------------------------------------------------------------
/src/ErrorHighlighter.cs:
--------------------------------------------------------------------------------
1 | using EnvDTE;
2 | using Microsoft.VisualStudio;
3 | using Microsoft.VisualStudio.Shell.Interop;
4 | using Microsoft.VisualStudio.Text;
5 | using Microsoft.VisualStudio.Text.Editor;
6 | using System;
7 | using System.Threading.Tasks;
8 | using System.Threading.Tasks.Dataflow;
9 | using System.Timers;
10 | using System.Windows.Controls;
11 | using System.Windows.Threading;
12 | using SVsServiceProvider = Microsoft.VisualStudio.Shell.SVsServiceProvider;
13 |
14 | namespace ErrorHighlighter
15 | {
16 | class ErrorHighlighter
17 | {
18 | private Adornment _text;
19 | private IWpfTextView _view;
20 | private IAdornmentLayer _adornmentLayer;
21 | private ITextDocument _document;
22 | private IVsTaskList _tasks;
23 | private Dispatcher _dispatcher;
24 | private bool _processing;
25 | private Timer _timer;
26 | private SVsServiceProvider _serviceProvider;
27 |
28 | public ErrorHighlighter(IWpfTextView view, ITextDocument document, IVsTaskList tasks, SVsServiceProvider serviceProvider)
29 | {
30 | _view = view;
31 | _document = document;
32 | _text = new Adornment();
33 | _tasks = tasks;
34 | _serviceProvider = serviceProvider;
35 | _dispatcher = Dispatcher.CurrentDispatcher;
36 |
37 | _adornmentLayer = view.GetAdornmentLayer(ErrorHighlighterFactory.LayerName);
38 |
39 | _view.ViewportHeightChanged += SetAdornmentLocation;
40 | _view.ViewportWidthChanged += SetAdornmentLocation;
41 |
42 | var dte = (DTE)serviceProvider.GetService(typeof(DTE));
43 |
44 | _text.MouseUp += (s, e) => { dte.ExecuteCommand("View.ErrorList"); };
45 |
46 | _timer = new Timer(750);
47 | _timer.Elapsed += (s, e) =>
48 | {
49 | _timer.Stop();
50 | System.Threading.Tasks.Task.Run(() =>
51 | {
52 | _dispatcher.Invoke(new Action(() =>
53 | {
54 | Update(false);
55 | }), DispatcherPriority.ApplicationIdle, null);
56 | });
57 | };
58 | _timer.Start();
59 | }
60 |
61 | void SetAdornmentLocation(object sender, EventArgs e)
62 | {
63 | Canvas.SetLeft(_text, _view.ViewportRight - 130);
64 | Canvas.SetTop(_text, _view.ViewportTop + 20);
65 | }
66 |
67 | public void Update(bool highlight)
68 | {
69 | if (!highlight && _processing)
70 | return;
71 |
72 | _processing = true;
73 |
74 | UpdateAdornment(highlight);
75 |
76 | if (_adornmentLayer.IsEmpty)
77 | _adornmentLayer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, null, null, _text, null);
78 |
79 | _processing = false;
80 | _timer.Start();
81 | }
82 |
83 | private async void UpdateAdornment(bool highlight)
84 | {
85 | IVsEnumTaskItems itemsEnum;
86 | _tasks.EnumTaskItems(out itemsEnum);
87 |
88 | IVsTaskItem[] rgelt = new IVsTaskItem[short.MaxValue];
89 | uint[] pceltFetched = new uint[1];
90 | int result;
91 | BufferBlock items = new BufferBlock();
92 | Task task = Task.Factory.StartNew(ProcessItems, items).Unwrap();
93 | do
94 | {
95 | result = itemsEnum.Next((uint)rgelt.Length, rgelt, pceltFetched);
96 | for (int i = 0; i < pceltFetched[0]; i++)
97 | {
98 | await items.SendAsync(rgelt[i]);
99 | }
100 | if (result == VSConstants.S_OK)
101 | {
102 | await Task.Delay(100).ConfigureAwait(true);
103 | }
104 | } while (result == VSConstants.S_OK);
105 | items.Complete();
106 | TaskListCount taskListCount = await task.ConfigureAwait(true);
107 |
108 | _text.SetValues(taskListCount.Errors, taskListCount.Warnings, taskListCount.Messages);
109 |
110 | if (highlight)
111 | await _text.Highlight();
112 | }
113 |
114 | private struct TaskListCount
115 | {
116 | public int Errors
117 | {
118 | get;
119 | }
120 |
121 | public int Warnings
122 | {
123 | get;
124 | }
125 |
126 | public int Messages
127 | {
128 | get;
129 | }
130 |
131 | public TaskListCount(int errors, int warnings, int messages)
132 | {
133 | Errors = errors;
134 | Warnings = warnings;
135 | Messages = messages;
136 | }
137 | }
138 |
139 | private string GetDocumentFilePath() => _document.FilePath;
140 |
141 | private class ErrorCategoryClosure
142 | {
143 | private readonly Dispatcher dispatcher;
144 | private readonly Func getCategoryInner;
145 |
146 | public ErrorCategoryClosure(Dispatcher dispatcher)
147 | {
148 | this.dispatcher = dispatcher;
149 | getCategoryInner = new Func(GetCategoryInner);
150 | }
151 |
152 | public IVsErrorItem ErrorItem
153 | {
154 | get;
155 | set;
156 | }
157 |
158 | public async System.Threading.Tasks.Task<__VSERRORCATEGORY> GetCategory()
159 | {
160 | return (__VSERRORCATEGORY)await dispatcher.InvokeAsync(getCategoryInner, DispatcherPriority.ApplicationIdle);
161 | }
162 |
163 | private uint GetCategoryInner()
164 | {
165 | uint category;
166 | ErrorItem.GetCategory(out category);
167 | return category;
168 | }
169 | }
170 |
171 | private async Task ProcessItems(object state)
172 | {
173 | BufferBlock items = (BufferBlock)state;
174 | int localErrors = 0;
175 | int localWarnings = 0;
176 | int localMessages = 0;
177 | string documentFilePath = await _dispatcher.InvokeAsync(GetDocumentFilePath, DispatcherPriority.ApplicationIdle);
178 | ErrorCategoryClosure errorCategoryClosure = new ErrorCategoryClosure(_dispatcher);
179 | while (!items.Completion.IsCompleted && items.Count > 0)
180 | {
181 | IVsTaskItem item = await items.ReceiveAsync();
182 | string file;
183 | item.Document(out file);
184 | if (string.IsNullOrEmpty(file) || !string.Equals(file, documentFilePath, StringComparison.OrdinalIgnoreCase))
185 | {
186 | continue;
187 | }
188 |
189 | IVsErrorItem errorItem = item as IVsErrorItem;
190 | errorCategoryClosure.ErrorItem = errorItem;
191 | __VSERRORCATEGORY errorCategory = await errorCategoryClosure.GetCategory();
192 | switch (errorCategory)
193 | {
194 | case __VSERRORCATEGORY.EC_ERROR:
195 | localErrors++;
196 | break;
197 | case __VSERRORCATEGORY.EC_WARNING:
198 | localWarnings++;
199 | break;
200 | case __VSERRORCATEGORY.EC_MESSAGE:
201 | localMessages++;
202 | break;
203 | }
204 | }
205 | return new TaskListCount(localErrors, localWarnings, localMessages);
206 | }
207 |
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Looking to contribute something? **Here's how you can help.**
4 |
5 | Please take a moment to review this document in order to make the contribution
6 | process easy and effective for everyone involved.
7 |
8 | Following these guidelines helps to communicate that you respect the time of
9 | the developers managing and developing this open source project. In return,
10 | they should reciprocate that respect in addressing your issue or assessing
11 | patches and features.
12 |
13 |
14 | ## Using the issue tracker
15 |
16 | The issue tracker is the preferred channel for [bug reports](#bug-reports),
17 | [features requests](#feature-requests) and
18 | [submitting pull requests](#pull-requests), but please respect the
19 | following restrictions:
20 |
21 | * Please **do not** use the issue tracker for personal support requests. Stack
22 | Overflow is a better place to get help.
23 |
24 | * Please **do not** derail or troll issues. Keep the discussion on topic and
25 | respect the opinions of others.
26 |
27 | * Please **do not** open issues or pull requests which *belongs to* third party
28 | components.
29 |
30 |
31 | ## Bug reports
32 |
33 | A bug is a _demonstrable problem_ that is caused by the code in the repository.
34 | Good bug reports are extremely helpful, so thanks!
35 |
36 | Guidelines for bug reports:
37 |
38 | 1. **Use the GitHub issue search** — check if the issue has already been
39 | reported.
40 |
41 | 2. **Check if the issue has been fixed** — try to reproduce it using the
42 | latest `master` or development branch in the repository.
43 |
44 | 3. **Isolate the problem** — ideally create an
45 | [SSCCE](http://www.sscce.org/) and a live example.
46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.)
47 | or creating a sample GitHub repository is also helpful.
48 |
49 |
50 | A good bug report shouldn't leave others needing to chase you up for more
51 | information. Please try to be as detailed as possible in your report. What is
52 | your environment? What steps will reproduce the issue? What browser(s) and OS
53 | experience the problem? Do other browsers show the bug differently? What
54 | would you expect to be the outcome? All these details will help people to fix
55 | any potential bugs.
56 |
57 | Example:
58 |
59 | > Short and descriptive example bug report title
60 | >
61 | > A summary of the issue and the Visual Studio, browser, OS environments
62 | > in which it occurs. If suitable, include the steps required to reproduce the bug.
63 | >
64 | > 1. This is the first step
65 | > 2. This is the second step
66 | > 3. Further steps, etc.
67 | >
68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium.
69 | >
70 | > Any other information you want to share that is relevant to the issue being
71 | > reported. This might include the lines of code that you have identified as
72 | > causing the bug, and potential solutions (and your opinions on their
73 | > merits).
74 |
75 |
76 | ## Feature requests
77 |
78 | Feature requests are welcome. But take a moment to find out whether your idea
79 | fits with the scope and aims of the project. It's up to *you* to make a strong
80 | case to convince the project's developers of the merits of this feature. Please
81 | provide as much detail and context as possible.
82 |
83 |
84 | ## Pull requests
85 |
86 | Good pull requests, patches, improvements and new features are a fantastic
87 | help. They should remain focused in scope and avoid containing unrelated
88 | commits.
89 |
90 | **Please ask first** before embarking on any significant pull request (e.g.
91 | implementing features, refactoring code, porting to a different language),
92 | otherwise you risk spending a lot of time working on something that the
93 | project's developers might not want to merge into the project.
94 |
95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the
96 | project (indentation, accurate comments, etc.) and any other requirements
97 | (such as test coverage).
98 |
99 | Adhering to the following process is the best way to get your work
100 | included in the project:
101 |
102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
103 | and configure the remotes:
104 |
105 | ```bash
106 | # Clone your fork of the repo into the current directory
107 | git clone https://github.com//.git
108 | # Navigate to the newly cloned directory
109 | cd
110 | # Assign the original repo to a remote called "upstream"
111 | git remote add upstream https://github.com/madskristensen/.git
112 | ```
113 |
114 | 2. If you cloned a while ago, get the latest changes from upstream:
115 |
116 | ```bash
117 | git checkout master
118 | git pull upstream master
119 | ```
120 |
121 | 3. Create a new topic branch (off the main project development branch) to
122 | contain your feature, change, or fix:
123 |
124 | ```bash
125 | git checkout -b
126 | ```
127 |
128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit
129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
130 | or your code is unlikely be merged into the main project. Use Git's
131 | [interactive rebase](https://help.github.com/articles/interactive-rebase)
132 | feature to tidy up your commits before making them public. Also, prepend name of the feature
133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`"
134 |
135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch:
136 |
137 | ```bash
138 | git pull [--rebase] upstream master
139 | ```
140 |
141 | 6. Push your topic branch up to your fork:
142 |
143 | ```bash
144 | git push origin
145 | ```
146 |
147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
148 | with a clear title and description against the `master` branch.
149 |
150 |
151 | ## Code guidelines
152 |
153 | - Always use proper indentation.
154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure
155 | `Place 'System' directives first when sorting usings` option is enabled (checked).
156 | - Before committing, organize usings for each updated C# source file. Either you can
157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension
158 | like [BatchFormat](http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e).
159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines
160 | to fix CA issues. Code Analysis commits can be made separately.
161 |
--------------------------------------------------------------------------------
/src/source.extension.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Error Catcher
122 |
123 |
124 | The easiest way to make sure not to miss any errors or warnings in any code file.
125 |
126 |
127 |
128 | source.extension.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
--------------------------------------------------------------------------------
/src/ErrorHighlighter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(VisualStudioVersion)
6 | 12.0
7 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
8 | Program
9 | $(DevEnvDir)\devenv.exe
10 | /rootsuffix Exp
11 | true
12 | Normal
13 | v3
14 |
15 |
16 |
17 |
18 |
19 | Debug
20 | AnyCPU
21 | 10.0.20305
22 | 2.0
23 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
24 | {7DF9D311-F64F-431E-BE02-427B17FFB749}
25 | Library
26 | Properties
27 | ErrorHighlighter
28 | ErrorHighlighter
29 | v4.5
30 | 512
31 | false
32 |
33 |
34 | true
35 | full
36 | false
37 | bin\Debug\
38 | DEBUG;TRACE
39 | prompt
40 | 4
41 |
42 |
43 | pdbonly
44 | true
45 | bin\Release\
46 | TRACE
47 | prompt
48 | 4
49 |
50 |
51 |
52 | True
53 |
54 |
55 | True
56 |
57 |
58 | True
59 |
60 |
61 | True
62 |
63 |
64 |
65 | False
66 |
67 |
68 |
69 |
70 |
71 | False
72 |
73 |
74 | False
75 |
76 |
77 | False
78 |
79 |
80 | False
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | ..\packages\Microsoft.Tpl.Dataflow.4.5.24\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll
90 | True
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | source.extension.vsixmanifest
102 |
103 |
104 |
105 |
106 | Resources\LICENSE
107 | true
108 |
109 |
110 | source.extension.vsixmanifest
111 |
112 |
113 |
114 | Designer
115 | VsixManifestGenerator
116 | source.extension.resx
117 |
118 |
119 |
120 |
121 | true
122 |
123 |
124 | true
125 |
126 |
127 |
128 |
129 | True
130 | True
131 | source.extension.vsixmanifest
132 | true
133 | VSPackage
134 |
135 |
136 |
137 |
138 |
139 |
140 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
141 |
142 |
143 |
144 |
145 |
146 |
153 |
--------------------------------------------------------------------------------