Browse files

Change the spell checker support by:

1. Including the spell checker definition assembly in the vsix
1. Creating a custom natural text tag for markdown files
1. No longer having the "markdown" content type inherit from "plaintext"
  • Loading branch information...
1 parent e7de8cc commit 9a8449c7d0e9282cf21bc2f88af14dd1fdb95986 Noah Richards committed Mar 12, 2010
Showing with 54 additions and 2 deletions.
  1. +0 −1 ContentType.cs
  2. +7 −0 MarkdownMode.csproj
  3. +6 −0 MarkdownMode.sln
  4. +40 −0 SpellcheckSupport/MarkdownNaturalTextTagger.cs
  5. +1 −1 Spellchecker
View
1 ContentType.cs
@@ -10,7 +10,6 @@ static class ContentType
[Export]
[Name(Name)]
[DisplayName("Markdown")]
- [BaseDefinition("plaintext")]
[BaseDefinition("HTML")]
public static ContentTypeDefinition MarkdownModeContentType = null;
View
7 MarkdownMode.csproj
@@ -88,6 +88,7 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
+ <Compile Include="SpellcheckSupport\MarkdownNaturalTextTagger.cs" />
<Compile Include="ToolWindow\Guids.cs" />
<Compile Include="ToolWindow\PreviewWindowUpdateListener.cs" />
<Compile Include="ToolWindow\Package.cs" />
@@ -128,6 +129,12 @@
<MergeWithCTO>true</MergeWithCTO>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="Spellchecker\SpellChecker.Definitions\SpellChecker.Definitions.csproj">
+ <Project>{87D22AC6-424B-48DD-A5E8-DCB7CB3DDD63}</Project>
+ <Name>SpellChecker.Definitions</Name>
+ </ProjectReference>
+ </ItemGroup>
<PropertyGroup>
<RegisterOutputPackage>true</RegisterOutputPackage>
<RegisterWithCodebase>true</RegisterWithCodebase>
View
6 MarkdownMode.sln
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownMode", "MarkdownMode.csproj", "{1017287A-83B1-41AB-BAC2-045AC45607C7}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpellChecker.Definitions", "Spellchecker\SpellChecker.Definitions\SpellChecker.Definitions.csproj", "{87D22AC6-424B-48DD-A5E8-DCB7CB3DDD63}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -13,6 +15,10 @@ Global
{1017287A-83B1-41AB-BAC2-045AC45607C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1017287A-83B1-41AB-BAC2-045AC45607C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1017287A-83B1-41AB-BAC2-045AC45607C7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {87D22AC6-424B-48DD-A5E8-DCB7CB3DDD63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {87D22AC6-424B-48DD-A5E8-DCB7CB3DDD63}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {87D22AC6-424B-48DD-A5E8-DCB7CB3DDD63}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {87D22AC6-424B-48DD-A5E8-DCB7CB3DDD63}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
40 SpellcheckSupport/MarkdownNaturalTextTagger.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using SpellChecker.Definitions;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Tagging;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MarkdownMode.SpellcheckSupport
+{
+ [Export(typeof(ITaggerProvider))]
+ [ContentType(ContentType.Name)]
+ [TagType(typeof(NaturalTextTag))]
+ class MarkdownNaturalTextTaggerProvider : ITaggerProvider
+ {
+ public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
+ {
+ return new MarkdownNaturalTextTagger() as ITagger<T>;
+ }
+ }
+
+ class MarkdownNaturalTextTagger : ITagger<NaturalTextTag>
+ {
+ public IEnumerable<ITagSpan<NaturalTextTag>> GetTags(NormalizedSnapshotSpanCollection spans)
+ {
+ foreach (var snapshotSpan in spans)
+ {
+ yield return new TagSpan<NaturalTextTag>(snapshotSpan, new NaturalTextTag());
+ }
+ }
+
+#pragma warning disable 67
+ public event EventHandler<SnapshotSpanEventArgs> TagsChanged;
+#pragma warning restore 67
+ }
+
+ class NaturalTextTag : INaturalTextTag { }
+}
2 Spellchecker
@@ -1 +1 @@
-Subproject commit 6c691a5617ef9e1a5955018dee285de6c06b3ee8
+Subproject commit 608154235e3221613c540e5c5368b0d37f5dba73

0 comments on commit 9a8449c

Please sign in to comment.