├── .gitattributes
├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── Data
├── EditorUtils2010.nuspec
├── EditorUtils2012.nuspec
├── EditorUtils2013.nuspec
└── EditorUtils2015.nuspec
├── Deploy.ps1
├── EditorUtils.settings
├── EditorUtils.sln
├── Key.publickey
├── Key.snk
├── License.txt
├── ReadMe.md
├── References
├── Vs2010
│ ├── App.config
│ ├── Microsoft.VisualStudio.CoreUtility.dll
│ ├── Microsoft.VisualStudio.Language.Intellisense.dll
│ ├── Microsoft.VisualStudio.Language.StandardClassification.dll
│ ├── Microsoft.VisualStudio.Text.Data.dll
│ ├── Microsoft.VisualStudio.Text.Logic.dll
│ ├── Microsoft.VisualStudio.Text.UI.Wpf.dll
│ └── Microsoft.VisualStudio.Text.UI.dll
├── Vs2012
│ ├── App.config
│ ├── Microsoft.VisualStudio.CoreUtility.dll
│ ├── Microsoft.VisualStudio.Language.Intellisense.dll
│ ├── Microsoft.VisualStudio.Language.StandardClassification.dll
│ ├── Microsoft.VisualStudio.Text.Data.dll
│ ├── Microsoft.VisualStudio.Text.Logic.dll
│ ├── Microsoft.VisualStudio.Text.UI.Wpf.dll
│ └── Microsoft.VisualStudio.Text.UI.dll
├── Vs2013
│ ├── App.config
│ ├── Microsoft.VisualStudio.CoreUtility.dll
│ ├── Microsoft.VisualStudio.Language.Intellisense.dll
│ ├── Microsoft.VisualStudio.Language.StandardClassification.dll
│ ├── Microsoft.VisualStudio.Text.Data.dll
│ ├── Microsoft.VisualStudio.Text.Logic.dll
│ ├── Microsoft.VisualStudio.Text.UI.Wpf.dll
│ └── Microsoft.VisualStudio.Text.UI.dll
└── Vs2015
│ ├── App.config
│ ├── Microsoft.VisualStudio.CoreUtility.dll
│ ├── Microsoft.VisualStudio.Language.Intellisense.dll
│ ├── Microsoft.VisualStudio.Language.StandardClassification.dll
│ ├── Microsoft.VisualStudio.Text.Data.dll
│ ├── Microsoft.VisualStudio.Text.Logic.dll
│ ├── Microsoft.VisualStudio.Text.UI.Wpf.dll
│ └── Microsoft.VisualStudio.Text.UI.dll
├── Src
├── EditorApp
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── EditorApp.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
├── EditorUtils.settings
└── EditorUtils
│ ├── AsyncTaggerSource.cs
│ ├── Constants.cs
│ ├── Contract.cs
│ ├── EditorHost.cs
│ ├── EditorHostFactory.UndoExportProvider.cs
│ ├── EditorHostFactory.cs
│ ├── EditorUtils.csproj
│ ├── EditorUtilsFactory.cs
│ ├── EditorUtilsResources.cs
│ ├── EditorUtilsTrace.cs
│ ├── EditorVersion.cs
│ ├── Extensions.cs
│ ├── IAdhocOutliner.cs
│ ├── IAsyncTaggerSource.cs
│ ├── IBasicTaggerSource.cs
│ ├── IBasicUndoHistoryRegistry.cs
│ ├── IProtectedOperations.cs
│ ├── Implementation
│ ├── BasicUndo
│ │ ├── BasicUndoHistory.cs
│ │ ├── BasicUndoHistoryRegistry.cs
│ │ └── BasicUndoTransaction.cs
│ ├── Tagging
│ │ ├── AsyncTagger.Channel.cs
│ │ ├── AsyncTagger.cs
│ │ ├── BasicTagger.cs
│ │ ├── Classifier.cs
│ │ ├── CountedClassifier.cs
│ │ ├── CountedTagger.cs
│ │ ├── CountedValue.cs
│ │ └── TaggerUtil.cs
│ └── Utilities
│ │ ├── AdhocOutliner.cs
│ │ ├── EqualityUtility.cs
│ │ ├── NormalizedLineRangeCollection.cs
│ │ ├── ProtectedOperations.cs
│ │ └── ReadOnlyStack.cs
│ ├── Key.snk
│ ├── LineRange.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── SnapshotLineRange.cs
│ └── UsedInBackgroundThreadAttribute.cs
├── Test
├── Cats
│ ├── CatTagger.cs
│ ├── CatTaggerFormat.cs
│ ├── CatTaggerProvider.cs
│ ├── Cats.csproj
│ ├── Contstants.cs
│ ├── DogClassifier.cs
│ ├── DogClassifierProvider.cs
│ ├── DogTaggerFormat.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── source.extension.vsixmanifest
├── EditorUtils.settings
├── EditorUtilsTest
│ ├── AdhocOutlinerTest.cs
│ ├── App.config
│ ├── AsyncTaggerTest.cs
│ ├── BasicTaggerTest.cs
│ ├── BasicUndoHistoryTest.cs
│ ├── ChannelTest.cs
│ ├── ClassifierTest.cs
│ ├── CountedClassifierTest.cs
│ ├── CountedTaggerTest.cs
│ ├── EditorHostFactoryTest.cs
│ ├── EditorHostTest.cs
│ ├── EditorUtilsTest.csproj
│ ├── EqualityUtil.cs
│ ├── Extensions.cs
│ ├── ExtensionsTest.cs
│ ├── Key.snk
│ ├── LineRangeTest.cs
│ ├── MemoryLeakTest.cs
│ ├── MockFactory.cs
│ ├── NormalizedLineRangeCollectionTest.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ProtectedOperationsTest.cs
│ ├── ReadOnlyStackTest.cs
│ ├── SnapshotLineRangeTest.cs
│ ├── TaggerCommonTest.cs
│ ├── TaggerUtilTest.cs
│ ├── TestUtils.cs
│ ├── TestableSynchronizationContext.cs
│ ├── TextTaggerSource.cs
│ ├── VersioningTest.cs
│ └── packages.config
└── WordUnderCaret
│ ├── Constants.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── WordUnderCaret.csproj
│ ├── WordUnderCaret.sln
│ ├── WordUnderCaretFormat.cs
│ ├── WordUnderCaretTagger.cs
│ ├── WordUnderCaretTaggerProvider.cs
│ └── source.extension.vsixmanifest
├── Tools
├── xunit.console.clr4.x86.exe
├── xunit.console.clr4.x86.exe.config
├── xunit.runner.utility.dll
└── xunit.runner.utility.xml
└── appveyor.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | * -text
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # git-ls-files --others --exclude-from=.git/info/exclude
2 | # Lines that start with '#' are comments.
3 | # For a project mostly in C, the following would be a good set of
4 | # exclude patterns (uncomment them if you want to use them):
5 | # *.[oa]
6 | # *~
7 |
8 | # Binary files
9 | *.exe
10 | *.dbg
11 | *.pcb
12 | *.ncb
13 | *.swp
14 | *.snk
15 | *.pdb
16 | *.msi
17 |
18 | # Project Files
19 | *.user
20 | *.suo
21 | *.db
22 | *.psess
23 | TestResult.xml
24 |
25 | # NUnit files
26 | *.VisualState.xml
27 |
28 | # Resharper
29 | _ReSharper.*
30 |
31 | # This solution uses NuGet package restore so don't check in
32 | # the actual binaries
33 | packages/
34 |
35 | # Roslyn generated folder
36 | *.sln.ide/
37 |
38 | # Ignore NCrunch files for the moment. Still experimenting and
39 | # don't want to put them in there just yet
40 | *ncrunchproject
41 | *ncrunchsolution
42 | *crunchsolution.cache
43 |
44 | # Directories
45 | obj/
46 | bin/
47 | TestResults/
48 | Debug/
49 | Release/
50 | Deploy/
51 | Samples/HighlightCommentKinds/bin
52 | Samples/HighlightCommentKinds/obj
53 |
54 | # Profiling Output
55 | *.vsp
56 |
57 | # Hacky build items
58 | EditorUtilsVsix.vsix
59 | Test/EditorUtilsTest/App.config
60 |
61 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/.nuget/NuGet.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildProjectDirectory)\..\
5 |
6 |
7 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
8 | $([System.IO.Path]::Combine($(ProjectDir), "packages.config"))
9 | $([System.IO.Path]::Combine($(SolutionDir), "packages"))
10 |
11 |
12 | $(SolutionDir).nuget
13 | packages.config
14 | $(SolutionDir)packages
15 |
16 |
17 | $(NuGetToolsPath)\nuget.exe
18 | "$(NuGetExePath)"
19 | mono --runtime=v4.0.30319 $(NuGetExePath)
20 |
21 | $(TargetDir.Trim('\\'))
22 |
23 |
24 | ""
25 |
26 |
27 | false
28 |
29 |
30 | false
31 |
32 |
33 | $(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"
34 | $(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols
35 |
36 |
37 |
38 | RestorePackages;
39 | $(BuildDependsOn);
40 |
41 |
42 |
43 |
44 | $(BuildDependsOn);
45 | BuildPackage;
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
57 |
58 |
61 |
62 |
63 |
64 |
66 |
67 |
70 |
71 |
--------------------------------------------------------------------------------
/Data/EditorUtils2010.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EditorUtils2010
5 | $version$
6 | EditorUtils 2010
7 | JaredPar
8 | JaredPar
9 | http://www.apache.org/licenses/LICENSE-2.0
10 | false
11 | Utility DLL for writing Visual Studio extensions
12 | Initial Release
13 | Copyright 2012
14 | VisualStudio; VSIX
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Data/EditorUtils2012.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EditorUtils2012
5 | $version$
6 | EditorUtils 2012
7 | JaredPar
8 | JaredPar
9 | http://www.apache.org/licenses/LICENSE-2.0
10 | false
11 | Utility DLL for writing Visual Studio extensions (2012 and above)
12 | Initial Release
13 | Copyright 2012
14 | VisualStudio; VSIX
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Data/EditorUtils2013.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EditorUtils2013
5 | $version$
6 | EditorUtils 2013
7 | JaredPar
8 | JaredPar
9 | http://www.apache.org/licenses/LICENSE-2.0
10 | false
11 | Utility DLL for writing Visual Studio extensions (2013 and above)
12 | Initial Release
13 | Copyright 2012
14 | VisualStudio; VSIX
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Data/EditorUtils2015.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EditorUtils2015
5 | $version$
6 | EditorUtils 2015
7 | JaredPar
8 | JaredPar
9 | http://www.apache.org/licenses/LICENSE-2.0
10 | false
11 | Utility DLL for writing Visual Studio extensions
12 | Initial Release
13 | Copyright 2012
14 | VisualStudio; VSIX
15 |
16 |
17 |
--------------------------------------------------------------------------------
/EditorUtils.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(MSBuildThisFileDirectory)References\Vs2010\App.config
6 |
7 |
8 |
9 | $(MSBuildThisFileDirectory)References\Vs2012\App.config
10 |
11 |
12 |
13 | $(MSBuildThisFileDirectory)References\Vs2013\App.config
14 |
15 |
16 |
17 | $(MSBuildThisFileDirectory)References\Vs2015\App.config
18 |
19 |
20 |
21 | $(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2010
22 | 2010
23 | 10.0.0.0
24 | 4.0
25 | $(DefineConstants);VS2010
26 |
27 |
28 |
29 | $(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2012
30 | 2012
31 | 11.0.0.0
32 | 4.5
33 | $(DefineConstants);VS2012
34 |
35 |
36 |
37 | $(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2013
38 | 2013
39 | 12.0.0.0
40 | 4.5
41 | $(DefineConstants);VS2013
42 |
43 |
44 |
45 | $(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2015
46 | 2015
47 | 14.0.0.0
48 | 4.5
49 | $(DefineConstants);VS2015
50 |
51 |
52 |
53 |
54 |
55 | False
56 |
57 |
58 |
--------------------------------------------------------------------------------
/EditorUtils.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.22823.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorUtils", "Src\EditorUtils\EditorUtils.csproj", "{FB418222-C105-4942-8EEB-832DDCFFD89D}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorUtilsTest", "Test\EditorUtilsTest\EditorUtilsTest.csproj", "{BAED09B7-25D9-4DD8-8558-BAC9730BA3F3}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WordUnderCaret", "Test\WordUnderCaret\WordUnderCaret.csproj", "{620BEC49-DF9C-406A-9492-BD157BAB95BC}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cats", "Test\Cats\Cats.csproj", "{1B8425A4-6DBB-4227-92E7-EC8CC379DA63}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorApp", "Src\EditorApp\EditorApp.csproj", "{EE06DCE3-203C-4503-9AFA-0A419F43F2B3}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release|Any CPU = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {FB418222-C105-4942-8EEB-832DDCFFD89D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {FB418222-C105-4942-8EEB-832DDCFFD89D}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {FB418222-C105-4942-8EEB-832DDCFFD89D}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {FB418222-C105-4942-8EEB-832DDCFFD89D}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {BAED09B7-25D9-4DD8-8558-BAC9730BA3F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {BAED09B7-25D9-4DD8-8558-BAC9730BA3F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {BAED09B7-25D9-4DD8-8558-BAC9730BA3F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {BAED09B7-25D9-4DD8-8558-BAC9730BA3F3}.Release|Any CPU.Build.0 = Release|Any CPU
30 | {620BEC49-DF9C-406A-9492-BD157BAB95BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {620BEC49-DF9C-406A-9492-BD157BAB95BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {620BEC49-DF9C-406A-9492-BD157BAB95BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {620BEC49-DF9C-406A-9492-BD157BAB95BC}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {1B8425A4-6DBB-4227-92E7-EC8CC379DA63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {1B8425A4-6DBB-4227-92E7-EC8CC379DA63}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {1B8425A4-6DBB-4227-92E7-EC8CC379DA63}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {1B8425A4-6DBB-4227-92E7-EC8CC379DA63}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {EE06DCE3-203C-4503-9AFA-0A419F43F2B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {EE06DCE3-203C-4503-9AFA-0A419F43F2B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {EE06DCE3-203C-4503-9AFA-0A419F43F2B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {EE06DCE3-203C-4503-9AFA-0A419F43F2B3}.Release|Any CPU.Build.0 = Release|Any CPU
42 | EndGlobalSection
43 | GlobalSection(SolutionProperties) = preSolution
44 | HideSolutionNode = FALSE
45 | EndGlobalSection
46 | EndGlobal
47 |
--------------------------------------------------------------------------------
/Key.publickey:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/Key.publickey
--------------------------------------------------------------------------------
/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/Key.snk
--------------------------------------------------------------------------------
/License.txt:
--------------------------------------------------------------------------------
1 | Copyright 2012 Jared Parsons
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.
14 |
--------------------------------------------------------------------------------
/ReadMe.md:
--------------------------------------------------------------------------------
1 | ### Editor Utilities Library
2 |
3 | This is a utility library to be used with VSIX projects. It abstracts away many of the problem areas of the Visual Studio API into simple to use types.
4 |
5 | This project is available as a set of NuGet packages. Which one to choose depends on which version of Visual Studio you are targetting
6 |
7 | - EditorUtils: VS 2010 and above
8 | - EditorUtils2012: VS 2012 and above
9 | - EditorUtils2013: VS 2013 and above
10 |
11 | If you don't target VS 2010 then use EditorUtils2012 instead of EditorUtils. This avoids some tooling issues in the Visual Studio build around missing references
12 |
13 | AppVeyor: [](https://ci.appveyor.com/project/jaredpar/editorutils)
14 |
15 | ### Features
16 |
17 | EditorUtils is a collection of abstractions for building VSIX projects. It is broken down into the following feature areas
18 |
19 | #### Tagging
20 |
21 | Syntax highlighting, brace completion, intra text adornments, etc ... are all features provided by the [ITagger](http://msdn.microsoft.com/en-us/library/dd885020.aspx) interface. The interface is simple enough but the rules and scenarios around this interface are complex and largely undocumented. EditorUtils abstracts away much of this complexity by providing a much simpler interface IBasicTaggerSource.
22 |
23 | #### Async Tagging
24 |
25 | All [ITagger](http://msdn.microsoft.com/en-us/library/dd885020.aspx) implementations are driven through the UI thread of Visual Studio. Any delay in tagger implementations is felt immediately by the user. Simple taggers can afford to be synchronous but more complex taggers must be asynchronous in order to keep the UI responsive. EditorUtils provides the `IAsyncTaggerSource`to abstract away all of the complexities of async tagging.
26 |
27 | ```csharp
28 | class MyAsyncTaggerSource : IAsyncTaggerSource { ... }
29 |
30 | MyAsyncTaggerSource myAsyncTaggerSource = new MyAsyncTaggerSource();
31 | ITagger tagger = EditorUtilsFactory.CreateAsyncTaggerRaw(myAsyncTaggerSource);
32 | ```
33 |
34 |
35 | #### Editor Hosting
36 |
37 | At its core the Visual Studio editor is just a WPF control that is completely independent of Visual Studio itself. The ability to host this control outside of Visual Studio is critical to thorough testing of VSIX plugins. EditorUtils makes this extremely easy to do with the EditorHost feature.
38 |
39 | ```csharp
40 | var editorHost = new EditorHost();
41 | var textView = editorHost.CreateTextView();
42 | ```
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/References/Vs2010/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.CoreUtility.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.CoreUtility.dll
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.Language.Intellisense.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.Language.Intellisense.dll
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.Language.StandardClassification.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.Language.StandardClassification.dll
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.Text.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.Text.Data.dll
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.Text.Logic.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.Text.Logic.dll
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.Text.UI.Wpf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.Text.UI.Wpf.dll
--------------------------------------------------------------------------------
/References/Vs2010/Microsoft.VisualStudio.Text.UI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2010/Microsoft.VisualStudio.Text.UI.dll
--------------------------------------------------------------------------------
/References/Vs2012/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.CoreUtility.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.CoreUtility.dll
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.Language.Intellisense.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.Language.Intellisense.dll
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.Language.StandardClassification.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.Language.StandardClassification.dll
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.Text.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.Text.Data.dll
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.Text.Logic.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.Text.Logic.dll
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.Text.UI.Wpf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.Text.UI.Wpf.dll
--------------------------------------------------------------------------------
/References/Vs2012/Microsoft.VisualStudio.Text.UI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2012/Microsoft.VisualStudio.Text.UI.dll
--------------------------------------------------------------------------------
/References/Vs2013/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.CoreUtility.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.CoreUtility.dll
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.Language.Intellisense.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.Language.Intellisense.dll
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.Language.StandardClassification.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.Language.StandardClassification.dll
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.Text.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.Text.Data.dll
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.Text.Logic.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.Text.Logic.dll
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.Text.UI.Wpf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.Text.UI.Wpf.dll
--------------------------------------------------------------------------------
/References/Vs2013/Microsoft.VisualStudio.Text.UI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2013/Microsoft.VisualStudio.Text.UI.dll
--------------------------------------------------------------------------------
/References/Vs2015/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.CoreUtility.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.CoreUtility.dll
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.Language.Intellisense.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.Language.Intellisense.dll
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.Language.StandardClassification.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.Language.StandardClassification.dll
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.Text.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.Text.Data.dll
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.Text.Logic.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.Text.Logic.dll
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.Text.UI.Wpf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.Text.UI.Wpf.dll
--------------------------------------------------------------------------------
/References/Vs2015/Microsoft.VisualStudio.Text.UI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaredpar/EditorUtils/f1133e915fd309f4df76be4c39824ea27886561a/References/Vs2015/Microsoft.VisualStudio.Text.UI.dll
--------------------------------------------------------------------------------
/Src/EditorApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/EditorApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Src/EditorApp/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace EditorApp
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Src/EditorApp/EditorApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {EE06DCE3-203C-4503-9AFA-0A419F43F2B3}
9 | WinExe
10 | Properties
11 | EditorApp
12 | EditorApp
13 | v4.5
14 | 512
15 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | 4
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | MSBuild:Compile
63 | Designer
64 |
65 |
66 | App.xaml
67 | Code
68 |
69 |
70 | MainWindow.xaml
71 | Code
72 |
73 |
74 |
75 |
76 | Code
77 |
78 |
79 | True
80 | True
81 | Resources.resx
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 | ResXFileCodeGenerator
90 | Resources.Designer.cs
91 |
92 |
93 | SettingsSingleFileGenerator
94 | Settings.Designer.cs
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | {fb418222-c105-4942-8eeb-832ddcffd89d}
104 | EditorUtils
105 |
106 |
107 |
108 |
115 |
--------------------------------------------------------------------------------
/Src/EditorApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Src/EditorApp/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using EditorUtils;
16 |
17 | namespace EditorApp
18 | {
19 | ///
20 | /// Interaction logic for MainWindow.xaml
21 | ///
22 | public partial class MainWindow : Window
23 | {
24 | public MainWindow()
25 | {
26 | InitializeComponent();
27 |
28 | var editorHostFactory = new EditorHostFactory(EditorVersion.Vs2015);
29 | var editorHost = editorHostFactory.CreateEditorHost();
30 |
31 | var textBuffer = editorHost.TextBufferFactoryService.CreateTextBuffer();
32 | textBuffer.Insert(0, "Hello Editor");
33 |
34 | var wpfTextView = editorHost.TextEditorFactoryService.CreateTextView(textBuffer);
35 | var wpfTextViewHost = editorHost.TextEditorFactoryService.CreateTextViewHost(wpfTextView, setFocus: true);
36 | Content = wpfTextViewHost.HostControl;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Src/EditorApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("EditorApp")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("EditorApp")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Src/EditorApp/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.0
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EditorApp.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EditorApp.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Src/EditorApp/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.0
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EditorApp.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Src/EditorApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/EditorUtils.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Src/EditorUtils/AsyncTaggerSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Threading;
5 | using Microsoft.VisualStudio.Text;
6 | using Microsoft.VisualStudio.Text.Editor;
7 | using Microsoft.VisualStudio.Text.Tagging;
8 |
9 | namespace EditorUtils
10 | {
11 | public abstract class AsyncTaggerSource : IAsyncTaggerSource
12 | where TTag : ITag
13 | {
14 | private readonly ITextView _textViewOptional;
15 | private readonly ITextBuffer _textBuffer;
16 | private event EventHandler _changedEvent;
17 |
18 | public ITextView TextViewOptional
19 | {
20 | get { return _textViewOptional; }
21 | }
22 |
23 | public ITextBuffer TextBuffer
24 | {
25 | get { return _textBuffer; }
26 | }
27 |
28 | protected AsyncTaggerSource(ITextView textView)
29 | {
30 | Contract.Requires(textView != null);
31 | _textViewOptional = textView;
32 | _textBuffer = textView.TextBuffer;
33 | }
34 |
35 | protected AsyncTaggerSource(ITextBuffer textBuffer)
36 | {
37 | Contract.Requires(textBuffer != null);
38 | _textBuffer = textBuffer;
39 | }
40 |
41 | protected void RaiseChanged()
42 | {
43 | if (_changedEvent != null)
44 | {
45 | _changedEvent(this, EventArgs.Empty);
46 | }
47 | }
48 |
49 | protected virtual bool TryGetTagsPrompt(SnapshotSpan span, out IEnumerable> tags)
50 | {
51 | tags = null;
52 | return false;
53 | }
54 |
55 | ///
56 | /// Get the data needed in the background thread from the specified SnapshotSpan. This is called on
57 | /// the main thread
58 | ///
59 | protected abstract TData GetDataForSnapshot(ITextSnapshot snapshot);
60 |
61 | ///
62 | /// Get the tags for the specified span. This is called on the background thread
63 | ///
64 | protected abstract ReadOnlyCollection> GetTagsInBackground(TData data, SnapshotSpan span, CancellationToken cancellationToken);
65 |
66 | #region IAsyncTaggerSource
67 |
68 | int? IAsyncTaggerSource.Delay
69 | {
70 | get { return Constants.DefaultAsyncDelay; }
71 | }
72 |
73 | ITextSnapshot IAsyncTaggerSource.TextSnapshot
74 | {
75 | get { return TextBuffer.CurrentSnapshot; }
76 | }
77 |
78 | ITextView IAsyncTaggerSource.TextViewOptional
79 | {
80 | get { return TextViewOptional; }
81 | }
82 |
83 | TData IAsyncTaggerSource.GetDataForSnapshot(ITextSnapshot snapshot)
84 | {
85 | return GetDataForSnapshot(snapshot);
86 | }
87 |
88 | ReadOnlyCollection> IAsyncTaggerSource.GetTagsInBackground(TData data, SnapshotSpan span, CancellationToken cancellationToken)
89 | {
90 | return GetTagsInBackground(data, span, cancellationToken);
91 | }
92 |
93 | bool IAsyncTaggerSource.TryGetTagsPrompt(SnapshotSpan span, out IEnumerable> tags)
94 | {
95 | return TryGetTagsPrompt(span, out tags);
96 | }
97 |
98 | event EventHandler IAsyncTaggerSource.Changed
99 | {
100 | add { _changedEvent += value; }
101 | remove { _changedEvent -= value; }
102 | }
103 |
104 | #endregion
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/Src/EditorUtils/Constants.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace EditorUtils
3 | {
4 | public static class Constants
5 | {
6 | ///
7 | /// The version of the assembly. This must be changed every time a new version of the utility
8 | /// library is published to NuGet
9 | ///
10 | #if DEBUG
11 | internal const string AssemblyVersion = "99.0.0.0";
12 | #else
13 | internal const string AssemblyVersion = "1.5.0.0";
14 | #endif
15 |
16 | ///
17 | /// Standard delay for asynchronous taggers
18 | ///
19 | public const int DefaultAsyncDelay = 100;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Src/EditorUtils/Contract.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace EditorUtils
5 | {
6 | internal static class Contract
7 | {
8 | [Serializable]
9 | internal sealed class ContractException : Exception
10 | {
11 | internal ContractException() { }
12 | internal ContractException(string message) : base(message) { }
13 | internal ContractException(string message, Exception inner) : base(message, inner) { }
14 | internal ContractException(
15 | System.Runtime.Serialization.SerializationInfo info,
16 | System.Runtime.Serialization.StreamingContext context)
17 | : base(info, context) { }
18 | }
19 |
20 | internal static void Fail()
21 | {
22 | Requires(false);
23 | }
24 |
25 | internal static void Requires(bool condition)
26 | {
27 | if (!condition)
28 | {
29 | throw new ContractException();
30 | }
31 | }
32 |
33 | [Conditional("DEBUG")]
34 | internal static void Assert(bool condition)
35 | {
36 | Requires(condition);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Src/EditorUtils/EditorHostFactory.UndoExportProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.Composition;
4 | using System.ComponentModel.Composition.Hosting;
5 | using System.ComponentModel.Composition.Primitives;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Reflection;
9 | using System.Text;
10 | using Microsoft.VisualStudio.Text.Operations;
11 | using Microsoft.Win32;
12 |
13 | namespace EditorUtils
14 | {
15 | public sealed partial class EditorHostFactory
16 | {
17 | ///
18 | /// In order to host the editor we need to provide an ITextUndoHistory export. However
19 | /// we can't simply export it from the DLL because it would conflict with Visual Studio's
20 | /// export of ITextUndoHistoryRegistry in the default scenario. This ComposablePartCatalog
21 | /// is simply here to hand export the type in the hosted scenario only
22 | ///
23 | private sealed class UndoExportProvider : ExportProvider
24 | {
25 | private readonly IBasicUndoHistoryRegistry _basicUndoHistoryRegistry;
26 | private readonly string _textUndoHistoryRegistryContractName;
27 | private readonly string _basicUndoHistoryRegistryContractName;
28 | private readonly Export _export;
29 |
30 | internal UndoExportProvider()
31 | {
32 | _textUndoHistoryRegistryContractName = AttributedModelServices.GetContractName(typeof(ITextUndoHistoryRegistry));
33 | _basicUndoHistoryRegistryContractName = AttributedModelServices.GetContractName(typeof(IBasicUndoHistoryRegistry));
34 | _basicUndoHistoryRegistry = EditorUtilsFactory.CreateBasicUndoHistoryRegistry();
35 | _export = new Export(_textUndoHistoryRegistryContractName, () => _basicUndoHistoryRegistry);
36 | }
37 |
38 | protected override IEnumerable GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
39 | {
40 | if (definition.ContractName == _textUndoHistoryRegistryContractName ||
41 | definition.ContractName == _basicUndoHistoryRegistryContractName)
42 | {
43 | yield return _export;
44 | }
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Src/EditorUtils/EditorUtilsFactory.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Linq;
4 | using EditorUtils.Implementation.Tagging;
5 | using EditorUtils.Implementation.BasicUndo;
6 | using Microsoft.VisualStudio.Text.Tagging;
7 | using Microsoft.VisualStudio.Utilities;
8 | using Microsoft.VisualStudio.Text;
9 | using System.Collections.Generic;
10 | using EditorUtils.Implementation.Utilities;
11 | using Microsoft.VisualStudio.Text.Classification;
12 |
13 | namespace EditorUtils
14 | {
15 | ///
16 | /// Importable interface which produces ITagger implementations based on sources
17 | ///
18 | public static class EditorUtilsFactory
19 | {
20 | ///
21 | /// Create an ITagger implementation for the IAsyncTaggerSource.
22 | ///
23 | public static ITagger CreateTaggerRaw(IAsyncTaggerSource asyncTaggerSource)
24 | where TTag : ITag
25 | {
26 | return new AsyncTagger(asyncTaggerSource);
27 | }
28 |
29 | ///
30 | /// Create an ITagger implementation for the IBasicTaggerSource
31 | ///
32 | public static ITagger CreateTaggerRaw(IBasicTaggerSource basicTaggerSource)
33 | where TTag : ITag
34 | {
35 | return new BasicTagger(basicTaggerSource);
36 | }
37 |
38 | ///
39 | /// Create an ITagger implementation for the IAsyncTaggerSource. This instance will be a counted
40 | /// wrapper over the single IAsyncTaggerSource represented by the specified key
41 | ///
42 | public static ITagger CreateTagger(PropertyCollection propertyCollection, object key, Func> createFunc)
43 | where TTag : ITag
44 | {
45 | return new CountedTagger(
46 | propertyCollection,
47 | key,
48 | () => new AsyncTagger(createFunc()));
49 | }
50 |
51 | ///
52 | /// Create an ITagger implementation for the IBasicTaggerSource. This instance will be a counted
53 | /// wrapper over the single IBasicTaggerSource represented by the specified key
54 | ///
55 | public static ITagger CreateTagger(PropertyCollection propertyCollection, object key, Func> createFunc)
56 | where TTag : ITag
57 | {
58 | return new CountedTagger(
59 | propertyCollection,
60 | key,
61 | () => new BasicTagger(createFunc()));
62 | }
63 |
64 | public static IClassifier CreateClassifierRaw(IBasicTaggerSource basicTaggerSource)
65 | {
66 | return new Classifier(CreateTaggerRaw(basicTaggerSource));
67 | }
68 |
69 | public static IClassifier CreateClassifierRaw(IAsyncTaggerSource asyncTaggerSource)
70 | {
71 | return new Classifier(CreateTaggerRaw(asyncTaggerSource));
72 | }
73 |
74 | public static IClassifier CreateClassifier(PropertyCollection propertyCollection, object key, Func> createFunc)
75 | {
76 | return new CountedClassifier(
77 | propertyCollection,
78 | key,
79 | () => CreateClassifierRaw(createFunc()));
80 | }
81 |
82 | public static IClassifier CreateClassifier(PropertyCollection propertyCollection, object key, Func> createFunc)
83 | {
84 | return new CountedClassifier(
85 | propertyCollection,
86 | key,
87 | () => CreateClassifierRaw(createFunc()));
88 | }
89 |
90 | public static IBasicUndoHistoryRegistry CreateBasicUndoHistoryRegistry()
91 | {
92 | return new BasicTextUndoHistoryRegistry();
93 | }
94 |
95 | public static IProtectedOperations CreateProtectedOperations(IEnumerable> errorHandlers)
96 | {
97 | return new ProtectedOperations(errorHandlers);
98 | }
99 |
100 | public static IProtectedOperations CreateProtectedOperations(IEnumerable errorHandlers)
101 | {
102 | var lazyList = errorHandlers.Select(x => new Lazy(() => x)).ToList();
103 | return new ProtectedOperations(lazyList);
104 | }
105 |
106 | ///
107 | /// Get or create the IAdhocOutliner instance for the given ITextBuffer. This return will be useless
108 | /// unless the code which calls this method exports an ITaggerProvider which proxies the return
109 | /// of GetOrCreateOutlinerTagger
110 | ///
111 | public static IAdhocOutliner GetOrCreateOutliner(ITextBuffer textBuffer)
112 | {
113 | return GetOrCreateOutlinerCore(textBuffer);
114 | }
115 |
116 | ///
117 | /// This is the ITagger implementation for IAdhocOutliner
118 | ///
119 | public static ITagger CreateOutlinerTagger(ITextBuffer textBuffer)
120 | {
121 | return CreateTagger(
122 | textBuffer.Properties,
123 | AdhocOutliner.OutlinerTaggerKey,
124 | () => GetOrCreateOutlinerCore(textBuffer));
125 | }
126 |
127 | private static AdhocOutliner GetOrCreateOutlinerCore(ITextBuffer textBuffer)
128 | {
129 | return textBuffer.Properties.GetOrCreateSingletonProperty(AdhocOutliner.OutlinerKey, () => new AdhocOutliner(textBuffer));
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/Src/EditorUtils/EditorUtilsResources.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace EditorUtils
3 | {
4 | internal static class EditorUtilsResources
5 | {
6 | internal static string InvalidLineNumber = "Invalid Line Number";
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Src/EditorUtils/EditorUtilsTrace.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace EditorUtils
4 | {
5 | public static class EditorUtilsTrace
6 | {
7 | static readonly TraceSwitch s_traceSwitch = new TraceSwitch("EditorUtils", "EditorUtils Trace") { Level = TraceLevel.Off };
8 |
9 | public static TraceSwitch TraceSwitch
10 | {
11 | get { return s_traceSwitch; }
12 | }
13 |
14 | [Conditional("TRACE")]
15 | public static void TraceInfo(string msg)
16 | {
17 | Trace.WriteLineIf(s_traceSwitch.TraceInfo, "EditorUtils: " + msg);
18 | }
19 |
20 | [Conditional("TRACE")]
21 | public static void TraceInfo(string msg, params object[] args)
22 | {
23 | Trace.WriteLineIf(s_traceSwitch.TraceInfo, "EditorUtils: " + string.Format(msg, args));
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Src/EditorUtils/EditorVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace EditorUtils
7 | {
8 | ///
9 | /// The supported list of editor versions
10 | ///
11 | /// These must be listed in ascending version order
12 | public enum EditorVersion
13 | {
14 | Vs2010,
15 | Vs2012,
16 | Vs2013,
17 | Vs2015,
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Src/EditorUtils/IAdhocOutliner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.VisualStudio.Text;
3 | using Microsoft.VisualStudio.Text.Tagging;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace EditorUtils
7 | {
8 | public struct OutliningRegion
9 | {
10 | public readonly OutliningRegionTag Tag;
11 | public readonly SnapshotSpan Span;
12 | public readonly int Cookie;
13 |
14 | public OutliningRegion(
15 | OutliningRegionTag tag,
16 | SnapshotSpan span,
17 | int cookie)
18 | {
19 | Tag = tag;
20 | Span = span;
21 | Cookie = cookie;
22 | }
23 | }
24 |
25 | ///
26 | /// Allows callers to create outlining regions over arbitrary SnapshotSpan values
27 | ///
28 | public interface IAdhocOutliner
29 | {
30 | ///
31 | /// Get the ITextBuffer associated with this instance
32 | ///
33 | ITextBuffer TextBuffer { get; }
34 |
35 | ///
36 | /// Get all of the regions in the given ITextSnapshot
37 | ///
38 | ReadOnlyCollection GetOutliningRegions(SnapshotSpan span);
39 |
40 | ///
41 | /// Create an outlining region over the given SnapshotSpan. The int value returned is
42 | /// a cookie for later deleting the region
43 | ///
44 | OutliningRegion CreateOutliningRegion(SnapshotSpan span, SpanTrackingMode spanTrackingMode, string text, string hint);
45 |
46 | ///
47 | /// Delete the previously created outlining region with the given cookie
48 | ///
49 | bool DeleteOutliningRegion(int cookie);
50 |
51 | ///
52 | /// Raised when any outlining regions change
53 | ///
54 | event EventHandler Changed;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Src/EditorUtils/IAsyncTaggerSource.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 | using System.Threading;
6 | using Microsoft.VisualStudio.Text;
7 | using Microsoft.VisualStudio.Text.Editor;
8 | using Microsoft.VisualStudio.Text.Tagging;
9 | namespace EditorUtils
10 | {
11 | ///
12 | /// A tagger source for asynchronous taggers. This interface is consumed from multiple threads
13 | /// and each method which is called on the background thread is labelled as such
14 | /// be called on any thread
15 | ///
16 | public interface IAsyncTaggerSource
17 | where TTag : ITag
18 | {
19 | ///
20 | /// Delay in milliseconds which should occur between the call to GetTags and the kicking off
21 | /// of a background task
22 | ///
23 | int? Delay { get; }
24 |
25 | ///
26 | /// The current Snapshot.
27 | ///
28 | /// Called from the main thread only
29 | ///
30 | ITextSnapshot TextSnapshot { get; }
31 |
32 | ///
33 | /// The current ITextView if this tagger is attached to a ITextView. This is an optional
34 | /// value
35 | ///
36 | /// Called from the main thread only
37 | ///
38 | ITextView TextViewOptional { get; }
39 |
40 | ///
41 | /// This method is called to gather data on the UI thread which will then be passed
42 | /// down to the background thread for processing
43 | ///
44 | /// Called from the main thread only
45 | ///
46 | TData GetDataForSnapshot(ITextSnapshot snapshot);
47 |
48 | ///
49 | /// Return the applicable tags for the given SnapshotSpan instance. This will be
50 | /// called on a background thread and should respect the provided CancellationToken
51 | ///
52 | /// Called from the background thread only
53 | ///
54 | [UsedInBackgroundThread]
55 | ReadOnlyCollection> GetTagsInBackground(TData data, SnapshotSpan span, CancellationToken cancellationToken);
56 |
57 | ///
58 | /// To prevent needless spawning of Task values the async tagger has the option
59 | /// of providing prompt data. This method should only be used when determination
60 | /// of the tokens requires no calculation.
61 | ///
62 | /// Called from the main thread only
63 | ///
64 | bool TryGetTagsPrompt(SnapshotSpan span, out IEnumerable> tags);
65 |
66 | ///
67 | /// Raised by the source when the underlying source has changed. All previously
68 | /// provided data should be considered incorrect after this event
69 | ///
70 | event EventHandler Changed;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Src/EditorUtils/IBasicTaggerSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.ObjectModel;
3 | using Microsoft.VisualStudio.Text;
4 | using Microsoft.VisualStudio.Text.Tagging;
5 |
6 | namespace EditorUtils
7 | {
8 | public interface IBasicTaggerSource
9 | where TTag : ITag
10 | {
11 | ///
12 | /// Get the tags for the given SnapshotSpan
13 | ///
14 | ReadOnlyCollection> GetTags(SnapshotSpan span);
15 |
16 | ///
17 | /// Raised when the source changes in some way
18 | ///
19 | event EventHandler Changed;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Src/EditorUtils/IBasicUndoHistoryRegistry.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Text.Operations;
2 |
3 | namespace EditorUtils
4 | {
5 | ///
6 | /// In certain hosted scenarios the default ITextUndoHistoryRegistry won't be
7 | /// available. This is a necessary part of editor composition though and some
8 | /// implementation needs to be provided. Importing this type will provide a
9 | /// very basic implementation
10 | ///
11 | /// This type intentionally doesn't ever export ITextUndoHistoryRegistry. Doing
12 | /// this would conflict with Visual Studios export and cause a MEF composition
13 | /// error. It's instead exposed via this interface
14 | ///
15 | /// In general this type won't be used except in testing
16 | ///
17 | public interface IBasicUndoHistoryRegistry
18 | {
19 | ///
20 | /// Get the basic implementation of the ITextUndoHistoryRegistry
21 | ///
22 | ITextUndoHistoryRegistry TextUndoHistoryRegistry { get; }
23 |
24 | ///
25 | /// Try and get the IBasicUndoHistory for the given context
26 | ///
27 | bool TryGetBasicUndoHistory(object context, out IBasicUndoHistory basicUndoHistory);
28 | }
29 |
30 | public interface IBasicUndoHistory : ITextUndoHistory
31 | {
32 | ///
33 | /// Clear out all of the state including the undo and redo stacks
34 | ///
35 | void Clear();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Src/EditorUtils/IProtectedOperations.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Threading;
3 |
4 | namespace EditorUtils
5 | {
6 | ///
7 | /// Alternate method of dispatching calls. This wraps the Dispatcher type and will
8 | /// gracefully handle dispatch errors. Without this layer exceptions coming from a
9 | /// dispatched operation will go directly to the dispatch loop and crash the host
10 | /// application
11 | ///
12 | public interface IProtectedOperations
13 | {
14 | ///
15 | /// Get an Action delegate which invokes the original action and handles any
16 | /// thrown Exceptions by passing them off the the available IExtensionErrorHandler
17 | /// values
18 | ///
19 | Action GetProtectedAction(Action action);
20 |
21 | ///
22 | /// Get an EventHandler delegate which invokes the original action and handles any
23 | /// thrown Exceptions by passing them off the the available IExtensionErrorHandler
24 | /// values
25 | ///
26 | EventHandler GetProtectedEventHandler(EventHandler eventHandler);
27 |
28 | ///
29 | /// Dispatch the given delegate for action. If it fails the editor error
30 | /// handling system will be notified
31 | ///
32 | void BeginInvoke(Action action);
33 |
34 | ///
35 | /// Dispatch the given delegate for action. If it fails the editor error
36 | /// handling system will be notified
37 | ///
38 | void BeginInvoke(Action action, DispatcherPriority dispatcherPriority);
39 |
40 | ///
41 | /// Report an Exception to the IExtensionErrorHandlers
42 | ///
43 | void Report(Exception ex);
44 | }
45 | }
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Src/EditorUtils/Implementation/BasicUndo/BasicUndoHistoryRegistry.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Composition;
3 | using System.Runtime.CompilerServices;
4 | using Microsoft.VisualStudio.Text.Operations;
5 |
6 | namespace EditorUtils.Implementation.BasicUndo
7 | {
8 | ///
9 | /// This class is intended to be a very simple ITextUndoHistoryRegistry implementation for hosts that
10 | /// don't have a built-in undo mechanism
11 | ///
12 | internal sealed class BasicTextUndoHistoryRegistry : ITextUndoHistoryRegistry, IBasicUndoHistoryRegistry
13 | {
14 | private readonly ConditionalWeakTable