├── .gitattributes ├── .gitignore ├── CodicExtension.sln ├── CodicExtension ├── CodicExtension.csproj ├── CodicExtension.ruleset ├── CodicExtensionPackage.cs ├── CodicExtensionPackage.vsct ├── ExtensionMethods.cs ├── Global.cs ├── Guids.cs ├── Model │ ├── ApiException.cs │ ├── CodicApi.cs │ ├── LetterCase.cs │ ├── Project.cs │ ├── Translation.cs │ ├── TranslationResult.cs │ ├── Utils.cs │ └── Word.cs ├── NativeMethods.cs ├── Presentation │ ├── QuickLookDialog.xaml │ └── QuickLookDialog.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── CodicExtensionPackage.png │ ├── MenuIcon.png │ ├── Screenshot.png │ └── _MenuIcon.png ├── Settings.cs ├── Settings │ ├── Options.cs │ ├── OptionsPage.Designer.cs │ ├── OptionsPage.cs │ ├── OptionsPageControl.Designer.cs │ ├── OptionsPageControl.cs │ ├── OptionsPageControl.resx │ └── SerializableStringDictionary.cs ├── Themes │ ├── Generic.xaml │ └── Styles.xaml ├── VSPackage.Designer.cs ├── VSPackage.resx ├── app.config └── source.extension.vsixmanifest ├── MigrationBackup └── 6fef1710 │ └── CodicExtension │ ├── CodicExtension.csproj │ ├── NuGetUpgradeLog.html │ └── packages.config └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.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 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /CodicExtension.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32210.238 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodicExtension", "CodicExtension\CodicExtension.csproj", "{361CC716-811B-414B-BC78-3074212CDAB2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug 2012|Any CPU = Debug 2012|Any CPU 11 | Debug 2013|Any CPU = Debug 2013|Any CPU 12 | Debug 2015|Any CPU = Debug 2015|Any CPU 13 | Debug 2017|Any CPU = Debug 2017|Any CPU 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2012|Any CPU.ActiveCfg = Debug 2012|Any CPU 19 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2012|Any CPU.Build.0 = Debug 2012|Any CPU 20 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2013|Any CPU.ActiveCfg = Debug 2013|Any CPU 21 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2013|Any CPU.Build.0 = Debug 2013|Any CPU 22 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2015|Any CPU.ActiveCfg = Debug 2015|Any CPU 23 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2015|Any CPU.Build.0 = Debug 2015|Any CPU 24 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2017|Any CPU.ActiveCfg = Debug 2018|Any CPU 25 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug 2017|Any CPU.Build.0 = Debug 2018|Any CPU 26 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {361CC716-811B-414B-BC78-3074212CDAB2}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {361CC716-811B-414B-BC78-3074212CDAB2}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {361CC716-811B-414B-BC78-3074212CDAB2}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {87C690BA-43F8-44A1-8A64-45AC6E8A823A} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /CodicExtension/CodicExtension.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | true 9 | 10 | 11 | 12 | 13 | 14.0 14 | publish\ 15 | true 16 | Disk 17 | false 18 | Foreground 19 | 7 20 | Days 21 | false 22 | false 23 | true 24 | 0 25 | 1.0.0.%2a 26 | false 27 | false 28 | true 29 | 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 37 | 38 | 39 | true 40 | bin\Debug 2012\ 41 | DEBUG;TRACE 42 | full 43 | AnyCPU 44 | prompt 45 | CodicExtension.ruleset 46 | False 47 | 48 | 49 | bin\Debug 2018\ 50 | AnyCPU 51 | False 52 | 53 | 54 | bin\Debug 2015\ 55 | AnyCPU 56 | False 57 | 58 | 59 | bin\Debug 2013\ 60 | AnyCPU 61 | False 62 | 63 | 64 | true 65 | bin\x64\Debug 2012\ 66 | DEBUG;TRACE 67 | full 68 | x64 69 | 7.3 70 | prompt 71 | CodicExtension.ruleset 72 | 73 | 74 | bin\x64\Debug 2018\ 75 | x64 76 | 7.3 77 | 78 | 79 | bin\x64\Debug 2015\ 80 | x64 81 | 7.3 82 | 83 | 84 | bin\x64\Debug 2013\ 85 | x64 86 | 7.3 87 | 88 | 89 | true 90 | bin\x64\Debug\ 91 | DEBUG;TRACE 92 | full 93 | x64 94 | 7.3 95 | prompt 96 | CodicExtension.ruleset 97 | 98 | 99 | bin\x64\Release\ 100 | TRACE 101 | true 102 | pdbonly 103 | x64 104 | 7.3 105 | prompt 106 | CodicExtension.ruleset 107 | 108 | 109 | 110 | Debug 111 | AnyCPU 112 | 2.0 113 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 114 | {361CC716-811B-414B-BC78-3074212CDAB2} 115 | Library 116 | Properties 117 | CodicExtension 118 | CodicExtension 119 | v4.7.2 120 | true 121 | true 122 | true 123 | true 124 | true 125 | false 126 | 127 | 128 | true 129 | full 130 | false 131 | bin\Debug\ 132 | DEBUG;TRACE 133 | prompt 134 | 4 135 | True 136 | True 137 | CodicExtension.ruleset 138 | AnyCPU 139 | False 140 | 141 | 142 | pdbonly 143 | true 144 | bin\Release\ 145 | TRACE 146 | prompt 147 | 4 148 | CodicExtension.ruleset 149 | AnyCPU 150 | False 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | QuickLookDialog.xaml 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | True 171 | True 172 | Settings.settings 173 | 174 | 175 | 176 | 177 | Component 178 | 179 | 180 | OptionsPage.cs 181 | 182 | 183 | UserControl 184 | 185 | 186 | OptionsPageControl.cs 187 | 188 | 189 | 190 | 191 | True 192 | True 193 | VSPackage.resx 194 | 195 | 196 | 197 | 198 | 199 | 200 | SettingsSingleFileGenerator 201 | Settings.Designer.cs 202 | 203 | 204 | Designer 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | Menus.ctmenu 223 | Designer 224 | 225 | 226 | 227 | 228 | OptionsPageControl.cs 229 | 230 | 231 | true 232 | VSPackage 233 | Designer 234 | ResXFileCodeGenerator 235 | VSPackage.Designer.cs 236 | 237 | 238 | 239 | 240 | Always 241 | true 242 | 243 | 244 | 245 | 246 | Always 247 | true 248 | 249 | 250 | 251 | 252 | MSBuild:Compile 253 | Designer 254 | 255 | 256 | MSBuild:Compile 257 | Designer 258 | 259 | 260 | MSBuild:Compile 261 | Designer 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | False 270 | .NET Framework 3.5 SP1 271 | false 272 | 273 | 274 | 275 | 276 | 17.1.32210.191 277 | 278 | 279 | 17.1.4054 280 | runtime; build; native; contentfiles; analyzers; buildtransitive 281 | all 282 | 283 | 284 | 13.0.1 285 | 286 | 287 | 2.2.5 288 | 289 | 290 | 2.2.5 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 305 | -------------------------------------------------------------------------------- /CodicExtension/CodicExtension.ruleset: -------------------------------------------------------------------------------- 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 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /CodicExtension/CodicExtensionPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Editor; 5 | using Microsoft.VisualStudio.Shell; 6 | using Microsoft.VisualStudio.Shell.Interop; 7 | using Microsoft.VisualStudio.Text; 8 | using Microsoft.VisualStudio.Text.Editor; 9 | using Microsoft.VisualStudio.TextManager.Interop; 10 | using CodicExtension.Presentation; 11 | using CodicExtension.Settings; 12 | using System.Windows; 13 | using System.Windows.Threading; 14 | using System.IO; 15 | using CodicExtension.Model; 16 | using System.Threading.Tasks; 17 | using System.Threading; 18 | using Microsoft.VisualStudio; 19 | 20 | namespace CodicExtension 21 | { 22 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 23 | [ProvideOptionPage(typeof(OptionsPage), "CodicExtension", "Options", 110, 111, true)] 24 | [ProvideProfile(typeof(OptionsPage), "CodicExtension", "Options", 110, 111, true, DescriptionResourceID = 110)] 25 | 26 | [ProvideMenuResource("Menus.ctmenu", 1)] 27 | [Guid(Guids.CodicExtensionPackageGuid)] 28 | [ProvideService(typeof(CodicExtensionPackage), IsAsyncQueryable = true)] 29 | //https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration 30 | //https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-asyncpackage-to-load-vspackages-in-the-background?view=vs-2019 31 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)] 32 | 33 | //[ProvideAutoLoad(UIContextGuids80.CodeWindow)] 34 | //[ProvideAutoLoad(UIContextGuids80.SolutionExists)] 35 | public sealed class CodicExtensionPackage : AsyncPackage 36 | { 37 | /// 38 | /// This read-only property returns the package instance 39 | /// 40 | internal static CodicExtensionPackage Instance { get; private set; } 41 | 42 | private static Dispatcher _dispatcher; 43 | 44 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 45 | { 46 | Instance = this; 47 | _dispatcher = Dispatcher.CurrentDispatcher; 48 | 49 | //await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 50 | await ThreadHelper.JoinableTaskFactory.RunAsync(async delegate 51 | { 52 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 53 | var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 54 | if (null != mcs) 55 | { 56 | // Create the command for the menu item. 57 | var generateCommandId = new CommandID(Guids.guidTranslatorCmdSet, (int)Guids.GenerationCmdId); 58 | var menuItemTranslate = new OleMenuCommand(GenerateMenu_Clicked, generateCommandId); 59 | menuItemTranslate.BeforeQueryStatus += MenuItemTranslateOnBeforeQueryStatus; 60 | mcs.AddCommand(menuItemTranslate); 61 | } 62 | }); 63 | } 64 | 65 | private void MenuItemTranslateOnBeforeQueryStatus(object sender, EventArgs eventArgs) 66 | { 67 | var oleMenuCommand = sender as OleMenuCommand; 68 | if (oleMenuCommand != null) 69 | { 70 | oleMenuCommand.Enabled = true; 71 | //oleMenuCommand.Text = "Generate Naming"; 72 | oleMenuCommand.Text = "codic: ネーミングを生成"; 73 | var view = GetActiveTextView(); 74 | if (view != null) 75 | { 76 | if (view.Selection != null && !view.Selection.IsEmpty) 77 | { 78 | var span = view.Selection.SelectedSpans[0]; 79 | var selectedText = span.GetText(); 80 | //oleMenuCommand.Text = string.Format("Generate Naming for '{0}'", selectedText.Truncate(26)); 81 | oleMenuCommand.Text = string.Format("codic: '{0}'のネーミングを生成", selectedText.Truncate(26)); 82 | } 83 | } else 84 | { 85 | oleMenuCommand.Enabled = false; 86 | } 87 | } 88 | } 89 | 90 | protected override void Dispose(bool disposing) 91 | { 92 | Instance = null; 93 | base.Dispose(disposing); 94 | } 95 | 96 | public static ITextDocument GetTextDocument(ITextBuffer TextBuffer) 97 | { 98 | ITextDocument textDoc; 99 | var rc = TextBuffer.Properties.TryGetProperty( 100 | typeof(ITextDocument), out textDoc); 101 | if (rc == true) 102 | return textDoc; 103 | else 104 | return null; 105 | } 106 | 107 | private IWpfTextView GetActiveTextView() 108 | { 109 | IVsTextView vTextView = null; 110 | 111 | IVsTextManager txtMgr = (IVsTextManager)GetService(typeof(SVsTextManager)); 112 | txtMgr.GetActiveView(1, null, out vTextView); 113 | 114 | var userData = vTextView as IVsUserData; 115 | if (null == userData) return null; 116 | 117 | object holder; 118 | var guidViewHost = DefGuidList.guidIWpfTextViewHost; 119 | userData.GetData(ref guidViewHost, out holder); 120 | var viewHost = (IWpfTextViewHost)holder; 121 | 122 | return viewHost.TextView; 123 | } 124 | 125 | /// 126 | /// This function is the callback used to execute a command when the a menu item is clicked. 127 | /// See the Initialize method to see how the menu item is associated to this function using 128 | /// the OleMenuCommandService service and the MenuCommand class. 129 | /// 130 | private void GenerateMenu_Clicked(object sender, EventArgs e) 131 | { 132 | Console.WriteLine("#GenerateMenu_Clicked"); 133 | var props = Properties.Settings.Default; 134 | IWpfTextView view = GetActiveTextView(); 135 | 136 | ITextSelection selection = view.Selection; 137 | if (selection != null) 138 | { 139 | // Get extension of active document. 140 | String fileType = "_default_"; 141 | var textDoc = GetTextDocument(view.TextBuffer); 142 | if (textDoc != null) 143 | { 144 | fileType = Path.GetExtension(textDoc.FilePath).ToLower(); 145 | } 146 | 147 | LetterCase letterCase = LetterCase.ValueOf(props.LetterCaseConvention[fileType], 148 | LetterCase.Enumulate()[0]); 149 | 150 | // Get selection in view. 151 | SnapshotSpan span = view.Selection.SelectedSpans[0]; 152 | var selectedText = span.GetText(); 153 | //if (string.IsNullOrEmpty(selectedText)) 154 | //{ 155 | //ITextSnapshotLine line = span.Start.GetContainingLine(); 156 | //selectedText = span.Start.GetContainingLine().GetText(); 157 | //view.Selection.Select(new SnapshotSpan(line.Start, line.End), false); 158 | //} 159 | 160 | ITrackingSpan trackingSpan = span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive); 161 | QuickLookDialog dialog = new QuickLookDialog(); 162 | Console.WriteLine("#GenerateMenu_Clicked > SetDialogPosition"); 163 | SetDialogPosition(view, dialog); 164 | dialog.SetText(selectedText); 165 | dialog.Selected += (sender2, args) => { 166 | ThreadHelper.JoinableTaskFactory.Run(async delegate { 167 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 168 | var buffer = trackingSpan.TextBuffer; 169 | Span sp = trackingSpan.GetSpan(buffer.CurrentSnapshot); 170 | buffer.Replace(sp, (string)args.Selection); 171 | }); 172 | //_dispatcher.Invoke(new Action(() => { 173 | // var buffer = trackingSpan.TextBuffer; 174 | //Span sp = trackingSpan.GetSpan(buffer.CurrentSnapshot); 175 | //buffer.Replace(sp, (string)args.Selection); 176 | //})); 177 | 178 | }; 179 | dialog.LetterCaseChanged += (sender2, args) => { 180 | if (props.LetterCaseConvention.ContainsKey(fileType)) 181 | props.LetterCaseConvention.Remove(fileType); 182 | if (args.Selection != null) 183 | { 184 | props.LetterCaseConvention.Add(fileType, args.Selection.Id); 185 | props.Save(); 186 | } 187 | }; 188 | Console.WriteLine("#GenerateMenu_Clicked > dialog.ShowModeless"); 189 | dialog.ShowModeless(letterCase); 190 | } 191 | } 192 | 193 | private void SetDialogPosition(IWpfTextView _view, QuickLookDialog dialog) 194 | { 195 | SnapshotSpan span = _view.Selection.SelectedSpans[0]; 196 | 197 | var textViewOrigin = (_view as System.Windows.UIElement).PointToScreen(new Point(0, 0)); 198 | 199 | var caretPos = _view.Selection.Start.Position; 200 | var charBounds = _view 201 | .GetTextViewLineContainingBufferPosition(caretPos) 202 | .GetCharacterBounds(caretPos); 203 | double textBottom = charBounds.Bottom; 204 | double textX = charBounds.Left; 205 | 206 | double newLeft = textViewOrigin.X + textX - _view.ViewportLeft; 207 | double newTop = textViewOrigin.Y + textBottom - _view.ViewportTop; 208 | 209 | dialog.Left = newLeft; 210 | dialog.Top = newTop; 211 | } 212 | } 213 | } -------------------------------------------------------------------------------- /CodicExtension/CodicExtensionPackage.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 58 | 59 | 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 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /CodicExtension/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using Microsoft.VisualStudio; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | 6 | namespace CodicExtension 7 | { 8 | internal static class StringExtensions 9 | { 10 | public static string Truncate(this string value, int maxChars, string postfix = "...") 11 | { 12 | if (string.IsNullOrEmpty(value)) 13 | return value; 14 | var result = value.Length <= maxChars ? value : value.Substring(0, maxChars) + postfix; 15 | result = result.Replace(Environment.NewLine, ""); 16 | return result; 17 | } 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /CodicExtension/Global.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using CodicExtension.Settings; 3 | 4 | namespace CodicExtension 5 | { 6 | static class Global 7 | { 8 | public static DTE DTE = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as DTE; 9 | }; 10 | } -------------------------------------------------------------------------------- /CodicExtension/Guids.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CodicExtension 4 | { 5 | static class Guids 6 | { 7 | public const string CodicExtensionPackageGuid = "CA4CB80A-0216-469E-96AB-80BCA7CAB81F"; 8 | 9 | public const string CodicCmdSetGuid = "90EB4DF8-E82B-4712-9CEA-FAC9F711783C"; 10 | 11 | public const string OptionsPageGuid = "24AA7F7D-B85E-4076-876D-817DEA5E9300"; 12 | 13 | public static readonly Guid guidTranslatorCmdSet = new Guid(CodicCmdSetGuid); 14 | 15 | public const uint GenerationCmdId = 0x100; 16 | }; 17 | } -------------------------------------------------------------------------------- /CodicExtension/Model/ApiException.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | 4 | namespace CodicExtension.Model 5 | { 6 | public class ApiException : Exception 7 | { 8 | private int Code { get; } 9 | 10 | public ApiException(int code, String message) : base(message) 11 | { 12 | this.Code = code; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /CodicExtension/Model/CodicApi.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Newtonsoft.Json.Linq; 4 | using System.Linq; 5 | using System.Net; 6 | using System.IO; 7 | using System.Text; 8 | using System.Diagnostics; 9 | 10 | namespace CodicExtension.Model 11 | { 12 | public class CodicApi 13 | { 14 | 15 | public CodicApi() 16 | { 17 | 18 | } 19 | 20 | 21 | public async Task> GetUserProjectsAsync(string accessToken) 22 | { 23 | var data = Utils.BuildQuerystring(new Dictionary()); 24 | 25 | JArray json = await PostJsonArrayAsync(accessToken, 26 | "https://api.codic.jp/v1/user_projects.json", data); 27 | 28 | List projects = new List(); 29 | foreach (JToken projectToken in json) { 30 | var project = new Project(); 31 | project.Id = projectToken["id"].ToString(); 32 | project.Name = projectToken["name"].ToString(); 33 | projects.Add(project); 34 | } 35 | 36 | return projects; 37 | } 38 | 39 | public Task TranslateAsync(string accessToken, string projectId, string text) 40 | { 41 | return TranslateAsync(accessToken, projectId, text, null); 42 | } 43 | 44 | public async Task TranslateAsync(string accessToken, string projectId, string text, string letterCase) 45 | { 46 | var data = Utils.BuildQuerystring(new Dictionary() 47 | { 48 | { "text", text}, 49 | { "project_id", projectId}, 50 | { "casing", letterCase} 51 | }); 52 | 53 | JArray json = await PostJsonArrayAsync(accessToken, 54 | "https://api.codic.jp/v1.1/engine/translate.json", data); 55 | 56 | TranslationResult result = new TranslationResult(); 57 | List translations = new List(); 58 | foreach (JToken translationToken in json) 59 | { 60 | var translation = new Translation(); 61 | translation.TranslatedText = translationToken["translated_text_in_casing"].ToString(); 62 | List words = new List(); 63 | foreach (JToken wordToken in translationToken["words"]) { 64 | Word word = new Word(); 65 | List candidates = new List(); 66 | foreach (JToken candidateToken in wordToken["candidates"]) 67 | { 68 | candidates.Add(candidateToken["text_in_casing"].ToString()); 69 | } 70 | word.Successful = wordToken["successful"].ToObject(); 71 | word.Candidates = candidates; 72 | words.Add(word); 73 | } 74 | translation.Words = words; 75 | translations.Add(translation); 76 | } 77 | 78 | result.Translations = translations; 79 | return result; 80 | } 81 | 82 | private async Task PostJsonArrayAsync(string accessToken, string url, string data) 83 | { 84 | var client = new ConfigurableClient(); 85 | client.Proxy = null; 86 | client.Timeout = 1000; 87 | client.Headers.Add("User-Agent", "Codic VS Extension/1.0"); 88 | client.Headers.Add("Pragma", "no-cache"); 89 | client.Headers.Add("Authorization", "Bearer " + accessToken); 90 | client.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); 91 | 92 | try 93 | { 94 | Debug.WriteLine("Request : " + url + "?" + data); 95 | byte[] rawData = await client.UploadDataTaskAsync(url, Encoding.UTF8.GetBytes(data)); 96 | return JArray.Parse(Encoding.UTF8.GetString(rawData)); 97 | //return Encoding.UTF8.GetString(rawData); 98 | } 99 | catch (WebException e) 100 | { 101 | var responseStream = e.Response.GetResponseStream(); 102 | string responseText = null; 103 | using (var reader = new StreamReader(responseStream)) 104 | { 105 | responseText = await reader.ReadToEndAsync(); 106 | } 107 | JObject json = JObject.Parse(responseText); 108 | JToken error = json["errors"].Children().First(); 109 | throw new ApiException(int.Parse(error["code"].ToString()), error["message"].ToString()); 110 | } 111 | } 112 | } 113 | 114 | 115 | } -------------------------------------------------------------------------------- /CodicExtension/Model/LetterCase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CodicExtension.Model 4 | { 5 | public class LetterCase 6 | { 7 | public string Id { get; } 8 | public string Name { get; } 9 | public string ShortName { get; } 10 | 11 | private static LetterCase[] ENTRIES = { 12 | new LetterCase("pascal", "PascalCase", "Aa"), 13 | new LetterCase("camel", "camelCase", "aA"), 14 | new LetterCase("lower underscore", "snake_case (小文字)", "a_a"), 15 | new LetterCase("upper underscore", "SNAKE_CASE (大文字)", "A_A"), 16 | new LetterCase("hyphen", "ハイフネーション", "a-a"), 17 | new LetterCase("", "変換なし", "a a"), 18 | }; 19 | 20 | public static LetterCase[] Enumulate() 21 | { 22 | return ENTRIES; 23 | } 24 | 25 | public static LetterCase ValueOf(string id, LetterCase default_) 26 | { 27 | for (int i = 0; i < ENTRIES.Length; i++) 28 | { 29 | if (ENTRIES[i].Id.Equals(id)) 30 | { 31 | return ENTRIES[i]; 32 | } 33 | } 34 | return default_; 35 | } 36 | 37 | private LetterCase(string id, string name, string shortName) 38 | { 39 | this.Id = id; 40 | this.Name = name; 41 | this.ShortName = shortName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CodicExtension/Model/Project.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace CodicExtension.Model 4 | { 5 | public class Project 6 | { 7 | public string Name { get; set; } 8 | public string Id { get; set; } 9 | 10 | public Project() 11 | { 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CodicExtension/Model/Translation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace CodicExtension.Model 7 | { 8 | public class Translation 9 | { 10 | public string TranslatedText { get; set; } 11 | public List Words { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /CodicExtension/Model/TranslationResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace CodicExtension.Model 5 | { 6 | public class TranslationResult 7 | { 8 | public List Translations { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /CodicExtension/Model/Utils.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Net; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Web; 9 | 10 | namespace CodicExtension.Model 11 | { 12 | internal static class Utils 13 | { 14 | public static string GetHttpResponse(string url, string data) 15 | { 16 | WebClient client = new WebClient(); 17 | client.Headers.Add("user-agent", "User-Agent: Mozilla/5.0"); 18 | client.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); 19 | byte[] rawData = client.UploadData(url, Encoding.UTF8.GetBytes(data)); 20 | return Encoding.UTF8.GetString(rawData); 21 | } 22 | 23 | 24 | 25 | 26 | public static async Task GetHttpResponseAsync(string url, string data) 27 | { 28 | var client = new WebClient(); 29 | client.Headers.Add("user-agent", "User-Agent: Mozilla/5.0"); 30 | client.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); 31 | byte[] rawData = await client.UploadDataTaskAsync(url, Encoding.UTF8.GetBytes(data)); 32 | return Encoding.UTF8.GetString(rawData); 33 | } 34 | 35 | public static string BuildQuerystring(Dictionary args) 36 | { 37 | StringBuilder sb = new StringBuilder(); 38 | foreach (string name in args.Keys) 39 | { 40 | sb.Append(HttpUtility.UrlEncode(name)); 41 | sb.Append("="); 42 | sb.Append(HttpUtility.UrlEncode(args[name])); 43 | sb.Append("&"); 44 | } 45 | return sb.ToString(0, Math.Max(sb.Length - 1, 0)); 46 | } 47 | 48 | 49 | } 50 | 51 | internal class ConfigurableClient : WebClient 52 | { 53 | public int Timeout { get; set; } 54 | 55 | protected override WebRequest GetWebRequest(Uri uri) 56 | { 57 | WebRequest w = base.GetWebRequest(uri); 58 | w.Timeout = Timeout; 59 | return w; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /CodicExtension/Model/Word.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace CodicExtension.Model 7 | { 8 | public class Word 9 | { 10 | public string TranslatedText { get; set; } 11 | public bool Successful { get; set; } 12 | public List Candidates { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /CodicExtension/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace CodicExtension 9 | { 10 | class WindowHandleConstans 11 | { 12 | public const int WH_MOUSE = 7; 13 | } 14 | 15 | 16 | public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); 17 | 18 | [StructLayout(LayoutKind.Sequential)] 19 | public class POINT 20 | { 21 | public int x; 22 | public int y; 23 | } 24 | 25 | [StructLayout(LayoutKind.Sequential)] 26 | public class MouseHookStruct 27 | { 28 | public POINT pt; 29 | public int hwnd; 30 | public int wHitTestCode; 31 | public int dwExtraInfo; 32 | } 33 | 34 | enum MouseMessages 35 | { 36 | WM_LBUTTONDOWN = 0x0201, 37 | WM_LBUTTONUP = 0x0202, 38 | WM_MOUSEMOVE = 0x0200, 39 | WM_MOUSEWHEEL = 0x020A, 40 | WM_RBUTTONDOWN = 0x0204, 41 | WM_RBUTTONUP = 0x0205, 42 | WM_NCMOUSEMOVE = 0x0A0, 43 | WM_NCLBUTTONDOWN = 0x00A1, 44 | WM_NCLBUTTONUP = 0x00A2 45 | } 46 | 47 | class NativeMethods 48 | { 49 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 50 | public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); 51 | 52 | [DllImport("user32.dll", CharSet = CharSet.Auto, 53 | CallingConvention = CallingConvention.StdCall)] 54 | public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, IntPtr threadId); 55 | 56 | [DllImport("user32.dll", CharSet = CharSet.Auto, 57 | CallingConvention = CallingConvention.StdCall)] 58 | public static extern bool UnhookWindowsHookEx(int idHook); 59 | 60 | [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] 61 | public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam); 62 | 63 | [DllImport("kernel32.dll")] 64 | public static extern IntPtr GetCurrentThreadId(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /CodicExtension/Presentation/QuickLookDialog.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 21 | 22 | 25 | 26 | 31 | 32 | 38 | 39 | 42 | 43 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | 71 | 72 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 170 | 171 | 177 | 178 | 179 | 182 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 203 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 213 | 215 | 216 | 217 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 234 | 235 | 236 | 237 | 238 | 239 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 264 | 265 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 137 | --> 138 | 139 | 245 | 246 | -------------------------------------------------------------------------------- /CodicExtension/Themes/Styles.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 10 | 11 | 301 | 302 | -------------------------------------------------------------------------------- /CodicExtension/VSPackage.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CodicExtension { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class VSPackage { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal VSPackage() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodicExtension.VSPackage", typeof(VSPackage).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Codic 拡張 に類似しているローカライズされた文字列を検索します。 65 | /// 66 | internal static string _110 { 67 | get { 68 | return ResourceManager.GetString("110", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Options に類似しているローカライズされた文字列を検索します。 74 | /// 75 | internal static string _111 { 76 | get { 77 | return ResourceManager.GetString("111", resourceCulture); 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /CodicExtension/VSPackage.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 | Codic 拡張 122 | 123 | 124 | Options 125 | 126 | -------------------------------------------------------------------------------- /CodicExtension/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 | 300 28 | 29 | 30 | 200 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /CodicExtension/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | Codic Extension 2022 7 | Codic Extension for Visual Studio 2022 8 | https://github.com/codic-project/codic-vs-extension 9 | https://github.com/codic-project/codic-vs-extension 10 | https://github.com/codic-project/codic-vs-extension 11 | Resources\CodicExtensionPackage.png 12 | Resources\Screenshot.png 13 | translator, translate, localize, naming, english 14 | 15 | 16 | 17 | amd64 18 | 19 | 20 | amd64 21 | 22 | 23 | amd64 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /MigrationBackup/6fef1710/CodicExtension/CodicExtension.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 15.0 6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 7 | 8 | 9 | true 10 | 11 | 12 | 13 | 14 | 14.0 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 37 | 38 | 39 | true 40 | bin\Debug 2012\ 41 | DEBUG;TRACE 42 | full 43 | AnyCPU 44 | prompt 45 | CodicExtension.ruleset 46 | 47 | 48 | bin\Debug 2018\ 49 | 50 | 51 | bin\Debug 2015\ 52 | AnyCPU 53 | 54 | 55 | bin\Debug 2013\ 56 | AnyCPU 57 | 58 | 59 | 60 | Debug 61 | AnyCPU 62 | 2.0 63 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 64 | {361CC716-811B-414B-BC78-3074212CDAB2} 65 | Library 66 | Properties 67 | CodicExtension 68 | CodicExtension 69 | v4.5 70 | true 71 | true 72 | true 73 | true 74 | true 75 | false 76 | 77 | 78 | true 79 | full 80 | false 81 | bin\Debug\ 82 | DEBUG;TRACE 83 | prompt 84 | 4 85 | True 86 | True 87 | CodicExtension.ruleset 88 | 89 | 90 | pdbonly 91 | true 92 | bin\Release\ 93 | TRACE 94 | prompt 95 | 4 96 | CodicExtension.ruleset 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | QuickLookDialog.xaml 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | True 117 | True 118 | Settings.settings 119 | 120 | 121 | 122 | 123 | Component 124 | 125 | 126 | OptionsPage.cs 127 | 128 | 129 | UserControl 130 | 131 | 132 | OptionsPageControl.cs 133 | 134 | 135 | 136 | 137 | True 138 | True 139 | VSPackage.resx 140 | 141 | 142 | 143 | 144 | 145 | 146 | Designer 147 | 148 | 149 | SettingsSingleFileGenerator 150 | Settings.Designer.cs 151 | 152 | 153 | Designer 154 | 155 | 156 | 157 | 158 | False 159 | ..\packages\VSSDK.DTE.7.0.4\lib\net20\envdte.dll 160 | True 161 | 162 | 163 | 164 | ..\packages\VSSDK.CoreUtility.12.0.4\lib\net45\Microsoft.VisualStudio.CoreUtility.dll 165 | True 166 | 167 | 168 | ..\packages\VSSDK.Editor.12.0.4\lib\net45\Microsoft.VisualStudio.Editor.dll 169 | True 170 | 171 | 172 | ..\packages\VSSDK.GraphModel.11.0.4\lib\net45\Microsoft.VisualStudio.GraphModel.dll 173 | False 174 | 175 | 176 | ..\packages\VSSDK.OLE.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.OLE.Interop.dll 177 | True 178 | False 179 | 180 | 181 | ..\packages\VSSDK.Shell.12.12.0.4\lib\net45\Microsoft.VisualStudio.Shell.12.0.dll 182 | True 183 | 184 | 185 | ..\packages\VSSDK.Shell.Immutable.10.10.0.4\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll 186 | True 187 | False 188 | 189 | 190 | ..\packages\VSSDK.Shell.Immutable.11.11.0.4\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll 191 | True 192 | False 193 | 194 | 195 | ..\packages\VSSDK.Shell.Immutable.12.12.0.4\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll 196 | True 197 | False 198 | 199 | 200 | ..\packages\VSSDK.Shell.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.Shell.Interop.dll 201 | True 202 | False 203 | 204 | 205 | ..\packages\VSSDK.Shell.Interop.8.8.0.4\lib\net20\Microsoft.VisualStudio.Shell.Interop.8.0.dll 206 | True 207 | False 208 | 209 | 210 | ..\packages\VSSDK.Shell.Interop.9.9.0.4\lib\net20\Microsoft.VisualStudio.Shell.Interop.9.0.dll 211 | True 212 | False 213 | 214 | 215 | ..\packages\VSSDK.Text.12.0.4\lib\net45\Microsoft.VisualStudio.Text.Data.dll 216 | True 217 | False 218 | 219 | 220 | ..\packages\VSSDK.Text.12.0.4\lib\net45\Microsoft.VisualStudio.Text.Logic.dll 221 | True 222 | False 223 | 224 | 225 | ..\packages\VSSDK.Text.12.0.4\lib\net45\Microsoft.VisualStudio.Text.UI.dll 226 | True 227 | False 228 | 229 | 230 | ..\packages\VSSDK.Text.12.0.4\lib\net45\Microsoft.VisualStudio.Text.UI.Wpf.dll 231 | True 232 | False 233 | 234 | 235 | ..\packages\VSSDK.TextManager.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.dll 236 | True 237 | False 238 | 239 | 240 | ..\packages\VSSDK.TextManager.Interop.8.8.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.8.0.dll 241 | True 242 | False 243 | 244 | 245 | ..\packages\VSSDK.Threading.12.0.4\lib\net45\Microsoft.VisualStudio.Threading.dll 246 | True 247 | 248 | 249 | ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll 250 | 251 | 252 | 253 | 254 | 255 | False 256 | ..\packages\VSSDK.DTE.7.0.4\lib\net20\stdole.dll 257 | True 258 | 259 | 260 | ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll 261 | 262 | 263 | 264 | ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Design.dll 265 | 266 | 267 | ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll 268 | 269 | 270 | ..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll 271 | True 272 | 273 | 274 | ..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll 275 | True 276 | 277 | 278 | ..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll 279 | True 280 | 281 | 282 | ..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll 283 | True 284 | 285 | 286 | ..\packages\Rx-XAML.2.2.5\lib\net45\System.Reactive.Windows.Threading.dll 287 | True 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | Menus.ctmenu 301 | Designer 302 | 303 | 304 | 305 | 306 | OptionsPageControl.cs 307 | 308 | 309 | true 310 | VSPackage 311 | Designer 312 | ResXFileCodeGenerator 313 | VSPackage.Designer.cs 314 | 315 | 316 | 317 | 318 | Always 319 | true 320 | 321 | 322 | 323 | 324 | Always 325 | true 326 | 327 | 328 | 329 | 330 | MSBuild:Compile 331 | Designer 332 | 333 | 334 | MSBuild:Compile 335 | Designer 336 | 337 | 338 | MSBuild:Compile 339 | Designer 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | False 348 | .NET Framework 3.5 SP1 349 | false 350 | 351 | 352 | 353 | 354 | 355 | 356 | このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。 357 | 358 | 359 | 360 | 361 | 362 | 369 | -------------------------------------------------------------------------------- /MigrationBackup/6fef1710/CodicExtension/NuGetUpgradeLog.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NuGetMigrationLog 6 |

153 | NuGet Migration Report - CodicExtension

Overview

Migration to PackageReference was completed successfully. Please build and run your solution to verify that all packages are available.
154 | If you run into any problems, have feedback, questions, or concerns, please 155 | file an issue on the NuGet GitHub repository.
156 | Changed files and this report have been backed up here: 157 | C:\Repos\codic-vs-extension\MigrationBackup\6fef1710\CodicExtension

Packages processed

Top-level dependencies:

Package IdVersion
Microsoft.VSSDK.BuildTools 158 | v17.2.1076-preview2
Newtonsoft.Json 159 | v6.0.8
Rx-WPF 160 | v2.2.5
Rx-XAML 161 | v2.2.5
VSSDK.Editor.12 162 | v12.0.4
VSSDK.Shell.12 163 | v12.0.4

Transitive dependencies:

Package IdVersion
Rx-Core 164 | v2.2.5
Rx-Interfaces 165 | v2.2.5
Rx-Linq 166 | v2.2.5
Rx-Main 167 | v2.2.5
Rx-PlatformServices 168 | v2.2.5
VSSDK.CoreUtility 169 | v12.0.4
VSSDK.CoreUtility.12 170 | v12.0.4
VSSDK.DTE 171 | v7.0.4
VSSDK.Editor 172 | v12.0.4
VSSDK.GraphModel 173 | v11.0.4
VSSDK.IDE 174 | v7.0.4
VSSDK.IDE.10 175 | v10.0.4
VSSDK.IDE.11 176 | v11.0.4
VSSDK.IDE.12 177 | v12.0.4
VSSDK.IDE.8 178 | v8.0.4
VSSDK.IDE.9 179 | v9.0.4
VSSDK.OLE.Interop 180 | v7.0.4
VSSDK.Shell.Immutable.10 181 | v10.0.4
VSSDK.Shell.Immutable.11 182 | v11.0.4
VSSDK.Shell.Immutable.12 183 | v12.0.4
VSSDK.Shell.Interop 184 | v7.0.4
VSSDK.Shell.Interop.8 185 | v8.0.4
VSSDK.Shell.Interop.9 186 | v9.0.4
VSSDK.Text 187 | v12.0.4
VSSDK.Text.12 188 | v12.0.4
VSSDK.TextManager.Interop 189 | v7.0.4
VSSDK.TextManager.Interop.8 190 | v8.0.4
VSSDK.Threading 191 | v12.0.4
VSSDK.Threading.12 192 | v12.0.4

Package compatibility issues

Description
Newtonsoft.Json 193 | v6.0.8
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.CoreUtility 194 | v12.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.DTE 195 | v7.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Editor 196 | v12.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.GraphModel 197 | v11.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.OLE.Interop 198 | v7.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.12 199 | v12.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.Immutable.10 200 | v10.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.Immutable.11 201 | v11.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.Immutable.12 202 | v12.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.Interop 203 | v7.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.Interop.8 204 | v8.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Shell.Interop.9 205 | v9.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Text 206 | v12.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.TextManager.Interop 207 | v7.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.TextManager.Interop.8 208 | v8.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
VSSDK.Threading 209 | v12.0.4
install.ps1 スクリプトは、移行後にパッケージをインストールした場合には無視されます。
-------------------------------------------------------------------------------- /MigrationBackup/6fef1710/CodicExtension/packages.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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Codic Extension for Visual Studio 2 | Visual Studio IDE向けのcodic拡張です。 3 | 4 | 5 | ### Install 6 | 1. Visual Studio MarketplaceよりVSIXをダウンロードし、実行します。 7 | * [Visual Studio 2022用](https://marketplace.visualstudio.com/items?itemName=namba0219.CodicExtension2022) 8 | * [Visual Studio 2012~2019用](https://marketplace.visualstudio.com/items?itemName=namba0219.CodicExtension) 9 | 10 | 2. Visual Studioをリスタート後、メニューの Tools > Options からオプションダイアログを開き、Codic Extensionページより、アクセストークンを設定します。アクセストークンは、 11 | [Codic](https://codic.jp)にログイン後、APIステータスのページより取得できます。 12 | 13 | ### How to use 14 | 15 | エディタ上で、右クリックメニューあるいはCtrl+Shift+D (または Ctrl+Alt+D) でネーミング生成するためのポップアップを開きます。テキストを選択状態で開くと、ダイレクト生成できます。 16 | 17 | ![codic plugin](https://raw.githubusercontent.com/codic-project/codic-vs-extension/master/CodicExtension/Resources/Screenshot.png) 18 | 19 | ケース (Letter Case) は、最後に選択されたモノがファイルの拡張子ごとに記憶されます。時間があれば、パーサーにアクセスして変数宣言、関数宣言など文脈ごとに記憶させたいと思っています。 20 | 21 | ### Change log 22 | 23 | _2.0.0_ 24 | - 非同期ローディングに対応 25 | - Visual Studio 2022をサポート [#16](https://github.com/codic-project/codic-vs-extension/issues/16) ( 26 | - スタイル調整 27 | 28 | _1.0.9_ 29 | - Fix bugs [#15](https://github.com/codic-project/codic-vs-extension/issues/15) (カーソルが見にくい問題) 30 | 31 | _1.0.8_ 32 | - バグ修正 33 | - キーボードバインディングに Ctrl+Alt+D を追加 34 | - Fix bugs #14, #13 35 | 36 | _1.0.7_ 37 | - Visual Studio 2019をサポート 38 | 39 | _1.0.6_ 40 | - Visual Studio 2017をサポート 41 | 42 | _1.0.5_ 43 | - Fix bugs #3, #4 (一部の環境で正常に動作しない問題) 44 | 45 | _1.0.4_ 46 | - Fix bug #6. 47 | - Fix bug #5. 48 | - Workaround for bug #4. 49 | 50 | _1.0.2_ 51 | - Fix bug #2 (NullReferenceException). 52 | - ポップアップの余計なマージンを削除. 53 | 54 | _1.0.1_ 55 | - Use v1.1 API. 56 | 57 | _1.0.0_ 58 | - First Release 59 | 60 | 61 | ### Bug report 62 | 63 | バグ・要望などがありましたら、[Issue](https://github.com/codic-project/codic-vs-extension/issues)へ登録してください。 64 | --------------------------------------------------------------------------------