Nerzhul500 avatar Nerzhul500 committed b6e4404

Cosmetics.

Comments (0)

Files changed (13)

ReSpeller.Installer/Setup.wxs

   <Product Id="2857ED7D-CBCA-492C-9FC2-3ED93534DF19"
     Name="ReSpeller for ReSharper 7.0"
     Language="1033"
-    Version="2.0.1"
+    Version="2.0.3"
     UpgradeCode="A6DB0C4A-75BA-4EA4-8F9C-A9F89EDAFFF6"
     Manufacturer="Artem Bukhonov aka Nerzhul500">
 

ReSpeller/Bulbs/AdvancedTypoRenameBulbItem.cs

 using JetBrains.ReSharper.Refactorings.Rename;
 using JetBrains.ReSharper.Refactorings.Workflow;
 using JetBrains.TextControl;
+using ReSpeller.Util;
 using ReSpeller.Workflows;
 
 namespace ReSpeller.Bulbs
   class AdvancedTypoRenameBulbItem : IBulbItem
   {
     private readonly IDeclaredElement myElement;
-    private readonly Lazy<List<string>> mySuggestedNames; 
+    private readonly AsyncValue<List<string>> mySuggestedNames; 
 
-    public AdvancedTypoRenameBulbItem(IDeclaredElement element, Lazy<List<string>> suggestedNames)
+    public AdvancedTypoRenameBulbItem(IDeclaredElement element, AsyncValue<List<string>> suggestedNames)
     {
       myElement = element;
       mySuggestedNames = suggestedNames;

ReSpeller/Bulbs/TextRangeTypoReplaceBulbItem.cs

 using JetBrains.ReSharper.LiveTemplates;
 using JetBrains.TextControl;
 using JetBrains.Util;
+using ReSpeller.Util;
 
 namespace ReSpeller.Bulbs
 {
   class TextRangeTypoReplaceBulbItem : IBulbItem
   {
     private DocumentRange myRange;
-    private readonly Lazy<List<string>> mySuggestions;
+    private readonly AsyncValue<List<string>> mySuggestions;
 
-    public TextRangeTypoReplaceBulbItem(DocumentRange range, Lazy<List<string>> suggestions)
+    public TextRangeTypoReplaceBulbItem(DocumentRange range, AsyncValue<List<string>> suggestions)
     {
       myRange = range;
       mySuggestions = suggestions;

ReSpeller/Lazy.cs

-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace ReSpeller
-{
-    class Lazy<T>
-    {
-        private T myValue;
- 
-        private readonly ManualResetEvent myReset = new ManualResetEvent(false);
-
-        public Lazy(Func<T> evaluator)
-        {
-            new Thread(() => 
-                {
-                    myValue = evaluator();
-                    myReset.Set();
-                }).Start();
-        }
-
-        public T Value
-        {
-            get 
-            {
-                myReset.WaitOne();
-                return myValue;
-            }
-        }
-    }
-}

ReSpeller/Properties/AssemblyInfo.cs

 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 
-[assembly: AssemblyTitle("ReSpeller (beta)")]
+[assembly: AssemblyTitle("ReSpeller Beta")]
 [assembly: AssemblyDescription("Spell Checker for Resharper")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("Artem Bukhonov")]
 [assembly: AssemblyCopyright("Copyright © Artem Bukhonov, 2012")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("2.0.1.0")]
-[assembly: AssemblyFileVersion("2.0.1.0")]
+[assembly: AssemblyVersion("2.0.3.0")]
+[assembly: AssemblyFileVersion("2.0.3.0")]
 [assembly: ActionsXml("SpellCheckerPlugin.Actions.xml")]
 
 // The following information is displayed by ReSharper in the Plugins dialog
 
-[assembly: PluginTitle("Spell Checker for Resharper")]
+[assembly: PluginTitle("ReSpeller Beta")]
 [assembly:
   PluginDescription(
-    "Spell Checker for Resharper based on NHunspell library. Dictionaries taken from IntelliJ IDEA Community Edition repository"
+    "Spell Checker for Resharper based on NHunspell library. Dictionaries taken from IntelliJ IDEA Community Edition repository\n" +
+    "Special thanks to Dmitri Nesteruk, Matt Ellis and other ReSharper teammates, who helps me with developing\n" +
+    "Copyright © Artem Bukhonov, 2012"
     )]
 [assembly: PluginVendor("Artem Bukhonov")]
 [assembly:

ReSpeller/QuickFixes/TypoQuickFix.cs

 using ReSpeller.Bulbs;
 using ReSpeller.Highlightings;
 using ReSpeller.SpellEngine;
+using ReSpeller.Util;
 
 namespace ReSpeller.QuickFixes
 {
   [QuickFix]
-  class TypoQuickFix : IQuickFix
+  internal class TypoQuickFix : IQuickFix
   {
     private readonly ISpellChecker myChecker = Shell.Instance.GetComponent<ISpellChecker>();
     private readonly SuggestionGenerator mySuggestionGenerator = Shell.Instance.GetComponent<SuggestionGenerator>();
       myHighlighting = highlighting;
       string prefix;
       string suffix;
-        Lazy<List<string>> suggests = new Lazy<List<string>>(() =>
-                                              {
-                                                  List<TextPart> decomposedName = AnalyzerHelper.DecomposeName(highlighting.TreeNode, highlighting.Element, out prefix, out suffix);
-                                                  return mySuggestionGenerator.Generate(decomposedName, prefix, suffix);
-                                              });
+      AsyncValue<List<string>> suggests = new AsyncValue<List<string>>(() =>
+                                                             {
+                                                               List<TextPart> decomposedName =
+                                                                 AnalyzerHelper.DecomposeName(highlighting.TreeNode,
+                                                                                              highlighting.Element,
+                                                                                              out prefix, out suffix);
+                                                               return mySuggestionGenerator.Generate(decomposedName,
+                                                                                                     prefix, suffix);
+                                                             });
 
-        myBulbItems.Add(new AdvancedTypoRenameBulbItem(highlighting.Element, suggests));
+      myBulbItems.Add(new AdvancedTypoRenameBulbItem(highlighting.Element, suggests));
       string word = highlighting.WrongPart.Text;
       myBulbItems.Add(new AddToDictionaryBulbItem(word));
       myBulbItems.Add(new EditAddToDictionaryBulb(word));
       AddInternalDictionaryItemDebugOnly(word);
     }
 
-    public TypoQuickFix([NotNull]TextRangeTypoHighlighting highlighting)
+    public TypoQuickFix([NotNull] TextRangeTypoHighlighting highlighting)
     {
       myHighlighting = highlighting;
-        Lazy<List<string>> suggests = new Lazy<List<string>>(() => myChecker.Suggestions(highlighting.Range.GetText()));
+      AsyncValue<List<string>> suggests = new AsyncValue<List<string>>(() => myChecker.Suggestions(highlighting.Range.GetText()));
       myBulbItems.Add(new TextRangeTypoReplaceBulbItem(highlighting.Range, suggests));
       string word = highlighting.Range.GetText();
       myBulbItems.Add(new AddToDictionaryBulbItem(word));
     {
       return myHighlighting.IsValid();
     }
-
   }
-}
+}

ReSpeller/ReSpeller.csproj

     <Compile Include="Highlightings\TextRangeTypoHighlighting.cs" />
     <Compile Include="Highlightings\MarkupTextTypoHighlighting.cs" />
     <Compile Include="Img\ThemedIcons.Img.Generated.cs" />
-    <Compile Include="Lazy.cs" />
+    <Compile Include="Util\AsyncValue.cs" />
     <Compile Include="QuickFixes\TypoQuickFix.cs" />
     <Compile Include="Settings\ReSpellerSettings.cs" />
     <Compile Include="Settings\ReSpellerSettingsControl.xaml.cs">
     <Compile Include="SpellEngine\SuggestionGenerator.cs" />
     <Compile Include="SpellEngine\TextSplitter.cs" />
     <Compile Include="SpellEngine\Dictionaries\UserInternalDictionary.cs" />
-    <Compile Include="Util.cs" />
+    <Compile Include="Util\Util.cs" />
     <Compile Include="Workflows\ReflectionUtils.cs" />
     <Compile Include="Workflows\RenameNamespaceControlDecorator.cs" />
     <Compile Include="Workflows\RenameNamespaceWorkflowDecorator.cs" />
     </Content>
     <ThemedIconPng Include="Img\icon.png" />
   </ItemGroup>
+  <ItemGroup />
   <PropertyGroup>
-    <ReSharperSdkTargets Condition=" '$(ReSharperSdkTargets)' == '' ">$(MSBuildExtensionsPath)\JetBrains\ReSharper.SDK\v7.1</ReSharperSdkTargets>
+    <ReSharperSdkTargets Condition=" '$(ReSharperSdkTargets)' == '' ">$(MSBuildExtensionsPath)\JetBrains\ReSharper.SDK\v7.0</ReSharperSdkTargets>
   </PropertyGroup>
   <Import Project="$(ReSharperSdkTargets)\Plugin.Targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

ReSpeller/Settings/ReSpellerSettingsControl.xaml

             <Label>Minimum word length to check:</Label>
             <xctk:IntegerUpDown Name="MinWordLengthUpDown" DefaultValue="4" Value="4" Minimum="1" Maximum="10" ></xctk:IntegerUpDown>
         </StackPanel>
+        <GroupBox Header="Directories">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="Auto" />
+                    <ColumnDefinition Width="*" />
+                </Grid.ColumnDefinitions>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto" />
+                    <RowDefinition Height="Auto" />
+                    <RowDefinition Height="Auto" />
+                </Grid.RowDefinitions>
+                <Label Grid.Row="0" Grid.Column="0" Content="Install path:"/>
+                <Label Grid.Row="1" Grid.Column="0" Content="Dictionaries path:"/>
+                <Label Grid.Row="2" Grid.Column="0" Content="User dictionaries:"/>
+                <TextBox Grid.Column="1" Grid.Row="0" Margin="3" Name="InstallPathBox" IsReadOnly="True"/>
+                <TextBox Grid.Column="1" Grid.Row="1" Margin="3" Name="DictionaryPathBox" IsReadOnly="True"/>
+                <TextBox Grid.Column="1" Grid.Row="2" Margin="3" Name="UserDictionaryPathBox" IsReadOnly="True"/>
+            </Grid>
+            
+            
+        </GroupBox>
+
     </StackPanel>
 </UserControl>

ReSpeller/Settings/ReSpellerSettingsControl.xaml.cs

       InitializeComponent();
       store.SetBinding(lifetime, (ReSpellerSettings s) => (bool?)s.SplitInPairs, SplitInPairsCheckBox, ToggleButton.IsCheckedProperty);
       store.SetBinding(lifetime, (ReSpellerSettings s) => (int?)s.MinWordLength, MinWordLengthUpDown, IntegerUpDown.ValueProperty);
+      InstallPathBox.Text = Constants.PluginPath;
+      DictionaryPathBox.Text = Constants.MainDictDir;
+      UserDictionaryPathBox.Text = Constants.UserDictDir;
     }
 
     public bool OnOk()

ReSpeller/SpellEngine/Constants.cs

     public const string UserDictSubDir = "ReSpeller";
     public const string HunspellAffixExt = "aff";
     public const string HunspellDictExt = "dic";
-    public static readonly string PluginPath = Path.GetDirectoryName(Assembly.GetAssembly(typeof (ISpellChecker)).Location);
+    public static readonly string PluginPath = Path.GetDirectoryName(Assembly.GetAssembly(typeof (Constants)).Location);
     public static readonly string MainDictDir = Path.Combine(PluginPath, MainDictSubDir);
     public static readonly string UserDictDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), UserDictSubDir);
   }

ReSpeller/Util.cs

-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace ReSpeller
-{
-  public static class Util
-  {
-    public static string F(this string s, params object[] args)
-    {
-      return string.Format(s, args);
-    }
-  }
-}

ReSpeller/Util/AsyncValue.cs

+using System;
+using System.Threading;
+
+namespace ReSpeller.Util
+{
+    class AsyncValue<T>
+    {
+        private T myValue;
+ 
+        private readonly ManualResetEvent myReset = new ManualResetEvent(false);
+
+        public AsyncValue(Func<T> evaluator)
+        {
+            new Thread(() => 
+                {
+                    myValue = evaluator();
+                    myReset.Set();
+                }).Start();
+        }
+
+        public T Value
+        {
+            get 
+            {
+                myReset.WaitOne();
+                return myValue;
+            }
+        }
+    }
+}

ReSpeller/Util/Util.cs

+namespace ReSpeller.Util
+{
+  public static class Util
+  {
+    public static string F(this string s, params object[] args)
+    {
+      return string.Format(s, args);
+    }
+  }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.