Browse Source

Add TypeScript addin.

pull/731/head
Matt Ward 10 years ago
parent
commit
fa86c6b127
  1. 16
      SharpDevelop.Tests.sln
  2. 79
      SharpDevelop.sln
  3. 31
      src/AddIns/BackendBindings/TypeScript/Project/Configuration/AssemblyInfo.cs
  4. 127
      src/AddIns/BackendBindings/TypeScript/Project/Resources/ImageResources.resx
  5. BIN
      src/AddIns/BackendBindings/TypeScript/Project/Resources/TypeScript.ProjectBrowser.File.png
  6. BIN
      src/AddIns/BackendBindings/TypeScript/Project/Resources/TypeScript.Template.EmptyFile.png
  7. 137
      src/AddIns/BackendBindings/TypeScript/Project/Resources/TypeScript.xshd
  8. 55
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/TypeScript-License.txt
  9. 3
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/compile.js
  10. 4
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/completion.js
  11. 4
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/completionDetails.js
  12. 4
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/definition.js
  13. 5
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/diagnostics.js
  14. 17204
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/lib.d.ts
  15. 3
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/main.js
  16. 4
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/navigation.js
  17. 38
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/package.json
  18. 4
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/references.js
  19. 4
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/signature.js
  20. 31635
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/tsc.js
  21. 50335
      src/AddIns/BackendBindings/TypeScript/Project/Scripts/typescriptServices.js
  22. 44
      src/AddIns/BackendBindings/TypeScript/Project/Src/BuildConfiguration.cs
  23. 77
      src/AddIns/BackendBindings/TypeScript/Project/Src/CompileTypeScriptAction.cs
  24. 87
      src/AddIns/BackendBindings/TypeScript/Project/Src/CompileTypeScriptFilesOnBuildAction.cs
  25. 61
      src/AddIns/BackendBindings/TypeScript/Project/Src/CompileTypeScriptOnSaveFileAction.cs
  26. 49
      src/AddIns/BackendBindings/TypeScript/Project/Src/DisplayValue.cs
  27. 57
      src/AddIns/BackendBindings/TypeScript/Project/Src/FileNameExtensions.cs
  28. 59
      src/AddIns/BackendBindings/TypeScript/Project/Src/FileProjectItemExtensions.cs
  29. 59
      src/AddIns/BackendBindings/TypeScript/Project/Src/FindTypeScriptReferencesCommand.cs
  30. 47
      src/AddIns/BackendBindings/TypeScript/Project/Src/GoToTypeScriptDefinitionCommand.cs
  31. 97
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompilerOptions.cs
  32. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompilerResult.cs
  33. 51
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntry.cs
  34. 54
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntryDetails.cs
  35. 52
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntryDetailsProvider.cs
  36. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntryDetailsResult.cs
  37. 44
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionInfo.cs
  38. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionResult.cs
  39. 51
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DefinitionInfo.cs
  40. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DefinitionResult.cs
  41. 55
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/Diagnostic.cs
  42. 39
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DiagnosticCategory.cs
  43. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DiagnosticsResult.cs
  44. 43
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/EmitOutput.cs
  45. 51
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/GeneratedTypeScriptFile.cs
  46. 38
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ICancellationToken.cs
  47. 48
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ILanguageServiceShimHost.cs
  48. 40
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ILogger.cs
  49. 52
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/IScriptLoader.cs
  50. 48
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/IScriptSnapshotShim.cs
  51. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ITypeScriptContextFactory.cs
  52. 39
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/JsxEmit.cs
  53. 44
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceCancellationToken.cs
  54. 67
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceCompiler.cs
  55. 83
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceCompilerResult.cs
  56. 51
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceLogger.cs
  57. 47
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceNullLogger.cs
  58. 289
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceShimHost.cs
  59. 43
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ModuleKind.cs
  60. 38
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ModuleResolutionKind.cs
  61. 112
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NavigateToItem.cs
  62. 102
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NavigationBarItem.cs
  63. 38
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NavigationInfo.cs
  64. 38
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NewLineKind.cs
  65. 38
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/OutputFile.cs
  66. 47
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ReferenceEntry.cs
  67. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ReferencesResult.cs
  68. 83
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/Script.cs
  69. 155
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptLoader.cs
  70. 82
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptSnapshotShim.cs
  71. 41
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptTarget.cs
  72. 42
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptsContainer.cs
  73. 91
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureHelpItem.cs
  74. 46
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureHelpItems.cs
  75. 40
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureHelpParameter.cs
  76. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureResult.cs
  77. 38
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SymbolDisplayPart.cs
  78. 61
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TextChangeRange.cs
  79. 49
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TextSpan.cs
  80. 37
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TextSpanResult.cs
  81. 200
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TypeScriptContext.cs
  82. 54
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TypeScriptContextFactory.cs
  83. 139
      src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TypeScriptContextProvider.cs
  84. 48
      src/AddIns/BackendBindings/TypeScript/Project/Src/ITypeScriptOptions.cs
  85. 41
      src/AddIns/BackendBindings/TypeScript/Project/Src/InitializeTypeScriptServiceCommand.cs
  86. 44
      src/AddIns/BackendBindings/TypeScript/Project/Src/RegisterIconsCommand.cs
  87. 52
      src/AddIns/BackendBindings/TypeScript/Project/Src/RegisterTypeScriptCompileBuildOnCommand.cs
  88. 64
      src/AddIns/BackendBindings/TypeScript/Project/Src/RegisterTypeScriptCompileOnSaveFileCommand.cs
  89. 99
      src/AddIns/BackendBindings/TypeScript/Project/Src/RenameTypeScriptReferenceCommand.cs
  90. 198
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptCodeCompletionBinding.cs
  91. 129
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptCompletionItem.cs
  92. 80
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptCompletionItemProvider.cs
  93. 45
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFile.cs
  94. 42
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFileExtensions.cs
  95. 41
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFormattingStrategy.cs
  96. 96
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFunctionInsightItem.cs
  97. 58
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFunctionInsightProvider.cs
  98. 65
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptInsightWindowHandler.cs
  99. 43
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptLanguageBinding.cs
  100. 83
      src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptOptions.cs
  101. Some files were not shown because too many files have changed in this diff Show More

16
SharpDevelop.Tests.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# SharpDevelop 5.0
# SharpDevelop 5.1
VisualStudioVersion = 12.0.20827.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
@ -94,6 +94,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlBinding.Tests", "src\Ad @@ -94,6 +94,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlBinding.Tests", "src\Ad
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBBinding", "src\AddIns\BackendBindings\VBBinding\Project\VBBinding.vbproj", "{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TypeScriptBinding", "src\AddIns\BackendBindings\TypeScript\Project\TypeScriptBinding.csproj", "{94BBCA55-A20E-4782-93B0-3566D185F7C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TypeScriptBinding.Tests", "src\AddIns\BackendBindings\TypeScript\Test\TypeScriptBinding.Tests.csproj", "{6F22CECC-2ABA-4D5D-A3F8-1C4F4A46C915}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelpViewer", "src\AddIns\Misc\HelpViewer\HelpViewer.csproj", "{80F76D10-0B44-4D55-B4BD-DAEB5464090C}"
@ -398,6 +402,14 @@ Global @@ -398,6 +402,14 @@ Global
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}.Release|Any CPU.Build.0 = Release|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Release|Any CPU.Build.0 = Release|Any CPU
{6F22CECC-2ABA-4D5D-A3F8-1C4F4A46C915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F22CECC-2ABA-4D5D-A3F8-1C4F4A46C915}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F22CECC-2ABA-4D5D-A3F8-1C4F4A46C915}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F22CECC-2ABA-4D5D-A3F8-1C4F4A46C915}.Release|Any CPU.Build.0 = Release|Any CPU
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -685,6 +697,8 @@ Global @@ -685,6 +697,8 @@ Global
{85C09AD8-183B-403A-869A-7226646218A9} = {E0646C25-36F2-4524-969F-FA621353AB94}
{F390DA70-1FE1-4715-81A0-389AB010C130} = {E0646C25-36F2-4524-969F-FA621353AB94}
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F} = {E0646C25-36F2-4524-969F-FA621353AB94}
{94BBCA55-A20E-4782-93B0-3566D185F7C1} = {E0646C25-36F2-4524-969F-FA621353AB94}
{6F22CECC-2ABA-4D5D-A3F8-1C4F4A46C915} = {E0646C25-36F2-4524-969F-FA621353AB94}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{80F76D10-0B44-4D55-B4BD-DAEB5464090C} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}

79
SharpDevelop.sln

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.3
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# SharpDevelop 5.1
VisualStudioVersion = 12.0.20827.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker35", "src\Main\ICSharpCode.SharpDevelop.BuildWorker35\ICSharpCode.SharpDevelop.BuildWorker35.csproj", "{B5F54272-49F0-40DB-845A-8D837875D3BA}"
EndProject
@ -25,8 +25,6 @@ EndProject @@ -25,8 +25,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker120", "src\Main\ICSharpCode.SharpDevelop.BuildWorker120\ICSharpCode.SharpDevelop.BuildWorker120.csproj", "{6F273DA5-E10C-45A6-9071-7313ECD98C90}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "src\Libraries\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
EndProject
@ -56,20 +54,14 @@ EndProject @@ -56,20 +54,14 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Decompiler", "src\Libraries\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj", "{984CC812-9470-4A13-AFF9-CC44068D666C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{39327899-ED91-4F7F-988C-4FE4E17C014D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Version Control", "Version Control", "{F208FF4F-E5D8-41D5-A7C7-B463976F156E}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitAddIn", "src\AddIns\VersionControl\GitAddIn\GitAddIn.csproj", "{83F15BA7-8478-4664-81BB-A82F146D88B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "src\AddIns\VersionControl\SubversionAddIn\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language Bindings", "Language Bindings", "{E0646C25-36F2-4524-969F-FA621353AB94}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBinding", "src\AddIns\BackendBindings\CSharpBinding\Project\CSharpBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}"
EndProject
@ -87,9 +79,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Scripting", "sr @@ -87,9 +79,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Scripting", "sr
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBBinding", "src\AddIns\BackendBindings\VBBinding\Project\VBBinding.vbproj", "{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TypeScriptBinding", "src\AddIns\BackendBindings\TypeScript\Project\TypeScriptBinding.csproj", "{94BBCA55-A20E-4782-93B0-3566D185F7C1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchAndReplace", "src\AddIns\Misc\SearchAndReplace\Project\SearchAndReplace.csproj", "{9196DD8A-B4D4-4780-8742-C5762E547FC2}"
EndProject
@ -98,8 +90,6 @@ EndProject @@ -98,8 +90,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddinScout", "src\AddIns\Misc\AddinScout\Project\AddinScout.csproj", "{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsageDataCollector", "UsageDataCollector", "{59A30AA6-D600-41AB-B7A1-9543469DBE36}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageDataCollector", "src\AddIns\Misc\UsageDataCollector\UsageDataCollector\UsageDataCollector.csproj", "{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}"
EndProject
@ -114,8 +104,6 @@ EndProject @@ -114,8 +104,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTemplating", "src\AddIns\Misc\TextTemplating\Project\TextTemplating.csproj", "{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageManagement", "PackageManagement", "{87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManagement", "src\AddIns\Misc\PackageManagement\Project\PackageManagement.csproj", "{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1}"
EndProject
@ -128,16 +116,12 @@ EndProject @@ -128,16 +116,12 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager2", "src\AddIns\Misc\AddInManager2\Project\AddInManager2.csproj", "{60480C2F-F228-4D86-B98F-AF75A7DCEC34}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reports", "Reports", "{4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting\ICSharpCode.Reporting.csproj", "{40CA84D4-ACFC-4646-9CDD-B87262D34093}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting.Addin", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting.Addin\ICSharpCode.Reporting.Addin.csproj", "{0502FCF7-72F4-4587-936B-D0238CD0E072}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
EndProject
@ -152,8 +136,6 @@ EndProject @@ -152,8 +136,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "src\AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{5FB020B2-B64B-4016-999A-CB8FD9274D72}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Addin", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Addin\ICSharpCode.Data.Addin.csproj", "{A9F12710-24E4-46D4-832C-6ECB395B9EAD}"
EndProject
@ -168,8 +150,6 @@ EndProject @@ -168,8 +150,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.SQLServer\ICSharpCode.Data.SQLServer.csproj", "{AFE34868-AFA1-4E1C-9450-47AB4BE329D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WpfDesign", "WpfDesign", "{D54BEB89-8CBE-475C-8BB9-836D2FD71260}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}"
EndProject
@ -184,8 +164,6 @@ EndProject @@ -184,8 +164,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEditor", "src\AddIns\DisplayBindings\ResourceEditor\Project\ResourceEditor.csproj", "{CBC6C247-747B-4908-B09A-4D2E0F640B6B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analysis", "Analysis", "{7019F43E-DFD7-4D1C-8C96-E75D55646DE7}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "src\AddIns\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}"
EndProject
@ -200,8 +178,6 @@ EndProject @@ -200,8 +178,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeQuality", "src\AddIns\Analysis\CodeQuality\CodeQuality.csproj", "{3C532D80-32B4-40E5-B5FE-BC6BAE1A00E7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Profiler", "Profiler", "{E9BF2761-031F-4CDC-A7E6-F66F3B347311}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Controller", "src\AddIns\Analysis\Profiler\Controller\Profiler.Controller.csproj", "{72FFB35A-C9E2-4A31-B4FA-E3E3E28DED5F}"
EndProject
@ -212,8 +188,6 @@ EndProject @@ -212,8 +188,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Controls", "src\AddIns\Analysis\Profiler\Frontend\Controls\Profiler.Controls.csproj", "{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "src\AddIns\Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
EndProject
@ -347,6 +321,10 @@ Global @@ -347,6 +321,10 @@ Global
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}.Release|Any CPU.Build.0 = Release|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94BBCA55-A20E-4782-93B0-3566D185F7C1}.Release|Any CPU.Build.0 = Release|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -551,24 +529,20 @@ Global @@ -551,24 +529,20 @@ Global
{6F273DA5-E10C-45A6-9071-7313ECD98C90} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{984CC812-9470-4A13-AFF9-CC44068D666C} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{2B8F4F83-C2B3-4E84-A27B-8DEE1BE0E006} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{2A705FC6-1A9E-4941-9E47-254D79F2D9D5} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{984CC812-9470-4A13-AFF9-CC44068D666C} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{F208FF4F-E5D8-41D5-A7C7-B463976F156E} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{7019F43E-DFD7-4D1C-8C96-E75D55646DE7} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{83F15BA7-8478-4664-81BB-A82F146D88B3} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E}
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E}
{E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {E0646C25-36F2-4524-969F-FA621353AB94}
{E954F3CB-A446-492F-A664-2B376EBC86E8} = {E0646C25-36F2-4524-969F-FA621353AB94}
{70966F84-74C9-4067-A379-0C674A929233} = {E0646C25-36F2-4524-969F-FA621353AB94}
@ -577,25 +551,28 @@ Global @@ -577,25 +551,28 @@ Global
{E1B288A2-08EE-4318-8BBB-8AB72C69E33E} = {E0646C25-36F2-4524-969F-FA621353AB94}
{7048AE18-EB93-4A84-82D0-DD60EB58ADBD} = {E0646C25-36F2-4524-969F-FA621353AB94}
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F} = {E0646C25-36F2-4524-969F-FA621353AB94}
{94BBCA55-A20E-4782-93B0-3566D185F7C1} = {E0646C25-36F2-4524-969F-FA621353AB94}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{4B8F0F98-8BE1-402B-AA8B-C8D548577B38} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{59A30AA6-D600-41AB-B7A1-9543469DBE36} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {59A30AA6-D600-41AB-B7A1-9543469DBE36}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {59A30AA6-D600-41AB-B7A1-9543469DBE36}
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{80F76D10-0B44-4D55-B4BD-DAEB5464090C} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{60480C2F-F228-4D86-B98F-AF75A7DCEC34} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {59A30AA6-D600-41AB-B7A1-9543469DBE36}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {59A30AA6-D600-41AB-B7A1-9543469DBE36}
{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D}
{A406803B-C584-43A3-BCEE-A0BB3132CB5F} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D}
{1B753D7F-7C77-4D5E-B928-02982690879C} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D}
{E0A5E80A-003B-4335-A9DC-A76E2E46D38D} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D}
{60480C2F-F228-4D86-B98F-AF75A7DCEC34} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{40CA84D4-ACFC-4646-9CDD-B87262D34093} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{0502FCF7-72F4-4587-936B-D0238CD0E072} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{DCA2703D-250A-463E-A68A-07ED105AE6BD} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
@ -603,19 +580,20 @@ Global @@ -603,19 +580,20 @@ Global
{8AA421C8-D7AF-4957-9F43-5135328ACB24} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{5FB020B2-B64B-4016-999A-CB8FD9274D72} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{D54BEB89-8CBE-475C-8BB9-836D2FD71260} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{A9F12710-24E4-46D4-832C-6ECB395B9EAD} = {5FB020B2-B64B-4016-999A-CB8FD9274D72}
{B7823AE9-4B43-4859-8796-2EBDC116FBB8} = {5FB020B2-B64B-4016-999A-CB8FD9274D72}
{BAD94D6E-4159-4CB6-B991-486F412D9BB6} = {5FB020B2-B64B-4016-999A-CB8FD9274D72}
{5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} = {5FB020B2-B64B-4016-999A-CB8FD9274D72}
{EEF5E054-4192-4A57-8FBF-E860D808A51D} = {5FB020B2-B64B-4016-999A-CB8FD9274D72}
{AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {5FB020B2-B64B-4016-999A-CB8FD9274D72}
{D54BEB89-8CBE-475C-8BB9-836D2FD71260} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260}
{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260}
{88DA149F-21B2-48AB-82C4-28FB6BDFD783} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260}
{78CC29AC-CC79-4355-B1F2-97936DF198AC} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260}
{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{7019F43E-DFD7-4D1C-8C96-E75D55646DE7} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1F261725-6318-4434-A1B1-6C70CE4CD324} = {7019F43E-DFD7-4D1C-8C96-E75D55646DE7}
{3EAA45A9-735C-4AC7-A799-947B93EA449D} = {7019F43E-DFD7-4D1C-8C96-E75D55646DE7}
{C16BEA37-FEE8-4792-B860-48F5BFBD39A9} = {7019F43E-DFD7-4D1C-8C96-E75D55646DE7}
@ -627,6 +605,7 @@ Global @@ -627,6 +605,7 @@ Global
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {E9BF2761-031F-4CDC-A7E6-F66F3B347311}
{FE88FE17-D9FB-4FCC-9A35-6BFFB6B26CC6} = {E9BF2761-031F-4CDC-A7E6-F66F3B347311}
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0} = {E9BF2761-031F-4CDC-A7E6-F66F3B347311}
{49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E}
EndGlobalSection

31
src/AddIns/BackendBindings/TypeScript/Project/Configuration/AssemblyInfo.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.Reflection;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("TypeScriptBinding")]
[assembly: AssemblyDescription("TypeScript support.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

127
src/AddIns/BackendBindings/TypeScript/Project/Resources/ImageResources.resx

@ -0,0 +1,127 @@ @@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="TypeScript.ProjectBrowser.File" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TypeScript.ProjectBrowser.File.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TypeScript.Template.EmptyFile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>TypeScript.Template.EmptyFile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
src/AddIns/BackendBindings/TypeScript/Project/Resources/TypeScript.ProjectBrowser.File.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

BIN
src/AddIns/BackendBindings/TypeScript/Project/Resources/TypeScript.Template.EmptyFile.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

137
src/AddIns/BackendBindings/TypeScript/Project/Resources/TypeScript.xshd

@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
<?xml version="1.0"?>
<!-- Based on JavaScript syntax definition for JavaScript 2.0 by Svante Lidman -->
<!-- converted to AvalonEdit format by Siegfried Pammer in 2010 -->
<SyntaxDefinition name="TypeScript" extensions=".ts" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Digits" foreground="DarkBlue" />
<Color name="Comment" foreground="Green" />
<Color name="String" foreground="Sienna" />
<Color name="Character" foreground="Sienna" />
<Color name="Regex" foreground="Sienna" />
<Color name="TypeScriptKeyWords" foreground="Blue" />
<Color name="TypeScriptIntrinsics" foreground="Blue" />
<Color name="TypeScriptLiterals" foreground="Blue" />
<Color name="TypeScriptGlobalFunctions" foreground="Blue" />
<RuleSet ignoreCase="false">
<Keywords color="TypeScriptKeyWords">
<Word>any</Word>
<Word>break</Word>
<Word>continue</Word>
<Word>delete</Word>
<Word>else</Word>
<Word>for</Word>
<Word>function</Word>
<Word>if</Word>
<Word>in</Word>
<Word>new</Word>
<Word>return</Word>
<Word>this</Word>
<Word>typeof</Word>
<Word>var</Word>
<Word>void</Word>
<Word>while</Word>
<Word>with</Word>
<Word>abstract</Word>
<Word>bool</Word>
<Word>boolean</Word>
<Word>byte</Word>
<Word>case</Word>
<Word>catch</Word>
<Word>char</Word>
<Word>class</Word>
<Word>const</Word>
<Word>debugger</Word>
<Word>default</Word>
<Word>do</Word>
<Word>double</Word>
<Word>enum</Word>
<Word>export</Word>
<Word>extends</Word>
<Word>final</Word>
<Word>finally</Word>
<Word>float</Word>
<Word>goto</Word>
<Word>implements</Word>
<Word>import</Word>
<Word>instanceof</Word>
<Word>int</Word>
<Word>interface</Word>
<Word>long</Word>
<Word>module</Word>
<Word>native</Word>
<Word>number</Word>
<Word>package</Word>
<Word>private</Word>
<Word>protected</Word>
<Word>public</Word>
<Word>short</Word>
<Word>static</Word>
<Word>string</Word>
<Word>super</Word>
<Word>switch</Word>
<Word>synchronized</Word>
<Word>throw</Word>
<Word>throws</Word>
<Word>transient</Word>
<Word>try</Word>
<Word>volatile</Word>
</Keywords>
<Keywords color="TypeScriptIntrinsics">
<Word>Array</Word>
<Word>Boolean</Word>
<Word>Date</Word>
<Word>Function</Word>
<Word>Global</Word>
<Word>Math</Word>
<Word>Number</Word>
<Word>Object</Word>
<Word>RegExp</Word>
<Word>String</Word>
</Keywords>
<Keywords color="TypeScriptLiterals">
<Word>false</Word>
<Word>null</Word>
<Word>true</Word>
<Word>NaN</Word>
<Word>Infinity</Word>
</Keywords>
<Keywords color="TypeScriptGlobalFunctions">
<Word>eval</Word>
<Word>parseInt</Word>
<Word>parseFloat</Word>
<Word>escape</Word>
<Word>unescape</Word>
<Word>isNaN</Word>
<Word>isFinite</Word>
</Keywords>
<Span color="Comment">
<Begin>//</Begin>
</Span>
<Span color="Comment" multiline="true">
<Begin>/\*</Begin>
<End>\*/</End>
</Span>
<!--<Rule color="Regex">/.*/</Rule>-->
<Span color="Regex">
<Begin>/</Begin>
<End>/</End>
<RuleSet>
<Span begin="\\/" end="." />
</RuleSet>
</Span>
<Span color="String" multiline="true">
<Begin>"</Begin>
<End>"</End>
<RuleSet>
<Span begin="\\" end="." />
</RuleSet>
</Span>
<Span color="Character">
<Begin>'</Begin>
<End>'</End>
<RuleSet>
<Span begin="\\" end="." />
</RuleSet>
</Span>
<Rule color="Digits">\b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?</Rule>
</RuleSet>
</SyntaxDefinition>

55
src/AddIns/BackendBindings/TypeScript/Project/Scripts/TypeScript-License.txt

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
You must cause any modified files to carry prominent notices stating that You changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

3
src/AddIns/BackendBindings/TypeScript/Project/Scripts/compile.js

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
ls.refresh(true);
var emitResult = ls.getEmitOutput(host.fileName);
host.updateCompilerResult(emitResult);

4
src/AddIns/BackendBindings/TypeScript/Project/Scripts/completion.js

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@

ls.refresh(true);
var items = ls.getCompletionsAtPosition(host.fileName, host.position, host.isMemberCompletion);
host.updateCompletionInfoAtCurrentPosition(items);

4
src/AddIns/BackendBindings/TypeScript/Project/Scripts/completionDetails.js

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@

ls.refresh(true);
var items = ls.getCompletionEntryDetails(host.fileName, host.position, host.completionEntry);
host.updateCompletionEntryDetailsAtCurrentPosition(items);

4
src/AddIns/BackendBindings/TypeScript/Project/Scripts/definition.js

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@

ls.refresh(true);
var definition = ls.getDefinitionAtPosition(host.fileName, host.position);
host.updateDefinitionAtPosition(definition);

5
src/AddIns/BackendBindings/TypeScript/Project/Scripts/diagnostics.js

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
ls.refresh(true);
var diagnostics = ls.getSemanticDiagnostics(host.fileName);
host.updateSemanticDiagnosticsResult(diagnostics);
diagnostics = ls.getSyntacticDiagnostics(host.fileName);
host.updateSyntacticDiagnosticsResult(diagnostics);

17204
src/AddIns/BackendBindings/TypeScript/Project/Scripts/lib.d.ts vendored

File diff suppressed because it is too large Load Diff

3
src/AddIns/BackendBindings/TypeScript/Project/Scripts/main.js

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@

var ls = new TypeScript.Services.TypeScriptServicesFactory().createLanguageServiceShim(host);
ls.refresh(true);

4
src/AddIns/BackendBindings/TypeScript/Project/Scripts/navigation.js

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@

ls.refresh(true);
var items = ls.getNavigationBarItems(host.fileName);
host.updateNavigationBarItems(items);

38
src/AddIns/BackendBindings/TypeScript/Project/Scripts/package.json

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
{
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "0.9.1-1",
"licenses": [
{
"type": "Apache License 2.0",
"url": "http://typescript.codeplex.com/license"
}
],
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript"
],
"bugs": {
"url" : "http://typescript.codeplex.com/workitem/list/basic"
},
"repository" : {
"type" : "git",
"url" : "https://git01.codeplex.com/typescript"
},
"preferGlobal" : true,
"main" : "./bin/typescript.js",
"bin" : {
"tsc" : "./bin/tsc"
},
"engines" : {
"node" : ">=0.8.0"
},
"devDependencies": {
"jake": "latest"
}
}

4
src/AddIns/BackendBindings/TypeScript/Project/Scripts/references.js

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@

ls.refresh(true);
var references = ls.getReferencesAtPosition(host.fileName, host.position);
host.updateReferencesAtPosition(references);

4
src/AddIns/BackendBindings/TypeScript/Project/Scripts/signature.js

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@

ls.refresh(true);
var signature = ls.getSignatureHelpItems(host.fileName, host.position);
host.updateSignatureAtPosition(signature);

31635
src/AddIns/BackendBindings/TypeScript/Project/Scripts/tsc.js

File diff suppressed because one or more lines are too long

50335
src/AddIns/BackendBindings/TypeScript/Project/Scripts/typescriptServices.js

File diff suppressed because one or more lines are too long

44
src/AddIns/BackendBindings/TypeScript/Project/Src/BuildConfiguration.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
//
// BuildConfiguration.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding
{
public class BuildConfiguration
{
public BuildConfiguration(string configuration, string platform)
{
Configuration = configuration;
Platform = platform;
}
public string Configuration { get; private set; }
public string Platform { get; private set; }
}
}

77
src/AddIns/BackendBindings/TypeScript/Project/Src/CompileTypeScriptAction.cs

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
//
// CompileTypeScriptAction.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public abstract class CompileTypeScriptAction
{
protected void Report(string message)
{
TaskService.BuildMessageViewCategory.AppendLine(message);
}
protected void Report(string format, params object[] args)
{
string message = String.Format(format, args);
Report(message);
}
protected void ClearOutputWindow()
{
TaskService.BuildMessageViewCategory.ClearText();
}
protected void ShowOutputPad()
{
SD.Workbench
.GetPad(typeof(CompilerMessageView))
.BringPadToFront();
}
protected void ReportCompileFinished(bool error)
{
if (error) {
ShowOutputPad();
Report("TypeScript compilation failed.");
} else {
Report("TypeScript compilation finished successfully.");
}
}
protected void UpdateFile(TypeScriptContext context, FileName fileName)
{
context.UpdateFile(fileName, TypeScriptService.GetFileContents(fileName));
}
}
}

87
src/AddIns/BackendBindings/TypeScript/Project/Src/CompileTypeScriptFilesOnBuildAction.cs

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
//
// CompileTypeScriptFilesOnBuildFileAction.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class CompileTypeScriptFilesOnBuildAction : CompileTypeScriptAction
{
public void CompileFiles(IEnumerable<IProject> projects)
{
ClearOutputWindow();
foreach (TypeScriptProject project in projects.Select(project => new TypeScriptProject(project))) {
if (project.CompileOnBuild) {
CompileFiles(project);
}
}
}
void CompileFiles(TypeScriptProject project)
{
FileName[] fileNames = project.GetTypeScriptFileNames().ToArray();
if (fileNames.Length == 0)
return;
CompileFiles(project, fileNames);
}
void CompileFiles(TypeScriptProject project, FileName[] fileNames)
{
ReportCompileStarting(project);
bool errors = false;
TypeScriptContext context = TypeScriptService.ContextProvider.GetContext(fileNames.First());
var compiler = new LanguageServiceCompiler(context);
project.CreateOutputDirectory();
foreach (FileName fileName in fileNames) {
UpdateFile(context, fileName);
LanguageServiceCompilerResult result = compiler.Compile(fileName, project);
if (result.HasErrors) {
errors = true;
Report(result.GetError());
}
}
ReportCompileFinished(errors);
}
void ReportCompileStarting(TypeScriptProject project)
{
Report("Compiling TypeScript files for project: {0}", project.Name);
}
}
}

61
src/AddIns/BackendBindings/TypeScript/Project/Src/CompileTypeScriptOnSaveFileAction.cs

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
//
// CompileTypeScriptOnSaveFileAction.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class CompileTypeScriptOnSaveFileAction : CompileTypeScriptAction
{
public void Compile(FileName fileName, TypeScriptProject project, TypeScriptContext context)
{
ReportCompileStarting(fileName);
project.CreateOutputDirectory();
var compiler = new LanguageServiceCompiler(context);
UpdateFile(context, fileName);
LanguageServiceCompilerResult result = compiler.Compile(fileName, project);
if (result.HasErrors) {
Report(result.GetError());
}
ReportCompileFinished(result.HasErrors);
}
void ReportCompileStarting(FileName fileName)
{
ClearOutputWindow();
Report("Compiling TypeScript file: {0}", fileName.GetFileNameWithoutPath());
}
}
}

49
src/AddIns/BackendBindings/TypeScript/Project/Src/DisplayValue.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
//
// DisplayValue.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding
{
public class DisplayValue
{
public DisplayValue(string id, string value)
{
Id = id;
Value = value;
}
public string Id { get; private set; }
public string Value { get; private set; }
public override string ToString()
{
return Value;
}
}
}

57
src/AddIns/BackendBindings/TypeScript/Project/Src/FileNameExtensions.cs

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
//
// FileNameExtensions.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding
{
public static class FileNameExtensions
{
public static FileName ChangeExtension(this FileName fileName, string extension)
{
return new FileName(Path.ChangeExtension(fileName, extension));
}
public static string GetFileNameWithoutPath(this FileName fileName)
{
return Path.GetFileName(fileName);
}
public static string GetExtension(this FileName fileName)
{
return Path.GetExtension(fileName);
}
public static string ToLower(this FileName fileName)
{
return fileName.ToString().ToLowerInvariant();
}
}
}

59
src/AddIns/BackendBindings/TypeScript/Project/Src/FileProjectItemExtensions.cs

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
//
// FileProjectItemExtensions.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.TypeScriptBinding
{
public static class FileProjectItemExtensions
{
public static bool IsDependentUponAnotherFile(this FileProjectItem projectItem)
{
return !String.IsNullOrEmpty(projectItem.DependentUpon);
}
public static bool IsDependentUpon(this FileProjectItem projectItem, FileProjectItem otherProjectItem)
{
return projectItem.DependentUpon == otherProjectItem.Include;
}
public static bool IsDependentUponFileName(this FileProjectItem projectItem, string fileName)
{
return FileUtility.IsEqualFileName(projectItem.GetDependentUponFileName(), fileName);
}
public static string GetDependentUponFileName(this FileProjectItem projectItem)
{
string directory = Path.GetDirectoryName(projectItem.FileName);
return Path.Combine(directory, projectItem.DependentUpon);
}
}
}

59
src/AddIns/BackendBindings/TypeScript/Project/Src/FindTypeScriptReferencesCommand.cs

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
//
// FindTypeScriptReferences.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.Search;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.TypeScriptBinding
{
public class FindTypeScriptReferencesCommand : AbstractCommand
{
public override void Run()
{
ITextEditor textEditor = SD.Workbench.ActiveViewContent.GetService<ITextEditor>();
if (textEditor != null) {
List<SearchResultMatch> references = TypeScriptCodeCompletionBinding.GetReferences(textEditor);
ShowSearchResults(references);
}
}
static void ShowSearchResults(List<SearchResultMatch> searchResults)
{
SearchResultsPad.Instance.ShowSearchResults("References", searchResults);
SearchResultsPad.Instance.BringToFront();
}
}
}

47
src/AddIns/BackendBindings/TypeScript/Project/Src/GoToTypeScriptDefinitionCommand.cs

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
//
// GoToTypeScriptDefinitionCommand.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.TypeScriptBinding
{
public class GoToTypeScriptDefinitionCommand : AbstractCommand
{
public override void Run()
{
ITextEditor textEditor = SD.Workbench.ActiveViewContent.GetService<ITextEditor>();
if (textEditor != null) {
TypeScriptCodeCompletionBinding.GoToDefinition(textEditor);
}
}
}
}

97
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompilerOptions.cs

@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
//
// CompilerSettings.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompilerOptions
{
public CompilerOptions(ITypeScriptOptions options)
: this()
{
removeComments = options.RemoveComments;
sourceMap = options.GenerateSourceMap;
noImplicitAny = options.NoImplicitAny;
target = options.GetScriptTarget();
module = options.GetModuleTarget();
@out = options.GetOutputFileFullPath();
outDir = options.GetOutputDirectoryFullPath();
emitBOM = false;
}
public CompilerOptions()
{
module = ModuleKind.None;
target = ScriptTarget.Latest;
}
public bool? allowNonTsExtensions { get; set; }
public string charset { get; set; }
public bool? declaration { get; set; }
public bool? diagnostics { get; set; }
public bool? emitBOM { get; set; }
public bool? help { get; set; }
public bool? init { get; set; }
public bool? inlineSourceMap { get; set; }
public bool? inlineSources { get; set; }
public bool? listFiles { get; set; }
public JsxEmit? jsx { get; set; }
public string locale { get; set; }
public string mapRoot { get; set; }
public ModuleKind? module { get; set; }
public NewLineKind? newLine { get; set; }
public bool? noEmit { get; set; }
public bool? noEmitHelpers { get; set; }
public bool? noEmitOnError { get; set; }
public bool? noErrorTruncation { get; set; }
public bool? noImplicitAny { get; set; }
public bool? noLib { get; set; }
public bool? noResolve { get; set; }
public string @out { get; set; }
public string outFile { get; set; }
public string outDir { get; set; }
public bool? preserveConstEnums { get; set; }
public string project { get; set; }
public bool? removeComments { get; set; }
public string rootDir { get; set; }
public bool? sourceMap { get; set; }
public string sourceRoot { get; set; }
public bool? suppressExcessPropertyErrors { get; set; }
public bool? suppressImplicitAnyIndexErrors { get; set; }
public ScriptTarget? target { get; set; }
public bool? version { get; set; }
public bool? watch { get; set; }
public bool? isolatedModules { get; set; }
public bool? experimentalDecorators { get; set; }
public bool? experimentalAsyncFunctions { get; set; }
public bool? emitDecoratorMetadata { get; set; }
public ModuleResolutionKind? moduleResolution { get; set; }
// [option: string]: string | number | boolean;
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompilerResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// CompilerResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompilerResult
{
public EmitOutput result { get; set; }
}
}

51
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntry.cs

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
//
// CompletionEntry.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionEntry
{
public CompletionEntry()
{
this.name = "";
this.kind = "";
}
public string name { get; set; }
public string kind { get; set; } // see ScriptElementKind
public string kindModifiers { get; set; } // see ScriptElementKindModifier, comma separated
public string sortText { get; set; }
public override string ToString()
{
return string.Format("[CompletionEntry Name={0}, Kind={1}]", name, kind);
}
}
}

54
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntryDetails.cs

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
//
// CompletionEntryDetails.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionEntryDetails
{
public CompletionEntryDetails()
{
this.name = "";
this.kind = "";
this.kindModifiers = "";
this.displayParts = new SymbolDisplayPart[0];
this.documentation = new SymbolDisplayPart[0];
}
public string name { get; set; }
public string kind { get; set; } // see ScriptElementKind
public string kindModifiers { get; set; } // see ScriptElementKindModifier, comma separated
public SymbolDisplayPart[] displayParts { get; set; }
public SymbolDisplayPart[] documentation { get; set; }
public override string ToString()
{
return string.Format("[CompletionEntryDetails Name={0}, Kind={1}]", name, kind);
}
}
}

52
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntryDetailsProvider.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
//
// CompletionEntryDetailsProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionEntryDetailsProvider
{
TypeScriptContext context;
FileName fileName;
int offset;
public CompletionEntryDetailsProvider(TypeScriptContext context, FileName fileName, int offset)
{
this.context = context;
this.fileName = fileName;
this.offset = offset;
}
public CompletionEntryDetails GetCompletionEntryDetails(string entryName)
{
return context.GetCompletionEntryDetails(fileName, offset, entryName);
}
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionEntryDetailsResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// CompletionEntryDetailsResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionEntryDetailsResult
{
public CompletionEntryDetails result { get; set; }
}
}

44
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionInfo.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
//
// CompletionInfo.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionInfo
{
public CompletionInfo()
{
entries = new CompletionEntry[0];
}
public bool isMemberCompletion { get; set; }
public bool isNewIdentifierLocation { get; set; } // true when the current location also allows for a new identifier
public CompletionEntry[] entries;
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/CompletionResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// CompletionResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionResult
{
public CompletionInfo result { get; set; }
}
}

51
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DefinitionInfo.cs

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
//
// TypeScriptContext.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class DefinitionInfo
{
public string fileName { get; set; }
public TextSpan textSpan { get; set; }
public string kind { get; set; }
public string name { get; set; }
public string containerKind { get; set; }
public string containerName { get; set; }
internal int minChar {
get { return textSpan.start; }
}
public bool HasFileName()
{
return !String.IsNullOrEmpty(fileName);
}
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DefinitionResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// DefinitionResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class DefinitionResult
{
public DefinitionInfo[] result { get; set; }
}
}

55
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/Diagnostic.cs

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
//
// Diagnostic.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class Diagnostic
{
// public SourceFile file { get; set; }
public int start { get; set; }
public int length { get; set; }
public string message { get; set; } // messageText?
public DiagnosticCategory category { get; set; }
public int code { get; set; }
public string GetDiagnosticMessage()
{
if (!String.IsNullOrEmpty(message)) {
return message;
}
return String.Format("{0}", code);
}
public override string ToString()
{
return GetDiagnosticMessage();
}
}
}

39
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DiagnosticCategory.cs

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
//
// DiagnosticCategory.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public enum DiagnosticCategory
{
Warning,
Error,
Message,
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/DiagnosticsResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// DiagnosticsResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014-2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class DiagnosticsResult
{
public Diagnostic[] result { get; set; }
}
}

43
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/EmitOutput.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
//
// EmitOutput.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class EmitOutput
{
public EmitOutput()
{
outputFiles = new OutputFile[0];
}
public OutputFile[] outputFiles;
public bool emitSkipped;
}
}

51
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/GeneratedTypeScriptFile.cs

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
//
// GeneratedTypeScriptFile.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class GeneratedTypeScriptFile
{
public GeneratedTypeScriptFile(FileName parentFileName, FileName fileName)
{
this.ParentFileName = parentFileName;
this.FileName = fileName;
}
public FileName FileName { get; private set; }
public FileName ParentFileName { get; private set; }
public string GetDependentUpon()
{
return Path.GetFileName(ParentFileName);
}
}
}

38
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ICancellationToken.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//
// ICancellationToken.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public interface ICancellationToken
{
bool isCancellationRequested();
void throwIfCancellationRequested();
}
}

48
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ILanguageServiceShimHost.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
//
// ILanguageServiceShimHost.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public interface ILanguageServiceShimHost : ILogger
{
string getCompilationSettings();
string getScriptFileNames();
string getScriptVersion(string fileName);
IScriptSnapshotShim getScriptSnapshot(string fileName);
string getLocalizedDiagnosticMessages();
ICancellationToken getCancellationToken();
string getCurrentDirectory();
string getDefaultLibFilename(string options);
string getNewLine();
string getProjectVersion();
bool useCaseSensitiveFileNames();
string getModuleResolutionsForFile(string fileName);
}
}

40
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ILogger.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
//
// ILogger.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public interface ILogger
{
void log(string s);
void trace(string s);
void error(string s);
}
}

52
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/IScriptLoader.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
//
// IScriptLoader.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public interface IScriptLoader
{
string RootFolder { get; }
string TypeScriptCompilerFileName { get; }
string LibScriptFileName { get; }
string GetTypeScriptServicesScript();
string GetMainScript();
string GetMemberCompletionScript();
string GetTypeScriptCompilerScript();
string GetFunctionSignatureScript();
string GetLibScript();
string GetFindReferencesScript();
string GetDefinitionScript();
string GetNavigationScript();
string GetCompletionDetailsScript();
string GetLanguageServicesCompileScript();
string GetDiagnosticsScript();
}
}

48
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/IScriptSnapshotShim.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
//
// IScriptSnapshotShim.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public interface IScriptSnapshotShim
{
string getText(int start, int end);
int getLength();
/**
* Returns a JSON-encoded value of the type:
* { span: { start: number; length: number }; newLength: number }
*
* Or undefined value if there was no change.
*/
string getChangeRange(IScriptSnapshotShim oldSnapshot);
void dispose();
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ITypeScriptContextFactory.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// ITypeScriptContextFactory.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public interface ITypeScriptContextFactory
{
TypeScriptContext CreateContext();
}
}

39
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/JsxEmit.cs

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
//
// JsxEmit.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public enum JsxEmit
{
None = 0,
Preserve = 1,
React = 2
}
}

44
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceCancellationToken.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
//
// LanguageServiceCancellationToken.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceCancellationToken : ICancellationToken
{
public bool isCancellationRequested()
{
return false;
}
public void throwIfCancellationRequested()
{
}
}
}

67
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceCompiler.cs

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
//
// LanguageServiceCompiler.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceCompiler
{
TypeScriptContext context;
public LanguageServiceCompiler(TypeScriptContext context)
{
this.context = context;
}
public LanguageServiceCompilerResult Compile(FileName fileName, ITypeScriptOptions options)
{
try {
EmitOutput result = context.Compile(fileName, options);
var compilerResult = new LanguageServiceCompilerResult(result, fileName);
if (compilerResult.HasOutputFiles()) {
WriteOutputFiles(result.outputFiles);
}
return compilerResult;
} catch (Exception ex) {
return new LanguageServiceCompilerResult(ex);
}
}
void WriteOutputFiles(OutputFile[] outputFiles)
{
foreach (OutputFile outputFile in outputFiles) {
File.WriteAllText(outputFile.name, outputFile.text);
}
}
}
}

83
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceCompilerResult.cs

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
//
// LanguageServiceCompilerResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceCompilerResult
{
EmitOutput emitOutput;
FileName inputFileName;
string errorMessage;
public LanguageServiceCompilerResult(Exception ex)
{
HasErrors = true;
errorMessage = ex.Message;
}
public LanguageServiceCompilerResult(EmitOutput emitOutput, FileName inputFileName)
{
this.emitOutput = emitOutput;
this.inputFileName = inputFileName;
HasErrors = emitOutput.emitSkipped;
errorMessage = "Emit skipped";
}
public bool HasErrors { get; set; }
public string GetError()
{
return errorMessage;
}
public IEnumerable<GeneratedTypeScriptFile> GetGeneratedFiles()
{
if (!HasOutputFiles()) {
return Enumerable.Empty<GeneratedTypeScriptFile>();
}
return emitOutput
.outputFiles
.ToList()
.Select(outputFile => new GeneratedTypeScriptFile(inputFileName, new FileName(outputFile.name)));
}
public bool HasOutputFiles()
{
return (emitOutput != null) &&
(emitOutput.outputFiles != null);
}
}
}

51
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceLogger.cs

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
//
// LanguageServiceLogger.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceLogger : ILogger
{
public void log(string s)
{
LoggingService.Debug(s);
}
public void trace(string s)
{
LoggingService.Debug(s);
}
public void error(string s)
{
LoggingService.Error(s);
}
}
}

47
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceNullLogger.cs

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
//
// LanguageServiceNullLogger.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceNullLogger : ILogger
{
public void log(string s)
{
}
public void trace(string s)
{
}
public void error(string s)
{
}
}
}

289
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/LanguageServiceShimHost.cs

@ -0,0 +1,289 @@ @@ -0,0 +1,289 @@
//
// LanguageServiceShimHost.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013-2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.TypeScriptBinding;
using ICSharpCode.TypeScriptBinding.Hosting;
using Newtonsoft.Json;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceShimHost : ILanguageServiceShimHost
{
Dictionary<string, Script> scripts = new Dictionary<string, Script>(StringComparer.OrdinalIgnoreCase);
ILogger logger;
FileName defaultLibScriptFileName;
CompilerOptions compilerSettings = new CompilerOptions();
public LanguageServiceShimHost(ILogger logger)
{
this.logger = logger;
}
internal void AddDefaultLibScript(FileName fileName, string text)
{
defaultLibScriptFileName = fileName;
AddFile(fileName, text);
}
internal void AddFile(FileName fileName, string text)
{
if (!scripts.ContainsKey(fileName)) {
scripts.Add(fileName, new Script(fileName, text));
}
}
internal void UpdateFile(FileName fileName, string text)
{
Script script = FindScript(fileName);
if (script != null) {
script.Update(text);
} else {
AddFile(fileName, text);
}
}
Script FindScript(FileName fileName)
{
Script script = null;
if (scripts.TryGetValue(fileName, out script)) {
return script;
}
return null;
}
internal void UpdateFile(string fileName, string text)
{
scripts[fileName].Update(text);
}
public int position { get; set; }
public string fileName { get; set; }
public bool isMemberCompletion { get; set; }
public string completionEntry { get; set; }
public void updateCompletionInfoAtCurrentPosition(string completionInfo)
{
LogDebug(completionInfo);
CompletionResult = JsonConvert.DeserializeObject<CompletionResult>(completionInfo);
}
internal CompletionResult CompletionResult { get; private set; }
public void updateCompletionEntryDetailsAtCurrentPosition(string completionEntryDetails)
{
LogDebug(completionEntryDetails);
CompletionEntryDetailsResult = JsonConvert.DeserializeObject<CompletionEntryDetailsResult>(completionEntryDetails);
}
internal CompletionEntryDetailsResult CompletionEntryDetailsResult { get; private set; }
public void updateSignatureAtPosition(string signature)
{
LogDebug(signature);
SignatureResult = JsonConvert.DeserializeObject<SignatureResult>(signature);
}
internal SignatureResult SignatureResult { get; private set; }
public void updateReferencesAtPosition(string references)
{
LogDebug(references);
ReferencesResult = JsonConvert.DeserializeObject<ReferencesResult>(references);
}
internal ReferencesResult ReferencesResult { get; private set; }
public void updateDefinitionAtPosition(string definition)
{
LogDebug(definition);
DefinitionResult = JsonConvert.DeserializeObject<DefinitionResult>(definition);
}
internal DefinitionResult DefinitionResult { get; private set; }
public void updateNavigationBarItems(string items)
{
LogDebug(items);
NavigationResult = JsonConvert.DeserializeObject<NavigationResult>(items);
}
internal NavigationResult NavigationResult { get; private set; }
public void log(string s)
{
logger.log(s);
}
public void trace(string s)
{
logger.trace(s);
}
public void error(string s)
{
logger.error(s);
}
void LogDebug(string format, params object[] args)
{
LogDebug(String.Format(format, args));
}
void LogDebug(string s)
{
log(s);
}
public string getCompilationSettings()
{
LogDebug("Host.getCompilationSettings");
return JsonConvert.SerializeObject(compilerSettings);
}
internal void UpdateCompilerSettings(ITypeScriptOptions options)
{
compilerSettings = new CompilerOptions(options);
}
public string getScriptVersion(string fileName)
{
LogDebug("Host.getScriptVersion: " + fileName);
return scripts[fileName].Version.ToString();
}
internal void UpdateFileName(FileName fileName)
{
this.fileName = fileName;
}
internal void RemoveFile(FileName fileName)
{
scripts.Remove(fileName);
}
internal IEnumerable<string> GetFileNames()
{
return scripts.Keys.AsEnumerable();
}
public IScriptSnapshotShim getScriptSnapshot(string fileName)
{
log("Host.getScriptSnapshot: " + fileName);
Script script = scripts[fileName];
return new ScriptSnapshotShim(logger, script);
}
public string getScriptFileNames()
{
log("Host.getScriptFileNames");
string json = JsonConvert.SerializeObject(scripts.Select(keyPair => keyPair.Value.FileName));
log("Host.getScriptFileNames: " + json);
return json;
}
public string getCurrentDirectory()
{
log("Host.getCurrentDirectory");
return String.Empty;
}
public string getLocalizedDiagnosticMessages()
{
log("Host.getLocalizedDiagnosticMessages");
return null;
}
public string getDefaultLibFilename(string options)
{
log("Host.getDefaultLibFilename: " + options);
return String.Empty;
}
public ICancellationToken getCancellationToken()
{
log("Host.getCancellationToken");
return new LanguageServiceCancellationToken();
}
public void updateCompilerResult(string result)
{
log(result);
CompilerResult = JsonConvert.DeserializeObject<CompilerResult>(result);
}
internal CompilerResult CompilerResult { get; private set; }
public void updateSemanticDiagnosticsResult(string result)
{
log(result);
SemanticDiagnosticsResult = JsonConvert.DeserializeObject<DiagnosticsResult>(result);
}
internal DiagnosticsResult SemanticDiagnosticsResult { get; private set; }
public void updateSyntacticDiagnosticsResult(string result)
{
log(result);
SyntacticDiagnosticsResult = JsonConvert.DeserializeObject<DiagnosticsResult>(result);
}
internal DiagnosticsResult SyntacticDiagnosticsResult { get; private set; }
public string getNewLine()
{
return Environment.NewLine;
}
int projectVersion;
public string getProjectVersion()
{
projectVersion++;
return projectVersion.ToString();
}
public bool useCaseSensitiveFileNames()
{
return false;
}
public string getModuleResolutionsForFile(string fileName)
{
log("Host.getModuleResolutionsForFile: " + fileName);
return null;
}
}
}

43
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ModuleKind.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
//
// ModuleKind.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public enum ModuleKind
{
None = 0,
CommonJS = 1,
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
ES2015 = ES6,
}
}

38
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ModuleResolutionKind.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//
// ModuleResolutionKind.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public enum ModuleResolutionKind
{
Classic = 1,
NodeJs = 2
}
}

112
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NavigateToItem.cs

@ -0,0 +1,112 @@ @@ -0,0 +1,112 @@
//
// NavigateToItem.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class NavigateToItem
{
public string name { get; set; }
public string kind { get; set; }
public string kindModifiers { get; set; }
public string matchKind { get; set; }
public bool isCaseSensitive { get; set; }
public string fileName { get; set; }
public TextSpan textSpan { get; set; }
public string containerName { get; set; }
public string containerKind { get; set; }
internal int minChar {
get { return textSpan.start; }
}
internal int limChar {
get { return minChar + length; }
}
internal int length {
get { return textSpan.length; }
}
public DomRegion ToRegion(IDocument document)
{
TextLocation start = document.GetLocation(minChar);
TextLocation end = document.GetLocation(limChar);
return new DomRegion(start, end);
}
public DomRegion ToRegionStartingFromOpeningCurlyBrace(IDocument document)
{
int startOffset = GetOpeningCurlyBraceOffsetForRegion(document);
TextLocation start = document.GetLocation(startOffset);
TextLocation end = document.GetLocation(limChar);
return new DomRegion(start, end);
}
int GetOpeningCurlyBraceOffsetForRegion(IDocument document)
{
int offset = minChar;
while (offset < limChar) {
if (document.GetCharAt(offset) == '{') {
return offset - 1;
}
++offset;
}
return minChar;
}
public bool HasContainer()
{
return !String.IsNullOrEmpty(containerName);
}
public string GetFullName()
{
if (HasContainer()) {
return String.Format("{0}.{1}", containerName, name);
}
return name;
}
public string GetContainerParentName()
{
int dotPosition = containerName.IndexOf('.');
if (dotPosition > 0) {
return containerName.Substring(0, dotPosition);
}
return null;
}
}
}

102
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NavigationBarItem.cs

@ -0,0 +1,102 @@ @@ -0,0 +1,102 @@
//
// NavigationBarItem.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class NavigationBarItem
{
public NavigationBarItem()
{
text = "";
kind = "";
kindModifiers = "";
spans = new TextSpan[0];
childItems = new NavigationBarItem[0];
}
public string text { get; set; }
public string kind { get; set; }
public string kindModifiers { get; set; }
public TextSpan[] spans { get; set; }
public NavigationBarItem[] childItems { get; set; }
public int indent { get; set; }
public bool bolded { get; set; }
public bool grayed { get; set; }
internal int minChar {
get {
if (HasSpans) {
return spans[0].start;
}
return 0;
}
}
internal bool HasSpans {
get { return (spans != null) && (spans.Length > 0); }
}
internal int limChar {
get {
if (HasSpans) {
TextSpan span = spans[0];
return span.start + span.length;
}
return 0;
}
}
internal DomRegion ToRegionStartingFromOpeningCurlyBrace(IDocument document)
{
int startOffset = GetOpeningCurlyBraceOffsetForRegion(document);
TextLocation start = document.GetLocation(startOffset);
TextLocation end = document.GetLocation(limChar);
return new DomRegion(start, end);
}
int GetOpeningCurlyBraceOffsetForRegion(IDocument document)
{
int offset = minChar;
while (offset < limChar) {
if (document.GetCharAt(offset) == '{') {
return offset - 1;
}
++offset;
}
return minChar;
}
}
}

38
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NavigationInfo.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//
// NavigationInfo.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013-2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class NavigationResult
{
public NavigationBarItem[] result { get; set; }
}
}

38
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/NewLineKind.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//
// NewLineKind.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public enum NewLineKind
{
CarriageReturnLineFeed = 0,
LineFeed = 1,
}
}

38
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/OutputFile.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//
// OutputFile.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class OutputFile
{
public string name { get; set; }
public bool writeByteOrderMark { get; set; }
public string text { get; set; }
}
}

47
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ReferenceEntry.cs

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
//
// ReferenceEntry.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class ReferenceEntry
{
public string fileName { get; set; }
public TextSpan textSpan { get; set; }
public bool isWriteAccess { get; set; }
internal int minChar {
get { return textSpan.start; }
}
internal int length {
get { return textSpan.length; }
}
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ReferencesResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// ReferencesResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class ReferencesResult
{
public ReferenceEntry[] result { get; set; }
}
}

83
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/Script.cs

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
//
// Script.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class Script
{
string fileName;
List<int> lineStartPositions = new List<int>();
public Script(string fileName, string source)
{
this.fileName = fileName;
this.Source = source;
this.Version = 1;
}
public void Update(string source)
{
this.Source = source;
Version++;
}
public string Id {
get { return fileName; }
}
public string FileName {
get { return fileName; }
}
public string Source { get; private set; }
public int Version { get; private set; }
public int[] GetLineStartPositions()
{
if (lineStartPositions.Count == 0) {
string[] lines = Source.Split('\r');
lineStartPositions.Add(0);
int position = 0;
for (int i = 0; i < lines.Length; ++i) {
position += lines[i].Length + 2;
lineStartPositions.Add(position);
}
}
return lineStartPositions.ToArray();
}
public TextChangeRange GetTextChangeRange(IScriptSnapshotShim oldSnapshot)
{
return new TextChangeRange(0, oldSnapshot.getLength(), Source.Length);
}
}
}

155
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptLoader.cs

@ -0,0 +1,155 @@ @@ -0,0 +1,155 @@
//
// ScriptLoader.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class ScriptLoader : IScriptLoader
{
string root;
string typeScriptServicesFileName;
string mainScriptFileName;
string memberCompletionScriptFileName;
string typeScriptCompilerFileName;
string signatureScriptFileName;
string libScriptFileName;
string findReferencesScriptFileName;
string definitionScriptFileName;
string navigationScriptFileName;
string completionDetailsScriptFileName;
string languageServicesCompileScriptFileName;
string diagnosticsScriptFileName;
public ScriptLoader()
{
root = Path.Combine(StringParser.Parse("${addinpath:ICSharpCode.TypeScriptBinding}"), "Scripts");
root = Path.GetFullPath(root);
typeScriptServicesFileName = GetFullPath("typescriptServices.js");
mainScriptFileName = GetFullPath("main.js");
memberCompletionScriptFileName = GetFullPath("completion.js");
signatureScriptFileName = GetFullPath("signature.js");
findReferencesScriptFileName = GetFullPath("references.js");
definitionScriptFileName = GetFullPath("definition.js");
navigationScriptFileName = GetFullPath("navigation.js");
completionDetailsScriptFileName = GetFullPath("completionDetails.js");
languageServicesCompileScriptFileName = GetFullPath("compile.js");
diagnosticsScriptFileName = GetFullPath("diagnostics.js");
typeScriptCompilerFileName = GetFullPath("tsc.js");
libScriptFileName = GetFullPath("lib.d.ts");
}
public string RootFolder {
get { return root; }
}
public string TypeScriptCompilerFileName {
get { return typeScriptCompilerFileName; }
}
public string LibScriptFileName {
get { return libScriptFileName; }
}
string GetFullPath(string fileName)
{
return Path.Combine(root, fileName);
}
public string GetTypeScriptServicesScript()
{
return ReadScript(typeScriptServicesFileName);
}
string ReadScript(string fileName)
{
return File.ReadAllText(fileName);
}
public string GetMainScript()
{
return ReadScript(mainScriptFileName);
}
public string GetMemberCompletionScript()
{
return ReadScript(memberCompletionScriptFileName);
}
public string GetTypeScriptCompilerScript()
{
return ReadScript(typeScriptCompilerFileName);
}
public string GetFunctionSignatureScript()
{
return ReadScript(signatureScriptFileName);
}
public string GetLibScript()
{
return ReadScript(libScriptFileName);
}
public string GetFindReferencesScript()
{
return ReadScript(findReferencesScriptFileName);
}
public string GetDefinitionScript()
{
return ReadScript(definitionScriptFileName);
}
public string GetNavigationScript()
{
return ReadScript(navigationScriptFileName);
}
public string GetCompletionDetailsScript()
{
return ReadScript(completionDetailsScriptFileName);
}
public string GetLanguageServicesCompileScript()
{
return ReadScript(languageServicesCompileScriptFileName);
}
public string GetDiagnosticsScript()
{
return ReadScript(diagnosticsScriptFileName);
}
}
}

82
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptSnapshotShim.cs

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
//
// ScriptSnapshotShim.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013-2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Newtonsoft.Json;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class ScriptSnapshotShim : IScriptSnapshotShim
{
ILogger logger;
Script script;
public ScriptSnapshotShim(ILogger logger, Script script)
{
this.logger = logger;
this.script = script;
}
public string getText(int start, int end)
{
return script.Source.Substring(start, end - start);
}
public int getLength()
{
return script.Source.Length;
}
public string getChangeRange(IScriptSnapshotShim oldSnapshot)
{
Log("ScriptSnapshotShim.getChangeRange");
var old = oldSnapshot as ScriptSnapshotShim;
if ((old != null) && (script.Version == old.script.Version)) {
return null;
}
TextChangeRange textChangeRange = script.GetTextChangeRange(oldSnapshot);
string json = JsonConvert.SerializeObject(textChangeRange);
Log("ScriptSnapshotShim.getTextChangeRangeSinceVersion: json: {0}", json);
return json;
}
void Log(string format, params object[] args)
{
logger.log(String.Format(format, args));
}
public void dispose()
{
Log("ScriptSnapshotShim.dispose()");
}
}
}

41
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptTarget.cs

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
//
// ScriptTarget.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public enum ScriptTarget
{
ES3 = 0,
ES5 = 1,
ES6 = 2,
ES2015 = ES6,
Latest = ES6
}
}

42
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/ScriptsContainer.cs

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
//
// ScriptsContainer.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
/// <summary>
/// TODO: Move scripts dictionary out of shim host into here.
/// </summary>
public class ScriptsContainer
{
public ScriptsContainer()
{
}
}
}

91
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureHelpItem.cs

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
//
// FormalSignatureInfo.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013-2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
using System.Text;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class SignatureHelpItem
{
public SignatureHelpItem()
{
prefixDisplayParts = new SymbolDisplayPart[0];
suffixDisplayParts = new SymbolDisplayPart[0];
separatorDisplayParts = new SymbolDisplayPart[0];
parameters = new SignatureHelpParameter[0];
documentation = new SymbolDisplayPart[0];
}
public bool isVariadic { get; set; }
public SymbolDisplayPart[] prefixDisplayParts { get; set; }
public SymbolDisplayPart[] suffixDisplayParts { get; set; }
public SymbolDisplayPart[] separatorDisplayParts { get; set; }
public SignatureHelpParameter[] parameters { get; set; }
public SymbolDisplayPart[] documentation { get; set; }
public override string ToString()
{
if ((documentation == null) || (documentation.Length == 0)) {
return String.Empty;
}
return documentation[0].text;
}
public string GetInsightHeader()
{
if ((prefixDisplayParts == null) || (suffixDisplayParts == null) || (separatorDisplayParts == null)) {
return String.Empty;
}
var header = new StringBuilder();
AppendText(header, prefixDisplayParts);
bool parameterAdded = false;
foreach (SignatureHelpParameter parameter in parameters) {
AppendText(header, parameter.displayParts);
if (parameterAdded) {
AppendText(header, separatorDisplayParts);
}
parameterAdded = true;
}
AppendText(header, suffixDisplayParts);
return header.ToString();
}
void AppendText(StringBuilder textBuilder, SymbolDisplayPart[] parts)
{
foreach (SymbolDisplayPart part in parts) {
textBuilder.Append(part.text);
}
}
}
}

46
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureHelpItems.cs

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
//
// SignatureHelpItems.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013-2015 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class SignatureHelpItems
{
public SignatureHelpItems()
{
this.items = new SignatureHelpItem[0];
}
public SignatureHelpItem[] items { get; set; }
public TextSpan applicableSpan { get; set; }
public int selectedItemIndex { get; set; }
public int argumentIndex { get; set; }
public int argumentCount { get; set; }
}
}

40
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureHelpParameter.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
//
// SignatureHelpParameter.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013-2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class SignatureHelpParameter
{
public string name { get; set; }
public bool isOptional { get; set; }
public SymbolDisplayPart[] documentation { get; set; }
public SymbolDisplayPart[] displayParts { get; set; }
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SignatureResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// SignatureResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class SignatureResult
{
public SignatureHelpItems result { get; set; }
}
}

38
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/SymbolDisplayPart.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//
// SymbolDisplayPart.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class SymbolDisplayPart
{
public string text { get; set; }
public string kind { get; set; }
}
}

61
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TextChangeRange.cs

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
//
// TextChangeRange.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class TextChangeRange
{
public static TextChangeRange unchanged = new TextChangeRange(new TextSpan(0, 0), 0);
public TextChangeRange(int start, int length, int newLength)
: this(new TextSpan(start, length), newLength)
{
}
public TextChangeRange(TextSpan span, int newLength)
{
this.span = span;
this.newLength = newLength;
}
public TextSpan span { get; set; }
public int newLength { get; set; }
public TextSpan newSpan()
{
return new TextSpan(span.start, newLength);
}
public bool isUnchanged()
{
return span.isEmpty() && newLength == 0;
}
}
}

49
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TextSpan.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
//
// TextSpan.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class TextSpan
{
public TextSpan(int start, int length)
{
this.start = start;
this.length = length;
}
public int start { get; set; }
public int length { get; set; }
public bool isEmpty()
{
return length == 0;
}
}
}

37
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TextSpanResult.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//
// TextSpanResult.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class TextSpanResult
{
public TextSpan[] result { get; set; }
}
}

200
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TypeScriptContext.cs

@ -0,0 +1,200 @@ @@ -0,0 +1,200 @@
//
// TypeScriptContext.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using Noesis.Javascript;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class TypeScriptContext : IDisposable
{
JavascriptContext context = new JavascriptContext();
LanguageServiceShimHost host;
TypeScriptProject project;
IScriptLoader scriptLoader;
bool runInitialization = true;
public TypeScriptContext(IScriptLoader scriptLoader, ILogger logger)
{
this.scriptLoader = scriptLoader;
host = new LanguageServiceShimHost(logger);
host.AddDefaultLibScript(new FileName(scriptLoader.LibScriptFileName), scriptLoader.GetLibScript());
context.SetParameter("host", host);
context.Run(scriptLoader.GetTypeScriptServicesScript());
}
public void Dispose()
{
context.Dispose();
}
public void AddFile(FileName fileName, string text)
{
host.AddFile(fileName, text);
}
public void RunInitialisationScript()
{
if (runInitialization) {
runInitialization = false;
context.Run(scriptLoader.GetMainScript());
}
}
public void GetCompletionItemsForTheFirstTime()
{
// HACK - run completion on first file so the user does not have to wait about
// 1-2 seconds for the completion list to appear the first time it is triggered.
string fileName = host.GetFileNames().FirstOrDefault();
if (fileName != null) {
GetCompletionItems(new FileName(fileName), 1, String.Empty, false);
}
}
public void UpdateFile(FileName fileName, string text)
{
host.UpdateFile(fileName, text);
}
public CompletionInfo GetCompletionItems(FileName fileName, int offset, string text, bool memberCompletion)
{
UpdateCompilerSettings();
host.position = offset;
host.UpdateFileName(fileName);
host.isMemberCompletion = memberCompletion;
context.Run(scriptLoader.GetMemberCompletionScript());
return host.CompletionResult.result;
}
public CompletionEntryDetails GetCompletionEntryDetails(FileName fileName, int offset, string entryName)
{
UpdateCompilerSettings();
host.position = offset;
host.UpdateFileName(fileName);
host.completionEntry = entryName;
context.Run(scriptLoader.GetCompletionDetailsScript());
return host.CompletionEntryDetailsResult.result;
}
public SignatureHelpItems GetSignature(FileName fileName, int offset)
{
UpdateCompilerSettings();
host.position = offset;
host.UpdateFileName(fileName);
context.Run(scriptLoader.GetFunctionSignatureScript());
return host.SignatureResult.result;
}
public ReferenceEntry[] FindReferences(FileName fileName, int offset)
{
UpdateCompilerSettings();
host.position = offset;
host.UpdateFileName(fileName);
context.Run(scriptLoader.GetFindReferencesScript());
return host.ReferencesResult.result;
}
public DefinitionInfo[] GetDefinition(FileName fileName, int offset)
{
UpdateCompilerSettings();
host.position = offset;
host.UpdateFileName(fileName);
context.Run(scriptLoader.GetDefinitionScript());
return host.DefinitionResult.result;
}
public NavigationBarItem[] GetNavigationInfo(FileName fileName)
{
UpdateCompilerSettings();
host.UpdateFileName(fileName);
context.Run(scriptLoader.GetNavigationScript());
return host.NavigationResult.result;
}
public void RemoveFile(FileName fileName)
{
host.RemoveFile(fileName);
}
public EmitOutput Compile(FileName fileName, ITypeScriptOptions options)
{
host.UpdateCompilerSettings(options);
host.UpdateFileName(fileName);
context.Run(scriptLoader.GetLanguageServicesCompileScript());
return host.CompilerResult.result;
}
public Diagnostic[] GetDiagnostics(FileName fileName, ITypeScriptOptions options)
{
host.UpdateCompilerSettings(options);
host.UpdateFileName(fileName);
context.Run(scriptLoader.GetDiagnosticsScript());
return host.SemanticDiagnosticsResult.result.Concat(
host.SyntacticDiagnosticsResult.result)
.ToArray();
}
public void AddFiles(IEnumerable<TypeScriptFile> files)
{
foreach (TypeScriptFile file in files) {
AddFile(file.FileName, file.Text);
}
}
public void UseProjectForOptions(TypeScriptProject project)
{
this.project = project;
}
void UpdateCompilerSettings()
{
if (project != null) {
host.UpdateCompilerSettings(project);
}
}
}
}

54
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TypeScriptContextFactory.cs

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
//
// TypeScriptContextFactory.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class TypeScriptContextFactory : ITypeScriptContextFactory
{
IScriptLoader scriptLoader;
ILogger logger;
public TypeScriptContextFactory()
: this(new ScriptLoader(), new LanguageServiceLogger())
{
}
public TypeScriptContextFactory(IScriptLoader scriptLoader, ILogger logger)
{
this.scriptLoader = scriptLoader;
this.logger = logger;
}
public TypeScriptContext CreateContext()
{
return new TypeScriptContext(scriptLoader, logger);
}
}
}

139
src/AddIns/BackendBindings/TypeScript/Project/Src/Hosting/TypeScriptContextProvider.cs

@ -0,0 +1,139 @@ @@ -0,0 +1,139 @@
//
// TypeScriptContextProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class TypeScriptContextProvider
{
ITypeScriptContextFactory factory;
Dictionary<FileName, TypeScriptContext> cachedContexts =
new Dictionary<FileName, TypeScriptContext>();
Dictionary<FileName, TypeScriptContext> cachedContextsInsideProjects =
new Dictionary<FileName, TypeScriptContext>();
List<TypeScriptContext> projectContexts = new List<TypeScriptContext>();
public TypeScriptContextProvider()
: this(new TypeScriptContextFactory())
{
}
public TypeScriptContextProvider(ITypeScriptContextFactory factory)
{
this.factory = factory;
}
public TypeScriptContext CreateContext(FileName fileName, string text)
{
TypeScriptContext context = factory.CreateContext();
context.AddFile(fileName, text);
context.RunInitialisationScript();
context.GetCompletionItemsForTheFirstTime();
cachedContexts.Add(fileName, context);
return context;
}
public TypeScriptContext GetContext(FileName fileName)
{
TypeScriptContext context = null;
if (cachedContexts.TryGetValue(fileName, out context)) {
return context;
} else if (cachedContextsInsideProjects.TryGetValue(fileName, out context)) {
return context;
}
return null;
}
public bool IsFileInsideProject(FileName fileName)
{
return cachedContextsInsideProjects.ContainsKey(fileName);
}
public void DisposeContext(FileName fileName)
{
TypeScriptContext context = GetContext(fileName);
if (context != null) {
context.Dispose();
}
cachedContexts.Remove(fileName);
cachedContextsInsideProjects.Remove(fileName);
}
public TypeScriptContext CreateProjectContext(TypeScriptProject project)
{
TypeScriptContext context = factory.CreateContext();
projectContexts.Add(context);
foreach (FileName typeScriptFileName in project.GetTypeScriptFileNames()) {
AddFileToProjectContext(context, typeScriptFileName);
}
context.RunInitialisationScript();
context.UseProjectForOptions(project);
context.GetCompletionItemsForTheFirstTime();
return context;
}
void AddFileToProjectContext(TypeScriptContext context, FileName fileName)
{
cachedContextsInsideProjects.Add(fileName, context);
ITextSource fileContent = SD.FileService.GetFileContent(fileName);
context.AddFile(fileName, fileContent.Text);
}
public void DisposeAllProjectContexts()
{
foreach (TypeScriptContext context in projectContexts) {
context.Dispose();
}
cachedContextsInsideProjects = new Dictionary<FileName, TypeScriptContext>();
projectContexts = new List<TypeScriptContext>();
}
public void AddFileToProjectContext(TypeScriptProject project, FileName fileName)
{
if (projectContexts.Count == 0) {
CreateProjectContext(project);
} else {
TypeScriptContext context = projectContexts[0];
AddFileToProjectContext(context, fileName);
}
}
}
}

48
src/AddIns/BackendBindings/TypeScript/Project/Src/ITypeScriptOptions.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
//
// ITypeScriptOptions.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public interface ITypeScriptOptions
{
bool RemoveComments { get; }
bool GenerateSourceMap { get; }
bool NoImplicitAny { get; }
string ModuleKind { get; }
string EcmaScriptVersion { get; }
ScriptTarget GetScriptTarget();
ModuleKind GetModuleTarget();
string GetOutputFileFullPath();
string GetOutputDirectoryFullPath();
}
}

41
src/AddIns/BackendBindings/TypeScript/Project/Src/InitializeTypeScriptServiceCommand.cs

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
//
// InitializeTypeScriptServiceCommand.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding
{
public class InitializeTypeScriptServiceCommand : AbstractCommand
{
public override void Run()
{
TypeScriptService.Initialize();
}
}
}

44
src/AddIns/BackendBindings/TypeScript/Project/Src/RegisterIconsCommand.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
//
// RegisterIconsCommand.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.TypeScriptBinding
{
public class RegisterIconsCommand : AbstractCommand
{
public override void Run()
{
Assembly assembly = typeof(RegisterIconsCommand).Assembly;
SD.ResourceService.RegisterImages("ICSharpCode.TypeScriptBinding.Resources.ImageResources", assembly);
}
}
}

52
src/AddIns/BackendBindings/TypeScript/Project/Src/RegisterTypeScriptCompileBuildOnCommand.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
//
// RegisterTypeScriptCompileOnBuildCommand.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.TypeScriptBinding
{
public class RegisterTypeScriptCompileBuildOnCommand : AbstractCommand
{
public RegisterTypeScriptCompileBuildOnCommand()
{
}
public override void Run()
{
ProjectService.BuildStarted += BuildStarted;
}
void BuildStarted(object sender, BuildEventArgs e)
{
var action = new CompileTypeScriptFilesOnBuildAction();
action.CompileFiles(e.Projects);
}
}
}

64
src/AddIns/BackendBindings/TypeScript/Project/Src/RegisterTypeScriptCompileOnSaveFileCommand.cs

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
//
// RegisterTypeScriptCompileOnSaveFileCommand.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class RegisterTypeScriptCompileOnSaveFileCommand : AbstractCommand
{
public RegisterTypeScriptCompileOnSaveFileCommand()
{
}
public override void Run()
{
FileUtility.FileSaved += FileSaved;
}
void FileSaved(object sender, FileNameEventArgs e)
{
if (!TypeScriptFileExtensions.IsTypeScriptFileName(e.FileName))
return;
TypeScriptProject project = TypeScriptService.GetProjectForFile(e.FileName);
if (project == null)
return;
if (project.CompileOnSave) {
var action = new CompileTypeScriptOnSaveFileAction();
TypeScriptContext context = TypeScriptService.ContextProvider.GetContext(e.FileName);
action.Compile(e.FileName, project, context);
}
}
}
}

99
src/AddIns/BackendBindings/TypeScript/Project/Src/RenameTypeScriptReferenceCommand.cs

@ -0,0 +1,99 @@ @@ -0,0 +1,99 @@
//
// RenameTypeScriptReferenceCommand.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.Search;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Refactoring;
using SearchAndReplace;
namespace ICSharpCode.TypeScriptBinding
{
public class RenameTypeScriptReferenceCommand : AbstractCommand
{
public override void Run()
{
ITextEditor textEditor = SD.Workbench.ActiveViewContent.GetService<ITextEditor>();
if (textEditor != null) {
List<SearchResultMatch> references = TypeScriptCodeCompletionBinding.GetReferences(textEditor);
if (references.Count == 0) {
ShowUnknownReferenceError();
} else {
RenameAllReferences(references);
}
}
}
static void ShowUnknownReferenceError()
{
MessageService.ShowMessage("${res:SharpDevelop.Refactoring.CannotRenameElement}");
}
void RenameAllReferences(List<SearchResultMatch> references)
{
SearchResultMatch firstResult = references.First();
var document = new ReadOnlyDocument(SD.FileService.GetFileContent(firstResult.FileName));
string name = document.GetText(firstResult.StartOffset, firstResult.Length);
string newName = GetNewName(name);
if (ShouldRenameReference(newName, name)) {
ApplyRenames(references, newName);
}
}
void ApplyRenames(List<SearchResultMatch> references, string newName)
{
List<SearchedFile> files = references
.GroupBy(reference => reference.FileName)
.Select(grouping => new SearchedFile(grouping.Key, grouping.ToList()))
.ToList();
var token = new CancellationToken();
SearchManager.ReplaceAll(files, newName, token);
}
string GetNewName(string name)
{
return MessageService.ShowInputBox(
"${res:SharpDevelop.Refactoring.Rename}",
"${res:SharpDevelop.Refactoring.RenameClassText}",
name);
}
bool ShouldRenameReference(string newName, string name)
{
return (newName != null) && (newName != name);
}
}
}

198
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptCodeCompletionBinding.cs

@ -0,0 +1,198 @@ @@ -0,0 +1,198 @@
//
// TypeScriptCodeCompletionBinding.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.Core;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.SharpDevelop.Editor.Search;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Refactoring;
using ICSharpCode.SharpDevelop.Workbench;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptCodeCompletionBinding : ICodeCompletionBinding
{
// TypeScriptInsightWindowHandler insightHandler = new TypeScriptInsightWindowHandler();
public CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch)
{
if (ch == '.') {
InsertCharacter(editor, ch);
ShowCompletion(editor, true);
return CodeCompletionKeyPressResult.EatKey;
} else if (ch == '(') {
InsertCharacter(editor, ch);
ShowMethodInsight(editor);
return CodeCompletionKeyPressResult.EatKey;
}
return CodeCompletionKeyPressResult.None;
}
public bool HandleKeyPressed(ITextEditor editor, char ch)
{
return false;
}
void InsertCharacter(ITextEditor editor, char ch)
{
editor.Document.Insert(editor.Caret.Offset, ch.ToString());
}
bool ShowCompletion(ITextEditor editor, bool memberCompletion)
{
TypeScriptContext context = GetContext(editor);
UpdateContext(context, editor);
var completionProvider = new TypeScriptCompletionItemProvider(context);
return completionProvider.ShowCompletion(editor, memberCompletion);
}
static TypeScriptContext GetContext(ITextEditor editor)
{
return TypeScriptService.ContextProvider.GetContext(editor.FileName);
}
static void UpdateContext(TypeScriptContext context, ITextEditor editor)
{
if (IsFileInsideProject(editor.FileName)) {
UpdateAllOpenFiles(context);
} else {
context.UpdateFile(editor.FileName, editor.Document.Text);
}
}
static bool IsFileInsideProject(FileName fileName)
{
return TypeScriptService.ContextProvider.IsFileInsideProject(fileName);
}
static void UpdateAllOpenFiles(TypeScriptContext context)
{
foreach (IViewContent view in SD.Workbench.ViewContentCollection) {
if (TypeScriptParser.IsTypeScriptFileName(view.PrimaryFileName)) {
if (IsFileInsideProject(view.PrimaryFileName)) {
UpdateContext(context, view.PrimaryFileName);
}
}
}
}
static void UpdateContext(TypeScriptContext context, FileName fileName)
{
ITextSource fileContent = GetFileContent(fileName);
context.UpdateFile(fileName, fileContent.Text);
}
static ITextSource GetFileContent(string fileName)
{
return SD.FileService.GetFileContent(fileName);
}
public bool CtrlSpace(ITextEditor editor)
{
return ShowCompletion(editor, false);
}
void ShowMethodInsight(ITextEditor editor)
{
TypeScriptContext context = GetContext(editor);
UpdateContext(context, editor);
var provider = new TypeScriptFunctionInsightProvider(context);
IInsightItem[] items = provider.ProvideInsight(editor);
IInsightWindow insightWindow = editor.ShowInsightWindow(items);
// if (insightWindow != null) {
// insightHandler.InitializeOpenedInsightWindow(editor, insightWindow);
// insightHandler.HighlightParameter(insightWindow, 0);
// }
}
public static List<SearchResultMatch> GetReferences(ITextEditor editor)
{
TypeScriptContext context = GetContext(editor);
UpdateContext(context, editor);
ReferenceEntry[] entries = context.FindReferences(editor.FileName, editor.Caret.Offset);
if (entries == null) {
return new List<SearchResultMatch>();
}
return entries
.Select(entry => CreateSearchResultMatch(entry))
.ToList();
}
static SearchResultMatch CreateSearchResultMatch(ReferenceEntry entry)
{
ITextSource textSource = SD.FileService.GetFileContent(entry.fileName);
var document = new ReadOnlyDocument(textSource, entry.fileName);
TextLocation start = document.GetLocation(entry.minChar);
TextLocation end = document.GetLocation(entry.minChar + entry.length);
IHighlighter highlighter = SD.EditorControlService.CreateHighlighter(document);
return SearchResultMatch.Create(document, start, end, highlighter);
}
public static void GoToDefinition(ITextEditor editor)
{
TypeScriptContext context = GetContext(editor);
UpdateContext(context, editor);
DefinitionInfo[] definitions = context.GetDefinition(editor.FileName, editor.Caret.Offset);
if ((definitions != null) && (definitions.Length > 0)) {
GoToDefinition(definitions[0]);
}
}
static void GoToDefinition(DefinitionInfo definition)
{
if (!definition.HasFileName())
return;
IViewContent view = FileService.OpenFile(definition.fileName);
if (view == null)
return;
ITextEditor textEditor = view.GetService<ITextEditor>();
if (textEditor != null) {
TextLocation location = textEditor.Document.GetLocation(definition.minChar);
FileService.JumpToFilePosition(definition.fileName, location.Line, location.Column);
}
}
}
}

129
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptCompletionItem.cs

@ -0,0 +1,129 @@ @@ -0,0 +1,129 @@
//
// TypeScriptCompletionItem.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptCompletionItem : DefaultCompletionItem
{
CompletionEntry entry;
CompletionEntryDetailsProvider completionDetailsProvider;
string description;
public TypeScriptCompletionItem(CompletionEntry entry, CompletionEntryDetailsProvider completionDetailsProvider)
: base(entry.name)
{
this.entry = entry;
this.completionDetailsProvider = completionDetailsProvider;
Image = GetImage(entry);
}
public override string Description {
get {
if (description == null) {
description = GetDescription();
}
return description;
}
set { }
}
string GetDescription()
{
CompletionEntryDetails entryDetails = completionDetailsProvider.GetCompletionEntryDetails(entry.name);
if (entryDetails == null) {
return entry.name;
}
return GetDescription(entryDetails);
}
string GetDescription(CompletionEntryDetails entryDetails)
{
return String.Format(
"{0} {1}",
GetFullSymbolName(entryDetails),
GetDocCommentPrecededByNewLine(entryDetails));
}
static string GetFullSymbolName(CompletionEntryDetails entryDetails)
{
if (entryDetails.displayParts == null) {
return String.Empty;
}
var name = new StringBuilder();
foreach (SymbolDisplayPart part in entryDetails.displayParts) {
name.Append(part.text);
}
return name.ToString();
}
string GetDocCommentPrecededByNewLine(CompletionEntryDetails entryDetails)
{
if ((entryDetails.documentation == null) || (entryDetails.documentation.Length == 0)) {
return String.Empty;
}
return String.Format("\r\n{0}", entryDetails.documentation[0].text);
}
IImage GetImage(CompletionEntry entry)
{
switch (entry.kind) {
case "property":
return ClassBrowserIconService.Property;
case "constructor":
case "getter":
case "setter":
case "method":
case "function":
case "local function":
return ClassBrowserIconService.Method;
case "keyword":
return ClassBrowserIconService.Keyword;
case "class":
return ClassBrowserIconService.Class;
case "var":
case "local var":
return ClassBrowserIconService.LocalVariable;
case "interface":
return ClassBrowserIconService.Interface;
case "module":
return ClassBrowserIconService.Namespace;
default:
return null;
}
}
}
}

80
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptCompletionItemProvider.cs

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
//
// TypeScriptCompletionItemProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptCompletionItemProvider
{
TypeScriptContext context;
bool memberCompletion;
public TypeScriptCompletionItemProvider(TypeScriptContext context)
{
this.context = context;
}
public bool ShowCompletion(ITextEditor editor, bool memberCompletion)
{
this.memberCompletion = memberCompletion;
ICompletionItemList list = GenerateCompletionList(editor);
if (list.Items.Any()) {
editor.ShowCompletionWindow(list);
return true;
}
return false;
}
public ICompletionItemList GenerateCompletionList(ITextEditor editor)
{
CompletionInfo result = context.GetCompletionItems(
editor.FileName,
editor.Caret.Offset,
editor.Document.Text,
memberCompletion);
var itemList = new DefaultCompletionItemList();
if (result != null) {
var completionDetailsProvider = new CompletionEntryDetailsProvider(
context,
editor.FileName,
editor.Caret.Offset);
itemList.Items.AddRange(result.entries.Select(entry => new TypeScriptCompletionItem(entry, completionDetailsProvider)));
itemList.SortItems();
}
return itemList;
}
}
}

45
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFile.cs

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
//
// TypeScriptFile.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.Core;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptFile
{
public TypeScriptFile(FileName fileName, string text)
{
FileName = fileName;
Text = text;
}
public string Text { get; private set; }
public FileName FileName { get; private set; }
}
}

42
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFileExtensions.cs

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
//
// TypeScriptFileExtensions.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
namespace ICSharpCode.TypeScriptBinding
{
public static class TypeScriptFileExtensions
{
public static bool IsTypeScriptFileName(string fileName)
{
string extension = Path.GetExtension(fileName);
return String.Equals(extension, ".ts", StringComparison.OrdinalIgnoreCase);
}
}
}

41
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFormattingStrategy.cs

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
//
// TypeScriptFormattingStrategy.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptFormattingStrategy : DefaultFormattingStrategy
{
public override void SurroundSelectionWithComment(ITextEditor editor)
{
SurroundSelectionWithSingleLineComment(editor, "//");
}
}
}

96
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFunctionInsightItem.cs

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
//
// TypeScriptFunctionInsightItem.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Text;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptFunctionInsightItem : IInsightItem
{
SignatureHelpItem helpItem;
string header;
public TypeScriptFunctionInsightItem(SignatureHelpItem helpItem)
{
this.helpItem = helpItem;
}
public object Header {
get {
if (header == null) {
GenerateHeader();
}
return header;
}
}
void GenerateHeader()
{
header = helpItem.GetInsightHeader();
}
public object Content {
get {
if ((helpItem.documentation == null) || (helpItem.documentation.Length == 0)) {
return String.Empty;
}
if ((helpItem.parameters != null) && (helpItem.parameters.Length > 0)) {
return helpItem.ToString() + GetParametersText(helpItem.parameters);
}
return helpItem.ToString();
}
}
string GetParametersText(SignatureHelpParameter[] parameters)
{
var builder = new StringBuilder();
foreach (SignatureHelpParameter parameter in parameters) {
if (parameter.documentation != null && parameter.documentation.Length > 0) {
builder.Append(parameter.name);
builder.Append(": ");
builder.Append(parameter.documentation[0].text);
}
}
return Environment.NewLine + builder.ToString();
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null) {
PropertyChanged(this, e);
}
} }
}

58
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptFunctionInsightProvider.cs

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
//
// TypeScriptFunctionInsightProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptFunctionInsightProvider
{
TypeScriptContext context;
public TypeScriptFunctionInsightProvider(TypeScriptContext context)
{
this.context = context;
}
public IInsightItem[] ProvideInsight(ITextEditor editor)
{
SignatureHelpItems helpItems = context.GetSignature(editor.FileName, editor.Caret.Offset);
if (helpItems == null)
return new TypeScriptFunctionInsightItem[0];
return helpItems
.items
.Select(item => new TypeScriptFunctionInsightItem(item))
.ToArray();
}
}
}

65
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptInsightWindowHandler.cs

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
////
//// TypeScriptMethodInsightProvider.cs
////
//// Author:
//// Matt Ward <ward.matt@gmail.com>
////
//// Copyright (C) 2013 Matthew Ward
////
//// Permission is hereby granted, free of charge, to any person obtaining
//// a copy of this software and associated documentation files (the
//// "Software"), to deal in the Software without restriction, including
//// without limitation the rights to use, copy, modify, merge, publish,
//// distribute, sublicense, and/or sell copies of the Software, and to
//// permit persons to whom the Software is furnished to do so, subject to
//// the following conditions:
////
//// The above copyright notice and this permission notice shall be
//// included in all copies or substantial portions of the Software.
////
//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
//// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
//// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
//// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
//// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
//// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////
//
//using System;
//using ICSharpCode.SharpDevelop.Editor;
//using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
//
//namespace ICSharpCode.TypeScriptBinding
//{
// public class TypeScriptInsightWindowHandler : IInsightWindowHandler
// {
// ITextEditor editor;
// IInsightWindow insightWindow;
//
// public void InitializeOpenedInsightWindow(ITextEditor editor, IInsightWindow insightWindow)
// {
// this.editor = editor;
// this.insightWindow = insightWindow;
// int offset = insightWindow.StartOffset;
// insightWindow.DocumentChanged += DocumentChanged;
// }
//
// void DocumentChanged(object sender, TextChangeEventArgs e)
// {
// //if (IsOutsideMethodCall()) {
// insightWindow.Close();
// //}
// }
//
// public bool InsightRefreshOnComma(ITextEditor editor, char ch, out IInsightWindow insightWindow)
// {
// insightWindow = null;
// return false;
// }
//
// public void HighlightParameter(IInsightWindow window, int index)
// {
// }
// }
//}

43
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptLanguageBinding.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
//
// TypeScriptLanguageBinding.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptLanguageBinding : DefaultLanguageBinding
{
public TypeScriptLanguageBinding()
{
container.AddService(typeof(IFormattingStrategy), new TypeScriptFormattingStrategy());
}
}
}

83
src/AddIns/BackendBindings/TypeScript/Project/Src/TypeScriptOptions.cs

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
//
// TypeScriptOptions.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptOptions : ITypeScriptOptions
{
public TypeScriptOptions()
{
}
public TypeScriptOptions(ITypeScriptOptions options)
{
RemoveComments = options.RemoveComments;
GenerateSourceMap = options.GenerateSourceMap;
NoImplicitAny = options.NoImplicitAny;
ModuleKind = options.ModuleKind;
EcmaScriptVersion = options.EcmaScriptVersion;
ModuleTarget = options.GetModuleTarget();
ScriptTarget = options.GetScriptTarget();
OutputFileName = options.GetOutputFileFullPath();
OutputDirectory = options.GetOutputDirectoryFullPath();
}
public bool RemoveComments { get; set; }
public bool GenerateSourceMap { get; set; }
public bool NoImplicitAny { get; set; }
public string ModuleKind { get; set; }
public string EcmaScriptVersion { get; set; }
public string OutputFileName { get; set; }
public string OutputDirectory { get; set; }
public ModuleKind ModuleTarget { get; set; }
public ScriptTarget ScriptTarget { get; set; }
public ScriptTarget GetScriptTarget()
{
return ScriptTarget;
}
public ModuleKind GetModuleTarget()
{
return ModuleTarget;
}
public string GetOutputFileFullPath()
{
return OutputFileName;
}
public string GetOutputDirectoryFullPath()
{
return OutputDirectory;
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save