├── .gitattributes ├── .gitignore ├── .paket ├── Paket.Restore.targets ├── paket.exe ├── paket.exe.config └── paket.targets ├── .travis.yml ├── FSharp.Editing.sln ├── FSharp.Editing.userprefs ├── LICENSE.txt ├── README.md ├── RELEASE_NOTES.md ├── appveyor.yml ├── build.cmd ├── build.fsx ├── build.sh ├── global.json ├── paket.dependencies ├── paket.lock ├── scripts ├── GenNetcore.fsx └── XLinq.fsx ├── src ├── FSharp.Editing.Client │ ├── Client.fs │ ├── FSharp.Editing.Client.fsproj │ ├── Scripts │ │ ├── Script.fsx │ │ ├── load-project-debug.fsx │ │ ├── load-project-release.fsx │ │ ├── load-references-debug.fsx │ │ └── load-references-release.fsx │ └── paket.references ├── FSharp.Editing.Core │ ├── AssemblyContentProvider.fs │ ├── CodeAnalysisExtensions.fs │ ├── CompilerLocationUtils.fs │ ├── Constants.fs │ ├── Extensions.fs │ ├── FSharp.Editing.Core.fsproj │ ├── IdentifierUtils.fs │ ├── Lexer.fs │ ├── Logging.fs │ ├── Pervasive.fs │ ├── ProjectFileInfo.fs │ ├── QuickParse.fs │ ├── Text.fs │ ├── TypedAstUtils.fs │ ├── UntypedAstUtils.fs │ ├── Utils.fs │ └── paket.references ├── FSharp.Editing.Messages │ ├── AssemblyInfo.fs │ ├── FSharp.Editing.Messages.fsproj │ ├── Messages.fs │ ├── Scripts │ │ ├── Script1.fsx │ │ ├── load-project-debug.fsx │ │ ├── load-project-release.fsx │ │ ├── load-references-debug.fsx │ │ └── load-references-release.fsx │ ├── Serialization.fs │ ├── Utils.fs │ └── paket.references ├── FSharp.Editing.ProjectInspector │ ├── FSharp.Editing.ProjectInspector.fsproj │ ├── ProfectFileInfo.fs │ ├── Program.fs │ └── paket.references ├── FSharp.Editing.Server │ ├── AssemblyInfo.fs │ ├── Context.fs │ ├── FSharp.Editing.Server.fsproj │ ├── Program.fs │ ├── ProjectSystem.fs │ ├── Service.fs │ ├── Utilites.fs │ └── paket.references ├── FSharp.Editing │ ├── AssemblyInfo.fs │ ├── CodeGeneration │ │ ├── CodeGeneration.fs │ │ ├── IndentedTextWriter.fs │ │ ├── InterfaceStubGenerator.fs │ │ ├── OpenDeclarationsGetter.fs │ │ ├── RecordStubGenerator.fs │ │ ├── SignatureGenerator.fs │ │ ├── UnionPatternMatchCaseGenerator.fs │ │ └── siggenv2.fs │ ├── Coloring │ │ ├── DepthParser.fs │ │ ├── DocumentHighlights.fs │ │ ├── HighlightUsageInFile.fs │ │ ├── OpenDeclarationsGetter.fs │ │ ├── PrintfSpecifiersUsageGetter.fs │ │ └── UnopenedNamespacesResolver.fs │ ├── Completion │ │ ├── FileSystemCompletion.fs │ │ └── SignatureHelp.fs │ ├── Documentation │ │ ├── XmlDocBuilder.fs │ │ ├── XmlDocCache.fs │ │ ├── XmlDocGenerator.fs │ │ └── XmlDocParser.fs │ ├── FSharp.Editing.fsproj │ ├── FsLanguageService.fsx │ ├── Navigation │ │ ├── GoToDeclaration.fs │ │ ├── GoToDefinition.fs │ │ ├── GoToImplementation.fs │ │ ├── GoToSignature.fs │ │ ├── NavigableItemCache.fs │ │ ├── NavigableItemsCollector.fs │ │ ├── NavigateToIndex.fs │ │ ├── NavigateToItem.fs │ │ ├── NavigateToMetadata.fs │ │ └── NavigateToReferenceSource.fs │ ├── ProjectSystem │ │ ├── FSharpWorkspace.fs │ │ ├── FileSystem.fs │ │ ├── FileSystemWatcher.fs │ │ ├── HostServices.fs │ │ ├── LanguageService.fs │ │ ├── MSBuildEvaluation.fs │ │ ├── OpenDocumentsTracker.fs │ │ ├── ProjectConfig.fs │ │ ├── ProjectSitesAndFiles.fs │ │ ├── SolutionFileInfo.fs │ │ └── SolutionProvider.fs │ ├── Scratchpad.fsx │ ├── Scripts │ │ ├── load-project-debug.fsx │ │ ├── load-project-release.fsx │ │ ├── load-references-debug.fsx │ │ └── load-references-release.fsx │ ├── Structure │ │ └── BlockStructure.fs │ ├── Symbols │ │ ├── QuickInfoProvider.fs │ │ ├── SourceCodeClassifier.fs │ │ └── SymbolHelpers.fs │ └── paket.references ├── TestConsole │ ├── AssemblyInfo.fs │ ├── Program.fs │ ├── TestConsole.fsproj │ └── paket.references └── netcore │ ├── FSharp.Editing.Client │ └── paket.references │ ├── FSharp.Editing.Core │ └── paket.references │ ├── FSharp.Editing.Messages │ └── paket.references │ ├── FSharp.Editing.ProjectInspector │ └── paket.references │ ├── FSharp.Editing.Server │ └── paket.references │ ├── FSharp.Editing.netcore.sln │ ├── FSharp.Editing │ └── paket.references │ └── TestConsole │ └── paket.references └── tests ├── FSharp.Editing.Tests ├── CodeGenerationTestInfrastructure.fs ├── DepthColorizerTests.fs ├── FSharp.Editing.Tests.fsproj ├── GetUsesOfSymbolInFileTests.fs ├── GoToDefinitionTests.LoadDirective.fs ├── GoToDefinitionTests.fs ├── IdentifierDetectionTests.fs ├── InterfaceStubGeneratorTests.fs ├── LanguageServiceTests.fs ├── LexerTests.fs ├── NavigableItemsCollectorTests.fs ├── NavigateToIndexTests.fs ├── OpenDeclarationsGetterTests.fs ├── OutliningTests.fs ├── PrintfSpecifiersUsageGetterTests.fs ├── RecordStubGeneratorTests.fs ├── RenameTests.fs ├── SymbolClassifierTests.fs ├── TestHelpers.fs ├── UnionPatternMatchCaseGeneratorTests.fs ├── UnopenedNamespacesResolverTests.fs ├── UnusedSymbolClassifierTests.fs ├── UtilsTests.fs ├── XmlDocTests.fs └── paket.references └── data ├── DepthColorizerSampleFile.fs ├── FSharpSignature ├── FSharpSignature.fsproj ├── Program.fs ├── Sample.fs ├── Sample.fsi └── paket.references ├── InterfaceSampleFile.fs ├── LanguageServiceSampleFile.fs ├── MultiProjects ├── MultiProjects.sln ├── Project1.dll.mdb ├── Project1 │ ├── Project1.fsproj │ ├── Project11.fs │ └── paket.references ├── Project2.dll.mdb └── Project2 │ ├── Project2.fsproj │ ├── Project21.fs │ └── paket.references ├── NavigateToSource ├── FAKETests.fs ├── NavigateToSource.fsproj ├── NavigateToSource.sln ├── OctokitTests.fs └── paket.references ├── ParseLoadDirectives ├── includes │ ├── a.fs │ └── b.fs └── test1.fsx ├── TypeProviderTests ├── DesignTimeURIs │ └── 0CdPVqScGxbsHluW0KvuHpKSPow%3D.txt ├── FreebaseSchema │ └── 0CdPVqScGxbsHluW0KvuHpKSPow%3D.txt ├── TypeProviderTests.fs ├── TypeProviderTests.fsproj ├── TypeProviderTests.sln ├── WorldBankSchema │ └── 0CdPVqScGxbsHluW0KvuHpKSPow%3D.txt └── paket.references ├── XmlDocSampleFile.fs └── gotodef ├── generic-cases ├── adds-necessary-parenthesis-to-function-parameters │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── adds-necessary-parenthesis-to-tuple-parameters │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-3 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-4 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-5 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-6 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-7 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── double-backtick-identifiers-are-supported-8 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-abstract-class-definition-with-default-members │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-class-definition-with-events │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-constructor-less-struct-metadata │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-empty-class-metadata │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-empty-interface-metadata │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-empty-struct-metadata │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-enum-type-definition │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-f#-exception-definition-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-f#-exception-definition-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-f#-list-'t-definition │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-interface-definition │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-metadata-from-module-and-module-function-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-metadata-from-module-and-module-function-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-method-definition-generate-enclosing-type-metadata-and-supports-c#-events │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-non-abstract-class-definition-with-virtual-member │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-partial-active-patterns │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-property-definition-generate-enclosing-type-metadata │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-record-type-definition │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-struct-metadata │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-subclass-class-definition-with-override-members │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-total-active-patterns-should-display-enclosing-module-or-namespace │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-total-active-patterns │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-tuple-definition-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-tuple-definition-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-type-abbreviation-definition │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-type-definition-that-contains-c#-events │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-union-case │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── go-to-union-type-definition │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-class-extension-members │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-class-properties-with-setter │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-delegates-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-delegates-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-double-backtick-identifiers-on-member-constraints-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-double-backtick-identifiers-on-member-constraints-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-methods │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-module-functions-and-values-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-module-functions-and-values-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-type-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-type-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-type-3 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-type-4 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-generic-constraints-on-type-5 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-nested-modules │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-optional-parameters │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-property-method-attributes │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-record-extension-members │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-record-field-attributes │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-statically-resolved-constraints-1 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-statically-resolved-constraints-2 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-statically-resolved-constraints-3 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-statically-resolved-constraints-4 │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-union-case-attributes │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── handle-union-type-extension-members │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── members-are-sorted-this-way-abstract-member-member-static-member │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── operator-names-are-demangled │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── set-up-transitive-open-declarations-correctly │ ├── expected.fs │ ├── input.fs │ └── settings.json ├── support-compiled-name-attribute │ ├── expected.fs │ ├── input.fs │ └── settings.json └── type-abbreviations-for-basic-types │ ├── expected.fs │ ├── input.fs │ └── settings.json └── generic-sample └── settings.list.json /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Generated netcore projects 2 | 3 | src/netcore/**/app.config 4 | src/netcore/**/*.fsproj 5 | 6 | ## paket.references for generated projects should be tracked 7 | #!src/netcore/**/paket.references 8 | #!src/netcore/**/*.paket.references 9 | 10 | 11 | ## Ignore Visual Studio temporary files, build results, and 12 | ## files generated by popular Visual Studio add-ons. 13 | 14 | # User-specific files 15 | *.suo 16 | *.user 17 | *.sln.docstates 18 | 19 | # Roslyn cache directories 20 | *.ide 21 | 22 | # Build results 23 | 24 | [Dd]ebug/ 25 | [Rr]elease/ 26 | x64/ 27 | build/ 28 | [Bb]in/ 29 | [Oo]bj/ 30 | 31 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 32 | !packages/*/build/ 33 | 34 | # MSTest test Results 35 | [Tt]est[Rr]esult*/ 36 | [Bb]uild[Ll]og.* 37 | 38 | *_i.c 39 | *_p.c 40 | *.ilk 41 | *.meta 42 | *.obj 43 | *.pch 44 | *.pdb 45 | *.pgc 46 | *.pgd 47 | *.rsp 48 | *.sbr 49 | *.tlb 50 | *.tli 51 | *.tlh 52 | *.tmp 53 | *.tmp_proj 54 | *.log 55 | *.vspscc 56 | *.vssscc 57 | .builds 58 | *.pidb 59 | *.svclog 60 | *.scc 61 | 62 | # Visual C++ cache files 63 | ipch/ 64 | *.aps 65 | *.ncb 66 | *.opensdf 67 | *.sdf 68 | *.cachefile 69 | 70 | # Visual Studio profiler 71 | *.psess 72 | *.vsp 73 | *.vspx 74 | 75 | # Guidance Automation Toolkit 76 | *.gpState 77 | 78 | # ReSharper is a .NET coding add-in 79 | _ReSharper*/ 80 | *.[Rr]e[Ss]harper 81 | 82 | # TeamCity is a build add-in 83 | _TeamCity* 84 | 85 | # DotCover is a Code Coverage Tool 86 | *.dotCover 87 | 88 | # NCrunch 89 | *.ncrunch* 90 | .*crunch*.local.xml 91 | 92 | # Installshield output folder 93 | [Ee]xpress/ 94 | 95 | # DocProject is a documentation generator add-in 96 | DocProject/buildhelp/ 97 | DocProject/Help/*.HxT 98 | DocProject/Help/*.HxC 99 | DocProject/Help/*.hhc 100 | DocProject/Help/*.hhk 101 | DocProject/Help/*.hhp 102 | DocProject/Help/Html2 103 | DocProject/Help/html 104 | 105 | # Click-Once directory 106 | publish/ 107 | 108 | # Publish Web Output 109 | *.Publish.xml 110 | 111 | # Enable nuget.exe in the .nuget folder (though normally executables are not tracked) 112 | !.nuget/NuGet.exe 113 | 114 | # Windows Azure Build Output 115 | csx 116 | *.build.csdef 117 | 118 | # Windows Store app package directory 119 | AppPackages/ 120 | 121 | # Others 122 | sql/ 123 | *.Cache 124 | ClientBin/ 125 | [Ss]tyle[Cc]op.* 126 | ~$* 127 | *~ 128 | *.dbmdl 129 | *.[Pp]ublish.xml 130 | *.pfx 131 | *.publishsettings 132 | 133 | # RIA/Silverlight projects 134 | Generated_Code/ 135 | 136 | # Backup & report files from converting an old project file to a newer 137 | # Visual Studio version. Backup files are not needed, because we have git ;-) 138 | _UpgradeReport_Files/ 139 | Backup*/ 140 | UpgradeLog*.XML 141 | UpgradeLog*.htm 142 | 143 | # SQL Server files 144 | App_Data/*.mdf 145 | App_Data/*.ldf 146 | 147 | 148 | #LightSwitch generated files 149 | GeneratedArtifacts/ 150 | _Pvt_Extensions/ 151 | ModelManifest.xml 152 | 153 | # ========================= 154 | # Windows detritus 155 | # ========================= 156 | 157 | # Windows image file caches 158 | Thumbs.db 159 | ehthumbs.db 160 | 161 | # Folder config file 162 | Desktop.ini 163 | 164 | # Recycle Bin used on file shares 165 | $RECYCLE.BIN/ 166 | 167 | # Mac desktop service store files 168 | .DS_Store 169 | 170 | # =================================================== 171 | # Exclude F# project specific directories and files 172 | # =================================================== 173 | 174 | # NuGet Packages Directory 175 | packages/ 176 | 177 | # Generated documentation folder 178 | docs/output/ 179 | 180 | # Temp folder used for publishing docs 181 | temp/ 182 | 183 | # Test results produced by build 184 | TestResults.xml 185 | 186 | # Nuget outputs 187 | nuget/*.nupkg 188 | src/FSharpVSPowerTools/Properties/AssemblyInfo.cs 189 | *.orig 190 | paket-files 191 | *.xml 192 | 193 | release.cmd 194 | /src/*/Scripts/* 195 | tests/data/*/*.dll 196 | tests/data/*/*.xml 197 | tests/data/*/*.pdb 198 | 199 | _NCrunch_* 200 | build_PRIVATE.cmd 201 | gallerycredentials.txt 202 | .fake 203 | 204 | .vs/config/applicationhost.config 205 | *.FSharpLint 206 | -------------------------------------------------------------------------------- /.paket/paket.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/.paket/paket.exe -------------------------------------------------------------------------------- /.paket/paket.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.paket/paket.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | true 7 | $(MSBuildThisFileDirectory) 8 | $(MSBuildThisFileDirectory)..\ 9 | /Library/Frameworks/Mono.framework/Commands/mono 10 | mono 11 | 12 | 13 | 14 | 15 | $(PaketRootPath)paket.exe 16 | $(PaketToolsPath)paket.exe 17 | "$(PaketExePath)" 18 | $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" 19 | 20 | 21 | 22 | 23 | 24 | $(MSBuildProjectFullPath).paket.references 25 | 26 | 27 | 28 | 29 | $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references 30 | 31 | 32 | 33 | 34 | $(MSBuildProjectDirectory)\paket.references 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references 47 | $(MSBuildProjectDirectory)\paket.references 48 | $(MSBuildStartupDirectory)\paket.references 49 | $(MSBuildProjectFullPath).paket.references 50 | $(PaketCommand) restore --references-files "$(PaketReferences)" 51 | 52 | RestorePackages; $(BuildDependsOn); 53 | 54 | 55 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | 3 | sudo: false # use the new container-based Travis infrastructure 4 | 5 | script: 6 | - ./build.sh TravisCI -------------------------------------------------------------------------------- /FSharp.Editing.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FSharp.Editing 2 | 3 | Cross Platform F# Editor Tooling Backend and F# Roslyn Workspace Services 4 | -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | #### 0.0.1 - 16.10.2016 2 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | build_script: 2 | - ps: .\build.cmd 3 | test: off 4 | artifacts: 5 | - path: bin\*.vsix -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | .paket\paket.exe restore 4 | if errorlevel 1 ( 5 | exit /b %errorlevel% 6 | ) 7 | 8 | packages\build\FAKE\tools\FAKE.exe build.fsx %* -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if test "$OS" = "Windows_NT" 3 | then 4 | # use .Net 5 | 6 | .paket/paket.exe restore 7 | exit_code=$? 8 | if [ $exit_code -ne 0 ]; then 9 | exit $exit_code 10 | fi 11 | 12 | packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx 13 | else 14 | # use mono 15 | mono .paket/paket.exe 16 | exit_code=$? 17 | if [ $exit_code -ne 0 ]; then 18 | certificate_count=$(certmgr -list -c Trust | grep X.509 | wc -l) 19 | if [ $certificate_count -le 1 ]; then 20 | echo "Couldn't download Paket. This might be because your Mono installation" 21 | echo "doesn't have the right SSL root certificates installed. One way" 22 | echo "to fix this would be to download the list of SSL root certificates" 23 | echo "from the Mozilla project by running the following command:" 24 | echo "" 25 | echo " mozroots --import --sync" 26 | echo "" 27 | echo "This will import over 100 SSL root certificates into your Mono" 28 | echo "certificate repository. Then try running the build script again." 29 | fi 30 | exit $exit_code 31 | fi 32 | 33 | mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx 34 | fi -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "2.0.0-preview2-005840" 4 | } 5 | } -------------------------------------------------------------------------------- /paket.dependencies: -------------------------------------------------------------------------------- 1 | source https://api.nuget.org/v3/index.json 2 | source https://dotnet.myget.org/F/roslyn/api/v3/index.json 3 | 4 | 5 | redirects: force 6 | content: none 7 | framework: >= net45 8 | 9 | nuget FSharp.Compiler.Service content: none 10 | nuget FSharp.Core redirects: force, content: none 11 | nuget Microsoft.Build >= 15.1 12 | nuget Microsoft.Build.Runtime >= 15.1 13 | nuget Newtonsoft.Json 14 | nuget Suave redirects: force 15 | nuget wire 16 | nuget Microsoft.Extensions.Logging.Abstractions 17 | nuget Microsoft.CodeAnalysis.Common >= 3.0.0-beta1-61613-05 18 | nuget Microsoft.CodeAnalysis.Features >= 3.0.0-beta1-61613-05 19 | nuget Microsoft.CodeAnalysis.Workspaces.Common >= 3.0.0-beta1-61613-05 20 | 21 | nuget FSharp.Management 22 | nuget FSharp.Data 23 | 24 | 25 | group netcore 26 | source https://api.nuget.org/v3/index.json 27 | source https://dotnet.myget.org/F/roslyn/api/v3/index.json 28 | 29 | redirects: on 30 | content: none 31 | framework: >= netstandard1.3 32 | 33 | 34 | nuget FSharp.NET.Sdk content: none 35 | nuget FSharp.Core 36 | nuget FSharp.Compiler.Service content: none 37 | nuget Suave redirects: force 38 | 39 | nuget System.Runtime 40 | nuget System.IO.FileSystem 41 | nuget System.IO.FileSystem.Watcher 42 | nuget System.IO.FileSystem.Primitives 43 | nuget System.Reflection.TypeExtensions 44 | nuget System.Xml.XDocument 45 | 46 | nuget Microsoft.CodeAnalysis.Common >= 3.0.0-beta1-61613-05 47 | nuget Microsoft.CodeAnalysis.Features >= 3.0.0-beta1-61613-05 48 | nuget Microsoft.CodeAnalysis.Workspaces.Common >= 3.0.0-beta1-61613-05 49 | 50 | 51 | nuget Microsoft.Build >= 15.1 52 | nuget Microsoft.Build.Runtime >= 15.1 53 | nuget Newtonsoft.Json 54 | nuget wire 55 | 56 | nuget Microsoft.Extensions.Logging.Abstractions 57 | 58 | nuget Microsoft.NETCore.DotNetHostPolicy 59 | nuget Microsoft.NETCore.Runtime.CoreCLR 60 | 61 | nuget System.Runtime.Loader 62 | nuget System.Runtime.Extensions 63 | nuget System.Runtime.InteropServices 64 | nuget System.Runtime.Serialization.Primitives 65 | nuget System.Runtime.InteropServices.RuntimeInformation 66 | 67 | nuget Microsoft.Extensions.Options.ConfigurationExtensions 68 | nuget Microsoft.Win32.Registry.AccessControl 69 | 70 | 71 | group Test 72 | content: none 73 | source https://api.nuget.org/v3/index.json 74 | redirects: on 75 | 76 | nuget NUnit 77 | nuget NUnit.Runners 78 | nuget FsCheck 79 | 80 | group Build 81 | source https://api.nuget.org/v3/index.json 82 | redirects: on 83 | content: none 84 | 85 | nuget FAKE 86 | nuget FSharp.Formatting 87 | github fsharp/FAKE modules/Octokit/Octokit.fsx -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/Client.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Client 2 | 3 | open System.Threading 4 | open System.IO 5 | open System.Net 6 | open System 7 | open FSharp.Editing 8 | open FSharp.Editing.Messages 9 | open FSharp.Editing.Messages.Serialization 10 | 11 | type Client(serviceEndpoint: Uri) = 12 | let id = ref 0 13 | 14 | let copyAndClose (inputStream: Stream) = 15 | let readSize = 256 16 | let buffer = Array.zeroCreate readSize 17 | use ms = new MemoryStream() 18 | let mutable count = inputStream.Read (buffer, 0, readSize) 19 | while count > 0 do 20 | ms.Write(buffer, 0, count) 21 | count <- inputStream.Read(buffer, 0, readSize) 22 | ms.Position <- 0L 23 | inputStream.Flush () 24 | inputStream.Dispose () 25 | ms 26 | 27 | member __.Request<'a> (``method``: string, parameters: obj) : RequestResult<'a> = 28 | async { 29 | let id = Interlocked.Increment id 30 | 31 | let requestMessage = 32 | { RequestMessage.Id = id 33 | Jsonrpc = "2.0" 34 | Method = ``method`` 35 | Params = parameters } 36 | 37 | let req = HttpWebRequest.Create serviceEndpoint 38 | req.Method <- "Post" 39 | req.ContentType <- "application/json-rpc" 40 | use! reqStream = req.GetRequestStreamAsync() |> Async.AwaitTask 41 | use writer = new StreamWriter (reqStream) 42 | let json = serialize requestMessage 43 | writer.Write json 44 | writer.Flush () 45 | reqStream.Dispose () 46 | 47 | let! resp = req.AsyncGetResponse() 48 | use respStream = resp.GetResponseStream() 49 | use reader = new StreamReader (copyAndClose respStream) 50 | let responseJson = reader.ReadToEnd() 51 | let response: ResponseWithId<'a> = Response.deserialize responseJson 52 | return 53 | match response.Result, response.Error with 54 | | _, Some error -> Fail error 55 | | Some result, _ -> Ok result 56 | | None, None -> 57 | Fail { ResponseError.Code = ErrorCode.InternalError 58 | Message = "Server returned inconsistent response. Either Result or Error must be filled." 59 | Data = null } 60 | } 61 | 62 | member this.ShowMessage (p: ShowMessageRequestParams) : RequestResult = 63 | this.Request (Request.Method.Initialize, p) 64 | 65 | //asyncChoice.Return { Title = "a title" } -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/Scripts/Script.fsx: -------------------------------------------------------------------------------- 1 | #load "load-project-debug.fsx" 2 | 3 | open FSharp.Editing.Messages 4 | open FSharp.Editing.Client 5 | open System 6 | 7 | let client = Client (Uri "http://127.0.0.1:8083") 8 | 9 | { Type = MessageType.Info 10 | Message = "foo" 11 | Actions = [] } 12 | |> client.ShowMessage 13 | |> Async.RunSynchronously -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/Scripts/load-project-debug.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #load "load-references-debug.fsx" 4 | #load "../Client.fs" 5 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/Scripts/load-project-release.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #load "load-references-release.fsx" 4 | #load "../AssemblyInfo.fs" 5 | "../Client.fs" 6 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/Scripts/load-references-debug.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #r "System.Core.dll" 4 | #r "System.dll" 5 | #r "System.Numerics.dll" 6 | #r "../../../packages/Newtonsoft.Json/lib/net45/Newtonsoft.Json.dll" 7 | #r "../../../packages/System.IO.FileSystem/lib/net46/System.IO.FileSystem.dll" 8 | #r "../../../packages/System.IO.FileSystem.Primitives/lib/net46/System.IO.FileSystem.Primitives.dll" 9 | #r "../../../packages/System.Reflection.TypeExtensions/lib/net46/System.Reflection.TypeExtensions.dll" 10 | #r "../../../packages/System.Threading.Tasks.Extensions/lib/netstandard1.0/System.Threading.Tasks.Extensions.dll" 11 | #r "System.Xml.dll" 12 | #r "System.Xml.Linq.dll" 13 | #r "../../../packages/System.Xml.ReaderWriter/lib/net46/System.Xml.ReaderWriter.dll" 14 | #r "System.Runtime.Serialization.dll" 15 | #r "../../../packages/System.Runtime.Serialization.Primitives/lib/net46/System.Runtime.Serialization.Primitives.dll" 16 | #r "../../../build/Debug/FSharp.Editing.Core.dll" 17 | #r "../../../build/Debug/FSharp.Editing.Messages.dll" 18 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6/Facades/System.Runtime.Serialization.Primitives.dll" 19 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6/Facades/System.Xml.ReaderWriter.dll" -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/Scripts/load-references-release.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #r "../../../packages/ExtCore/lib/net45/ExtCore.dll" 4 | #r "../../../packages/Newtonsoft.Json/lib/net45/Newtonsoft.Json.dll" 5 | #r "System.Core.dll" 6 | #r "System.dll" 7 | #r "System.Numerics.dll" 8 | #r "System.ComponentModel.Composition.dll" 9 | #r "../../../packages/System.IO.FileSystem/lib/net46/System.IO.FileSystem.dll" 10 | #r "../../../packages/System.IO.FileSystem.Primitives/lib/net46/System.IO.FileSystem.Primitives.dll" 11 | #r "../../../packages/System.Reflection.TypeExtensions/lib/net46/System.Reflection.TypeExtensions.dll" 12 | #r "../../../packages/System.Threading.Tasks.Extensions/lib/netstandard1.0/System.Threading.Tasks.Extensions.dll" 13 | #r "System.Xml.dll" 14 | #r "System.Xml.Linq.dll" 15 | #r "../../../packages/System.Xml.ReaderWriter/lib/net46/System.Xml.ReaderWriter.dll" 16 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6.1/Facades/System.Xml.ReaderWriter.dll" 17 | #r "System.Runtime.Serialization.dll" 18 | #r "../../../packages/System.Runtime.Serialization.Primitives/lib/net46/System.Runtime.Serialization.Primitives.dll" 19 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6.1/Facades/System.Runtime.Serialization.Primitives.dll" 20 | #r "../../../build/Release/FSharp.Editing.Messages.dll" -------------------------------------------------------------------------------- /src/FSharp.Editing.Client/paket.references: -------------------------------------------------------------------------------- 1 | Newtonsoft.Json 2 | FSharp.Core 3 | 4 | group netcore 5 | 6 | System.IO.FileSystem 7 | System.IO.FileSystem.Primitives 8 | System.Reflection.TypeExtensions 9 | System.Runtime.Serialization.Primitives 10 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Core/IdentifierUtils.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.IdentifierUtils 2 | 3 | open System 4 | open Microsoft.FSharp.Compiler.PrettyNaming 5 | open Microsoft.FSharp.Compiler.SourceCodeServices.PrettyNaming 6 | 7 | let DoubleBackTickDelimiter = "``" 8 | 9 | let isDoubleBacktickIdent (s: string) = 10 | let doubledDelimiter = 2 * DoubleBackTickDelimiter.Length 11 | if s.StartsWith(DoubleBackTickDelimiter) && s.EndsWith(DoubleBackTickDelimiter) && s.Length > doubledDelimiter then 12 | let inner = s.Substring(DoubleBackTickDelimiter.Length, s.Length - doubledDelimiter) 13 | not (inner.Contains(DoubleBackTickDelimiter)) 14 | else false 15 | 16 | let isIdentifier (s: string) = 17 | if isDoubleBacktickIdent s then 18 | true 19 | else 20 | s |> Seq.mapi (fun i c -> i, c) 21 | |> Seq.forall (fun (i, c) -> 22 | if i = 0 then IsIdentifierFirstCharacter c else IsIdentifierPartCharacter c) 23 | 24 | let isOperator (s: string) = 25 | let allowedChars = Set.ofList ['!'; '%'; '&'; '*'; '+'; '-'; '.'; '/'; '<'; '='; '>'; '?'; '@'; '^'; '|'; '~'] 26 | (IsPrefixOperator s || IsInfixOperator s || IsTernaryOperator s) 27 | && (s.ToCharArray() |> Array.forall (fun c -> Set.contains c allowedChars)) 28 | 29 | /// Encapsulates identifiers for rename operations if needed 30 | let encapsulateIdentifier symbolKind newName = 31 | let isKeyWord = List.exists ((=) newName) KeywordNames 32 | let isAlreadyEncapsulated = newName.StartsWith DoubleBackTickDelimiter && newName.EndsWith DoubleBackTickDelimiter 33 | 34 | if isAlreadyEncapsulated then newName 35 | elif (symbolKind = SymbolKind.Operator) || (symbolKind = SymbolKind.GenericTypeParameter) || (symbolKind = SymbolKind.StaticallyResolvedTypeParameter) then newName 36 | elif isKeyWord || not (isIdentifier newName) then DoubleBackTickDelimiter + newName + DoubleBackTickDelimiter 37 | else newName 38 | 39 | let isFixableIdentifier (s: string) = 40 | not (String.IsNullOrEmpty s) && encapsulateIdentifier SymbolKind.Ident s |> isIdentifier 41 | 42 | let private forbiddenChars = ["."; "+"; "$"; "&"; "["; "]"; "/"; "\\"; "*"; "\""] 43 | 44 | let isTypeNameIdent (s: string) = 45 | not (String.IsNullOrEmpty s) && 46 | forbiddenChars |> Seq.forall (fun c -> not (s.Contains c)) && 47 | isFixableIdentifier s 48 | 49 | let isUnionCaseIdent (s: string) = 50 | isTypeNameIdent s && 51 | Char.IsUpper(s.Replace(DoubleBackTickDelimiter,"").[0]) -------------------------------------------------------------------------------- /src/FSharp.Editing.Core/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Compiler.Service 2 | Newtonsoft.Json 3 | wire 4 | FSharp.Core 5 | Microsoft.CodeAnalysis.Common 6 | Microsoft.CodeAnalysis.Workspaces.Common 7 | Microsoft.CodeAnalysis.Features 8 | Microsoft.Extensions.Logging.Abstractions 9 | System.Xml.ReaderWriter 10 | 11 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/AssemblyInfo.fs: -------------------------------------------------------------------------------- 1 | // Auto-Generated by FAKE; do not edit 2 | namespace System 3 | open System.Reflection 4 | 5 | [] 6 | [] 7 | [] 8 | [] 9 | [] 10 | do () 11 | 12 | module internal AssemblyVersionInformation = 13 | let [] AssemblyTitle = "FSharp.Editing.Messages" 14 | let [] AssemblyProduct = "FSharp.Editing" 15 | let [] AssemblyDescription = "Rich F# language support for editors" 16 | let [] AssemblyVersion = "0.0.1" 17 | let [] AssemblyFileVersion = "0.0.1" 18 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/Scripts/Script1.fsx: -------------------------------------------------------------------------------- 1 | #load "load-project-debug.fsx" 2 | 3 | open FSharp.Editing.Messages 4 | open FSharp.Editing.Messages.Serialization 5 | 6 | let msg: Message = 7 | Message.Request 8 | { Id = 25 9 | Request = 10 | Request.ShowMessage 11 | { Type = MessageType.Info 12 | Message = "a message" 13 | Actions = 14 | [ { Title = "a title 1" } 15 | { Title = "a title 2" } ] }} 16 | 17 | let json = Serializer.serialize msg 18 | printfn "%s" json 19 | let msg1 = Serializer.deserialize json 20 | 21 | #time 22 | let n = 500000 23 | for i in 1..n do Serializer.serialize msg |> ignore 24 | // Newtonsoft.Json (500000) Real: 00:00:02.011, CPU: 00:00:02.015, GC gen0: 356, gen1: 0, gen2: 0 25 | for i in 1..n do Serializer.deserialize json |> ignore 26 | // Newtonsoft.Json (500000) Real: 00:00:07.882, CPU: 00:00:07.890, GC gen0: 1854, gen1: 0, gen2: 0 27 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/Scripts/load-project-debug.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #load "load-references-debug.fsx" 4 | #load "../Utils.fs" 5 | "../Messages.fs" 6 | "../Serialization.fs" 7 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/Scripts/load-project-release.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #load "load-references-release.fsx" 4 | #load "../AssemblyInfo.fs" 5 | "../Utils.fs" 6 | "../Messages.fs" 7 | "../Serialization.fs" 8 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/Scripts/load-references-debug.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #r "System.Core.dll" 4 | #r "System.dll" 5 | #r "System.Numerics.dll" 6 | #r "../../../packages/Newtonsoft.Json/lib/net45/Newtonsoft.Json.dll" 7 | #r "../../../packages/System.IO.FileSystem/lib/net46/System.IO.FileSystem.dll" 8 | #r "../../../packages/System.IO.FileSystem.Primitives/lib/net46/System.IO.FileSystem.Primitives.dll" 9 | #r "../../../packages/System.Reflection.TypeExtensions/lib/net46/System.Reflection.TypeExtensions.dll" 10 | #r "../../../packages/System.Threading.Tasks.Extensions/lib/netstandard1.0/System.Threading.Tasks.Extensions.dll" 11 | #r "System.Xml.dll" 12 | #r "System.Xml.Linq.dll" 13 | #r "../../../packages/System.Xml.ReaderWriter/lib/net46/System.Xml.ReaderWriter.dll" 14 | #r "System.Runtime.Serialization.dll" 15 | #r "../../../packages/System.Runtime.Serialization.Primitives/lib/net46/System.Runtime.Serialization.Primitives.dll" 16 | #r "../../../build/Debug/FSharp.Editing.Core.dll" 17 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6/Facades/System.Runtime.Serialization.Primitives.dll" 18 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6/Facades/System.Xml.ReaderWriter.dll" -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/Scripts/load-references-release.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #r "../../../packages/Newtonsoft.Json/lib/net45/Newtonsoft.Json.dll" 4 | #r "System.Core.dll" 5 | #r "System.dll" 6 | #r "System.Numerics.dll" 7 | #r "System.ComponentModel.Composition.dll" 8 | #r "../../../packages/System.IO.FileSystem/lib/net46/System.IO.FileSystem.dll" 9 | #r "../../../packages/System.IO.FileSystem.Primitives/lib/net46/System.IO.FileSystem.Primitives.dll" 10 | #r "../../../packages/System.Reflection.TypeExtensions/lib/net46/System.Reflection.TypeExtensions.dll" 11 | #r "../../../packages/System.Threading.Tasks.Extensions/lib/netstandard1.0/System.Threading.Tasks.Extensions.dll" 12 | #r "System.Xml.dll" 13 | #r "System.Xml.Linq.dll" 14 | #r "../../../packages/System.Xml.ReaderWriter/lib/net46/System.Xml.ReaderWriter.dll" 15 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6.1/Facades/System.Xml.ReaderWriter.dll" 16 | #r "System.Runtime.Serialization.dll" 17 | #r "../../../packages/System.Runtime.Serialization.Primitives/lib/net46/System.Runtime.Serialization.Primitives.dll" 18 | #r "../../../../../../../../Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.6.1/Facades/System.Runtime.Serialization.Primitives.dll" -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/Utils.fs: -------------------------------------------------------------------------------- 1 | [] 2 | module FSharp.Editing.Utils 3 | 4 | let inline (|Ok|Fail|) x = match x with Choice1Of2 a -> Ok a | Choice2Of2 e -> Fail e 5 | let Ok = Choice1Of2 6 | let Fail = Choice2Of2 7 | let inline s fmt = sprintf fmt -------------------------------------------------------------------------------- /src/FSharp.Editing.Messages/paket.references: -------------------------------------------------------------------------------- 1 | Newtonsoft.Json 2 | FSharp.Core -------------------------------------------------------------------------------- /src/FSharp.Editing.ProjectInspector/Program.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.ProjectInspector.Program 2 | open System 3 | open System.IO 4 | open Microsoft.CodeAnalysis 5 | open Newtonsoft.Json 6 | open FSharp.Editing 7 | open FSharp.Editing.ProjectSystem 8 | 9 | 10 | [] 11 | let main argv = 12 | // System.IO.Directory.SetCurrentDirectory __SOURCE_DIRECTORY__ 13 | 14 | let target = 15 | if argv = [||] || String.IsNullOrWhiteSpace argv.[0] then 16 | Path.Combine(__SOURCE_DIRECTORY__, "../Fsharp.Editing.Client/FSharp.Editing.Client.fsproj") 17 | else argv.[0] 18 | if not (String.IsNullOrWhiteSpace target) then 19 | let fileInfo = FSharp.Editing.ProjectSystem.ProfectFileInfo.create target 20 | 21 | // Console.WriteLine "Hello from the child" 22 | // printfn "%A" fileInfo 23 | // Console.ReadLine()|>ignore 24 | // let writer = Serializer() 25 | // writer.Serialize(fileInfo,Console.OpenStandardOutput()) 26 | // use writer = new StreamWriter(Console.OpenStandardOutput()) 27 | // use jsonWriter = new JsonTextWriter(writer) 28 | // let ser = new JsonSerializer() 29 | // ser.Serialize(jsonWriter,fileInfo) 30 | // jsonWriter.Flush() 31 | let json = JsonConvert.SerializeObject(fileInfo) 32 | use writer = new StreamWriter( Console.OpenStandardOutput() ) 33 | writer.WriteLine json 34 | writer.Flush() 35 | writer.Dispose() 36 | // Console.Write json 37 | // let ser = new DataContractJsonSerializer(typeof) 38 | // ser.WriteObject(Console.OpenStandardOutput(), fileInfo) 39 | // printfn "%A" fileInfo 40 | 0 41 | else 42 | 1 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/FSharp.Editing.ProjectInspector/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Core 2 | Microsoft.Build 3 | Microsoft.Build.Runtime 4 | FSharp.Compiler.Service 5 | Microsoft.CodeAnalysis.Common 6 | Microsoft.CodeAnalysis.Workspaces.Common 7 | Newtonsoft.Json -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/AssemblyInfo.fs: -------------------------------------------------------------------------------- 1 | // Auto-Generated by FAKE; do not edit 2 | namespace System 3 | open System.Reflection 4 | 5 | [] 6 | [] 7 | [] 8 | [] 9 | [] 10 | do () 11 | 12 | module internal AssemblyVersionInformation = 13 | let [] AssemblyTitle = "FSharp.Editing.Server" 14 | let [] AssemblyProduct = "FSharp.Editing" 15 | let [] AssemblyDescription = "Rich F# language support for editors" 16 | let [] AssemblyVersion = "0.0.1" 17 | let [] AssemblyFileVersion = "0.0.1" 18 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/Context.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Server 2 | 3 | open FSharp.Editing 4 | 5 | [] 6 | type Context = 7 | { Solution: Solution 8 | LanguageService: LanguageService } 9 | 10 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/Program.fs: -------------------------------------------------------------------------------- 1 | open System 2 | open System.IO 3 | open FSharp.Editing.Server 4 | open Suave 5 | open Suave.Operators 6 | open Suave.Filters 7 | open Suave.Successful 8 | open Suave.Writers 9 | 10 | [] 11 | let main _ = 12 | POST 13 | >=> path "/" 14 | >=> Service.handle 15 | >=> setMimeType "application/json; charset=utf-8" 16 | |> startWebServer defaultConfig 17 | 0 -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/ProjectSystem.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Server 2 | 3 | open FSharp.Editing 4 | open Microsoft.FSharp.Compiler.SourceCodeServices 5 | 6 | [] 7 | type Project = 8 | { FilePath: FilePath 9 | CompilerOptions: FSharpProjectOptions } 10 | 11 | [] 12 | type Solution = 13 | { FileName: FileName option 14 | Projects: Map } 15 | 16 | //[] 17 | //module Solution = 18 | //let addOrUpdateProject project solution = 19 | //{ solution with Projects = solution.Projects |> Map.add project } -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/Service.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Server 2 | 3 | open FSharp.Editing 4 | open FSharp.Editing.Messages 5 | open FSharp.Editing.Messages.Serialization 6 | 7 | module Service = 8 | open Suave 9 | open System.Text 10 | 11 | let private handleRequest (request: RequestWithId) : RequestResult = 12 | asyncChoice { 13 | match request.Request with 14 | | Request.ShowMessage _p -> 15 | return box { MessageActionItem.Title = "a title" } 16 | | Request.CodeLens _p -> 17 | return box 18 | [ { CodeLens.Command = None 19 | CodeLens.Range = 20 | { Start = { Line = 1; Character = 2 } 21 | End = { Line = 2; Character = 3 }} 22 | CodeLens.Data = None } ] 23 | | _ -> 24 | return! 25 | { Code = ErrorCode.MethodNotFound 26 | Message = s"%A is not supported." request.Request 27 | Data = null } 28 | |> Fail 29 | |> async.Return 30 | } 31 | 32 | 33 | let handle: WebPart = fun (ctx: HttpContext) -> 34 | async { 35 | let request = 36 | ctx.request.rawForm 37 | |> Encoding.UTF8.GetString 38 | |> Request.deserialize 39 | 40 | let! result = handleRequest request 41 | 42 | let response: ResponseWithId = 43 | match result with 44 | | Ok x -> 45 | { Id = request.Id 46 | Result = Some x 47 | Error = None } 48 | | Fail e -> 49 | { Id = request.Id 50 | Result = None 51 | Error = Some e } 52 | 53 | return! Response.response HttpCode.HTTP_200 (response |> Response.toMessage |> Json.toJson) ctx 54 | } 55 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/Utilites.fs: -------------------------------------------------------------------------------- 1 | [] 2 | module FSharp.Editing.Server.Utilites 3 | 4 | open System 5 | 6 | module Logger = 7 | open Microsoft.FSharp.Core.Printf 8 | 9 | let debug msg = kprintf (fun x -> Console.WriteLine ((string DateTime.Now) + " [DEBUG] " + x)) msg 10 | let info msg = kprintf (fun x -> Console.WriteLine ((string DateTime.Now) + " [INFO] " + x)) msg 11 | let error msg = kprintf (fun x -> Console.WriteLine ((string DateTime.Now) + " [ERROR] " + x)) msg 12 | 13 | module Map = 14 | let addOrUpdate (key: 'k) (newValue: unit -> 'v) (update: 'v -> 'v) (m: Map<'k, 'v>) = 15 | match m |> Map.tryFind key with 16 | | Some oldV -> m |> Map.add key (update oldV) 17 | | None -> m |> Map.add key (newValue()) 18 | -------------------------------------------------------------------------------- /src/FSharp.Editing.Server/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Core 2 | FSharp.Compiler.Service 3 | Suave 4 | 5 | Microsoft.CodeAnalysis.Common -------------------------------------------------------------------------------- /src/FSharp.Editing/AssemblyInfo.fs: -------------------------------------------------------------------------------- 1 | // Auto-Generated by FAKE; do not edit 2 | namespace System 3 | open System.Reflection 4 | open System.Runtime.CompilerServices 5 | 6 | [] 7 | [] 8 | [] 9 | [] 10 | [] 11 | [] 12 | do () 13 | 14 | module internal AssemblyVersionInformation = 15 | let [] InternalsVisibleTo = "FSharp.Editing.Tests" 16 | let [] AssemblyTitle = "FSharp.Editing" 17 | let [] AssemblyProduct = "FSharp.Editing" 18 | let [] AssemblyDescription = "Rich F# language support for editors" 19 | let [] AssemblyVersion = "0.0.1" 20 | let [] AssemblyFileVersion = "0.0.1" 21 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Coloring/DocumentHighlights.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Coloring 2 | 3 | open System 4 | open System.Collections.Immutable 5 | open System.Threading.Tasks 6 | 7 | open Microsoft.CodeAnalysis 8 | open Microsoft.CodeAnalysis.Text 9 | 10 | open Microsoft.FSharp.Compiler.SourceCodeServices 11 | open Microsoft.FSharp.Compiler.Range 12 | open FSharp.Editing 13 | 14 | 15 | module DocumentHighlights = 16 | 17 | [] 18 | type FSharpHighlightSpan = { 19 | IsDefinition: bool 20 | TextSpan: TextSpan 21 | } with 22 | override this.ToString() = sprintf "%+A" this 23 | 24 | 25 | let fixInvalidSymbolSpans (sourceText: SourceText) (lastIdent: string) (spans: FSharpHighlightSpan []) = 26 | spans 27 | |> Seq.choose (fun (span: FSharpHighlightSpan) -> 28 | let newLastIdent = sourceText.GetSubText(span.TextSpan).ToString() 29 | let index = newLastIdent.LastIndexOf(lastIdent, StringComparison.Ordinal) 30 | if index > 0 then 31 | // Sometimes FCS returns a composite identifier for a short symbol, so we truncate the prefix 32 | // Example: newLastIdent --> "x.Length", lastIdent --> "Length" 33 | Some { span with TextSpan = TextSpan(span.TextSpan.Start + index, span.TextSpan.Length - index) } 34 | elif index = 0 && newLastIdent.Length > lastIdent.Length then 35 | // The returned symbol use is too long; we truncate its redundant suffix 36 | // Example: newLastIdent --> "Length<'T>", lastIdent --> "Length" 37 | Some { span with TextSpan = TextSpan(span.TextSpan.Start, lastIdent.Length) } 38 | elif index = 0 then 39 | Some span 40 | else 41 | // In the case of attributes, a returned symbol use may be a part of original text 42 | // Example: newLastIdent --> "Sample", lastIdent --> "SampleAttribute" 43 | let index = lastIdent.LastIndexOf(newLastIdent, StringComparison.Ordinal) 44 | if index >= 0 then 45 | Some span 46 | else None) 47 | |> Seq.distinctBy (fun span -> span.TextSpan.Start) 48 | |> Seq.toArray 49 | 50 | 51 | let getDocumentHighlights (checker: FSharpChecker, documentKey: DocumentId, sourceText: SourceText, filePath: string, position: int, 52 | defines: string list, options: FSharpProjectOptions, textVersionHash: int) : Async = 53 | asyncMaybe { 54 | let textLine = sourceText.Lines.GetLineFromPosition(position) 55 | let textLinePos = sourceText.Lines.GetLinePosition(position) 56 | let fcsTextLineNumber = Line.fromZ textLinePos.Line 57 | let! symbol = getSymbolAtPosition(documentKey, sourceText, position, filePath, defines, SymbolRangeLookup.Greedy) 58 | let! _, _, checkFileResults = checker.ParseAndCheckDocument(filePath, textVersionHash, sourceText.ToString(), options, allowStaleResults = true) 59 | let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland) 60 | let! symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol) |> liftAsync 61 | return 62 | [| for symbolUse in symbolUses do 63 | yield { 64 | IsDefinition = symbolUse.IsFromDefinition 65 | TextSpan = fsharpRangeToTextSpan sourceText symbolUse.RangeAlternate 66 | } 67 | |] 68 | |> fixInvalidSymbolSpans sourceText symbol.Ident.idText 69 | } 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Coloring/HighlightUsageInFile.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Coloring 2 | 3 | open FSharp.Editing 4 | open Microsoft.CodeAnalysis 5 | open Microsoft.CodeAnalysis.Text 6 | 7 | 8 | module Symbols = 9 | open System.IO 10 | 11 | open Microsoft.FSharp.Compiler.SourceCodeServices 12 | 13 | let filterSymbolUsesDuplicates (uses: FSharpSymbolUse []) = 14 | uses 15 | |> Seq.map (fun symbolUse -> (symbolUse.FileName, symbolUse)) 16 | |> Seq.groupBy (fst >> Path.GetFullPathSafe) 17 | |> Seq.collect (fun (_, symbolUses) -> 18 | symbolUses 19 | |> Seq.map snd 20 | |> Seq.distinctBy (fun s -> s.RangeAlternate)) 21 | |> Seq.toArray 22 | 23 | type GetCheckResults = FileName -> Async 24 | 25 | module HighlightUsageInFile = 26 | open Microsoft.FSharp.Compiler.SourceCodeServices 27 | 28 | [] 29 | type HighlightUsageInFileResult = 30 | | UsageInFile of FSharpSymbol * LongIdent * FSharpSymbolUse array 31 | 32 | let findUsageInFile file (currentLine: TextLine ) (symbol: Symbol) (getCheckResults: GetCheckResults) = 33 | asyncMaybe { 34 | let! parseAndCheckResults = getCheckResults file 35 | let! _ = parseAndCheckResults.GetSymbolUseAtLocation (currentLine.LineNumber, symbol.RightColumn, currentLine.ToString(), [symbol.Text]) 36 | let! (symbol, ident, refs) = parseAndCheckResults.GetUsesOfSymbolInFileAtLocation (currentLine.LineNumber, symbol.RightColumn, currentLine.ToString(), symbol.Text) 37 | return UsageInFile (symbol, ident, Symbols.filterSymbolUsesDuplicates refs) 38 | } -------------------------------------------------------------------------------- /src/FSharp.Editing/Coloring/PrintfSpecifiersUsageGetter.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Coloring.PrintfSpecifiersUsageGetter 2 | 3 | open Microsoft.FSharp.Compiler 4 | open FSharp.Editing.UntypedAstUtils 5 | open FSharp.Editing 6 | 7 | [] 8 | type PrintfSpecifierUse = 9 | { SpecifierRange: Range.range 10 | ArgumentRange: Range.range } 11 | 12 | let private startPos (r: Range.range) = r.StartLine, r.StartColumn 13 | let private endPos (r: Range.range) = r.EndLine, r.EndColumn 14 | let private mergeRanges (ranges : Range.range[]) = 15 | let startRange = ranges |> Array.minBy startPos 16 | let endRange = ranges |> Array.maxBy endPos 17 | Range.mkRange startRange.FileName startRange.Start endRange.End 18 | 19 | let getAll (input: ParseAndCheckResults) (onError: string -> unit): PrintfSpecifierUse[] option Async = 20 | asyncMaybe { 21 | let! specRangesAndArities = input.GetFormatSpecifierLocationsAndArity() 22 | let specRangesAndArities = 23 | specRangesAndArities 24 | |> Array.map (fun (x, ar) -> 25 | (Range.mkRange x.FileName x.Start (Range.mkPos x.EndLine (x.EndColumn))), ar) 26 | 27 | let printfFunctions = Printf.getAll input.ParseTree 28 | 29 | return 30 | printfFunctions 31 | |> Array.fold (fun (specRangesAndArities, acc) func -> 32 | let ownSpecifiers, restSpecifiers = 33 | specRangesAndArities 34 | |> Array.partition (fst >> (Range.rangeContainsRange func.FormatString)) 35 | 36 | match ownSpecifiers with 37 | | [||] -> restSpecifiers, acc 38 | | _ -> 39 | let numSpecifierArgs = ownSpecifiers |> Array.sumBy snd 40 | if func.Args.Length > numSpecifierArgs then 41 | onError (sprintf "Too many Printf arguments for %+A (%d > %d)" 42 | func func.Args.Length numSpecifierArgs) 43 | 44 | let prioritizeArgPos pos = 45 | Array.partition (fun a -> Range.rangeBeforePos a pos) 46 | >> function (l, r) -> [| r |> Array.sortBy startPos 47 | l |> Array.sortBy startPos |] 48 | |> Array.concat 49 | 50 | let uses = 51 | let numUsedArgs = min func.Args.Length numSpecifierArgs 52 | let sortedOwnSpecifiers = 53 | ownSpecifiers |> Array.sortBy (fst>>startPos) 54 | 55 | let usedArgs = 56 | func.Args 57 | |> prioritizeArgPos (fst ownSpecifiers.[0]).Start 58 | |> function args -> args.[0..(numUsedArgs - 1)] 59 | 60 | let argChunks = 61 | usedArgs 62 | |> Array.splitByChunks (sortedOwnSpecifiers |> Array.map snd) 63 | 64 | let argChunkRanges = 65 | argChunks 66 | |> Array.filter (fun chunk -> chunk.Length > 0) 67 | |> Array.map mergeRanges 68 | 69 | let argAcceptingSpecifiers = 70 | sortedOwnSpecifiers 71 | |> Array.filter (fun (_, ar) -> ar > 0) 72 | |> function arr -> arr.[0..(argChunkRanges.Length - 1)] 73 | 74 | argChunkRanges 75 | |> Array.zip argAcceptingSpecifiers 76 | |> Array.map (fun ((spec, _), arg) -> { SpecifierRange = spec; ArgumentRange = arg }) 77 | restSpecifiers, uses :: acc 78 | ) (specRangesAndArities, []) 79 | |> snd 80 | |> List.toArray 81 | |> Array.concat 82 | } -------------------------------------------------------------------------------- /src/FSharp.Editing/Completion/FileSystemCompletion.fs: -------------------------------------------------------------------------------- 1 | module FileSystemCompletion 2 | 3 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Documentation/XmlDocCache.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Documentation.XmlDocCache 2 | 3 | 4 | 5 | open System 6 | open System.Collections.Generic 7 | open System.Collections.Specialized 8 | 9 | open Microsoft.CodeAnalysis 10 | open Microsoft.CodeAnalysis.Text 11 | open Microsoft.CodeAnalysis.Differencing 12 | 13 | open FSharp.Editing 14 | 15 | 16 | (* The XML Sig info path generators are in ServiceDeclarations.fs 17 | 18 | - Processing the XML File (C# Programming Guide) 19 | - https://msdn.microsoft.com/en-us/library/fsbx0t7x.aspx 20 | 21 | - Recommended Tags for Documentation Comments (C# Programming Guide) 22 | - https://msdn.microsoft.com/en-us/library/5ast78ax.aspx 23 | 24 | 25 | - Mono.Documentation/monodocer.cs 26 | - https://github.com/mono/api-doc-tools/blob/master/mdoc/Mono.Documentation/monodocer.cs 27 | 28 | 29 | 30 | *) -------------------------------------------------------------------------------- /src/FSharp.Editing/Documentation/XmlDocGenerator.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Documentation.XmlDocGenerator 2 | 3 | 4 | // A command filter for the editor. 5 | // Command filters get an opportunity to observe and handle commands before and after the editor acts on them. 6 | 7 | open System 8 | open System.Diagnostics 9 | open System.Runtime.InteropServices 10 | open FSharp.Editing 11 | open FSharp.Editing.Documentation 12 | open Microsoft.CodeAnalysis 13 | open Microsoft.CodeAnalysis.Text 14 | 15 | // 16 | //let generateXmlDocStub (languageService:FSharpLanguageService) (typedChar:char) (position:LinePosition) (source:SourceText) (filePath:string) = 17 | // match typedChar with 18 | // | ('/' | '<') as lastChar -> 19 | // let curLine = source.GetLineAtPosition position 20 | // let lineWithLastCharInserted = curLine.InsertString(position.Character,string typedChar) 21 | // 22 | // match XmlDocComment.isBlank lineWithLastCharInserted with 23 | // | Some i when i = position.Character -> 24 | // asyncMaybe { 25 | // 26 | // let! doc = languageService.Workspace.TryGetDocument filePath 27 | // let! options languageService.Workspace.Pr 28 | // // XmlDocable line #1 are 1-based, editor is 0-based 29 | // let! parseResults = languageService.ParseFileInProject (fileName, project) 30 | //// let! source = languageService.Workspace.get 31 | // let! xmlDocables = XmlDocParser.getXmlDocables (source, parseResults.ParseTree) |> liftAsync 32 | // let xmlDocablesBelowThisLine = 33 | // // +1 because looking below current line for e.g. a 'member' 34 | // xmlDocables |> List.filter (fun (XmlDocable(line,_indent,_paramNames)) -> line = curLineNum+1) 35 | // match xmlDocablesBelowThisLine with 36 | // | [] -> () 37 | // | XmlDocable(_line,indent,paramNames)::_t -> 38 | // // delete the slashes the user typed (they may be indented wrong) 39 | // wpfTextView.TextBuffer.Delete(wpfTextView.Caret.Position.BufferPosition.GetContainingLine().Extent.Span) |> ignore 40 | // // add the new xmldoc comment 41 | // let toInsert = new System.Text.StringBuilder() 42 | // toInsert.Append(' ', indent).AppendLine("/// ") 43 | // .Append(' ', indent).AppendLine("/// ") 44 | // .Append(' ', indent).Append("/// ") |> ignore 45 | // paramNames 46 | // |> List.iter (fun p -> 47 | // toInsert.AppendLine().Append(' ', indent).Append(sprintf "/// " p) |> ignore) 48 | // let _newSS = wpfTextView.TextBuffer.Insert(wpfTextView.Caret.Position.BufferPosition.Position, toInsert.ToString()) 49 | // // move the caret to between the summary tags 50 | // let lastLine = wpfTextView.Caret.Position.BufferPosition.GetContainingLine() 51 | // let middleSummaryLine = wpfTextView.TextSnapshot.GetLineFromLineNumber(lastLine.LineNumber - 1 - paramNames.Length) 52 | // wpfTextView.Caret.MoveTo(wpfTextView.GetTextViewLineContainingBufferPosition(middleSummaryLine.Start)) |> ignore 53 | // } 54 | // |> Async.Ignore 55 | // |> Async.StartImmediateSafe 56 | // | Some _ | None -> () 57 | // | _ -> () 58 | //passThruToEditor.Exec(&pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut) 59 | // 60 | //member __.QueryStatus(pguidCmdGroup: byref, cCmds: uint32, prgCmds: OLECMD [], pCmdText: IntPtr) = 61 | //passThruToEditor.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText) 62 | // 63 | // 64 | -------------------------------------------------------------------------------- /src/FSharp.Editing/FsLanguageService.fsx: -------------------------------------------------------------------------------- 1 | System.IO.Directory.SetCurrentDirectory __SOURCE_DIRECTORY__ 2 | 3 | #r "../../packages/FSharp.Compiler.Service/lib/net45/FSharp.Compiler.Service.dll" 4 | #r "../../packages/Microsoft.CodeAnalysis.Common/lib/netstandard1.3/Microsoft.CodeAnalysis.dll" 5 | #r "../../packages/Microsoft.CodeAnalysis.Features/lib/netstandard1.3/Microsoft.CodeAnalysis.Features.dll" 6 | #r "../../packages/Microsoft.CodeAnalysis.Workspaces.Common/lib/net46/Microsoft.CodeAnalysis.Workspaces.Desktop.dll" 7 | #r "../../packages/Microsoft.CodeAnalysis.Workspaces.Common/lib/net46/Microsoft.CodeAnalysis.Workspaces.dll" 8 | #r "../../packages/Wire/lib/net45/Wire.dll" 9 | #r "../FSharp.Editing.Core/bin/Release/FSharp.Editing.Core.dll" 10 | #r "bin/release/FSharp.Editing.dll" 11 | 12 | open Microsoft.CodeAnalysis 13 | open Microsoft.CodeAnalysis.Text 14 | open FSharp.Editing 15 | open System.IO 16 | open FSharp.Editing.ProjectSystem 17 | open Wire 18 | 19 | 20 | let inspectorPath = "../Fsharp.Editing.ProjectInspector/bin/Release/Fsharp.Editing.ProjectInspector.exe" 21 | let clientFsproj = "../Fsharp.Editing.Client/FSharp.Editing.Client.fsproj" 22 | let fsprojPath = Path.GetFullPath clientFsproj 23 | let inspectorTool = Path.GetFullPath inspectorPath 24 | 25 | 26 | let p = new System.Diagnostics.Process() 27 | p.StartInfo.FileName <- inspectorPath 28 | p.StartInfo.Arguments <- fsprojPath 29 | p.StartInfo.UseShellExecute <- false 30 | p.StartInfo.CreateNoWindow <- true 31 | p.StartInfo.RedirectStandardOutput <- true 32 | ignore <| p.Start() 33 | 34 | let ser = Serializer() 35 | let info = ser.Deserialize(p.StandardOutput.BaseStream) 36 | let fsls = FSharpLanguageService() 37 | //let fsproj = ProjectFileInfo.create "../Fsharp.Editing.Client/FSharp.Editing.Client.fsproj" 38 | //let fsproj = ProjectFileInfo.create "../Fsharp.Editing.Client/FSharp.Editing.Client.fsproj" 39 | 40 | let proj = fsls.Workspace.AddProject info 41 | 42 | fsls.Workspace.CurrentSolution.Projects 43 | |> Seq.iter (fun x -> printfn "%s - %s" x.Name x.AssemblyName) 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/GoToDeclaration.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Navigation.GoToDeclaration 2 | 3 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/GoToDefinition.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Navigation.GoToDefinition 2 | 3 | open System 4 | open System.Linq 5 | open System.Collections.Generic 6 | open System.Collections.Immutable 7 | 8 | open System.Threading 9 | open System.Threading.Tasks 10 | 11 | open Microsoft.CodeAnalysis 12 | open Microsoft.CodeAnalysis.Text 13 | 14 | open Microsoft.FSharp.Compiler.Range 15 | open Microsoft.FSharp.Compiler.SourceCodeServices 16 | open FSharp.Editing 17 | open FSharp.Editing.ProjectSystem 18 | 19 | let findDefinition 20 | ( checker: FSharpChecker 21 | , documentKey: DocumentId 22 | , sourceText: SourceText 23 | , filePath: string 24 | , position: int 25 | , defines: string list 26 | , options: FSharpProjectOptions 27 | , textVersionHash: int 28 | ) : Async> = 29 | asyncMaybe { 30 | let textLine = sourceText.Lines.GetLineFromPosition(position) 31 | let textLinePos = sourceText.Lines.GetLinePosition(position) 32 | let fcsTextLineNumber = textLinePos.Line + 1 // Roslyn line numbers are zero-based, FSharp.Compiler.Service line numbers are 1-based 33 | let! symbol = getSymbolAtPosition(documentKey, sourceText, position, filePath, defines, SymbolRangeLookup.Greedy) 34 | let! _parseResults, _ast, checkFileResults = checker.ParseAndCheckDocument(filePath, textVersionHash, sourceText.ToString(), options, allowStaleResults = true) 35 | let! _declarationSymbols = checkFileResults.GetDeclarationListSymbols(Some _parseResults,symbol.Ident.idRange.StartLine, symbol.Ident.idRange.EndColumn,textLine.ToString(),symbol.QualifyingNames(),symbol.Ident.idText) |> liftAsync 36 | let! declarations = checkFileResults.GetDeclarationLocationAlternate (fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland, false) |> liftAsync 37 | 38 | match declarations with 39 | | FSharpFindDeclResult.DeclFound(range) -> return range 40 | | _ -> return! None 41 | } 42 | 43 | // FSROSLYNTODO: Since we are not integrated with the Roslyn project system yet, the below call 44 | // document.Project.Solution.GetDocumentIdsWithFilePath() will only access files in the same project. 45 | // Either Roslyn INavigableItem needs to be extended to allow arbitary full paths, or we need to 46 | // fully integrate with their project system. 47 | let findDefinitionsAsyncAux(fsworkspace:FSharpWorkspace, fsChecker:FSharpChecker, document: Document, position: int, cancellationToken: CancellationToken) = 48 | asyncMaybe { 49 | let! option = fsworkspace.GetDocumentProjectOptions document.Id 50 | let! sourceText = document.GetTextAsync(cancellationToken) 51 | let! textVersion = document.GetTextVersionAsync(cancellationToken) 52 | let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, option.OtherOptions |> Seq.toList) 53 | let! range = findDefinition(fsChecker, document.Id, sourceText, document.FilePath, position, defines, option, textVersion.GetHashCode()) 54 | // REVIEW: 55 | let fileName = try System.IO.Path.GetFullPath(range.FileName) with _ -> range.FileName 56 | // let refDocumentIds = document.Project.Solution.GetDocumentIdsWithFilePath(fileName) 57 | // if not refDocumentIds.IsEmpty then 58 | // let refDocumentId = refDocumentIds.First() 59 | // let refDocument = document.Project.Solution.GetDocument(refDocumentId) 60 | // let! refSourceText = refDocument.GetTextAsync(cancellationToken) 61 | // let refTextSpan = fsharpRangeToTextSpan refSourceText range 62 | // return 63 | // (refDocumentIds |> Seq.map ^ fun docId -> fsworkspace.getd ) 64 | return fileName 65 | } 66 | // |> Async.map (Option.defaultValue Seq.empty) 67 | 68 | 69 | type LanguageService with 70 | 71 | member self.FindDefinition (document,position,cancellationToken) = 72 | findDefinitionsAsyncAux(self.Workspace,self.RawChecker,document,position,cancellationToken) 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/GoToImplementation.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Navigation.GoToImplementation 2 | 3 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/GoToSignature.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Navigation.GoToSignature 2 | 3 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/NavigateToIndex.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Navigation 2 | 3 | open System.Collections.Generic 4 | open System.Globalization 5 | open Microsoft.FSharp.Compiler 6 | 7 | module Index = 8 | type MatchKind = 9 | | Exact = 0 10 | | Prefix = 1 11 | | Substring = 2 12 | | Regular = 3 13 | | None = 4 14 | 15 | [] 16 | type private IndexEntry(str: string, offset: int, item: NavigableItem, isOperator: bool) = 17 | member __.String = str 18 | member __.Offset = offset 19 | member __.Length = str.Length - offset 20 | member __.Item = item 21 | member __.IsOperator = isOperator 22 | member x.StartsWith (s: string) = 23 | if s.Length > x.Length then 24 | false 25 | else 26 | CultureInfo.CurrentCulture.CompareInfo.IndexOf(str, s, offset, s.Length, CompareOptions.IgnoreCase) = offset 27 | member private __.DebugString() = sprintf "%s (offset %d) (%s)" (str.Substring offset) offset str 28 | 29 | let private indexEntryComparer = 30 | { 31 | new IComparer with 32 | member __.Compare(a, b) = 33 | let res = CultureInfo.CurrentCulture.CompareInfo.Compare(a.String, a.Offset, b.String, b.Offset, CompareOptions.IgnoreCase) 34 | if res = 0 then a.Offset.CompareTo(b.Offset) else res 35 | } 36 | 37 | type NavigableItemProcessor = NavigableItem * string * bool * MatchKind -> unit 38 | 39 | type IIndexedNavigableItems = 40 | abstract Find: searchValue: string * itemProcessor: NavigableItemProcessor -> unit 41 | 42 | type Builder() = 43 | let entries = ResizeArray() 44 | 45 | member __.Add(items: seq) = 46 | for item in items do 47 | let isOperator, name = 48 | if PrettyNaming.IsMangledOpName item.Name then 49 | true, PrettyNaming.DecompileOpName item.Name 50 | else 51 | false, item.Name 52 | for i = 0 to name.Length - 1 do 53 | entries.Add(IndexEntry(name, i, item, isOperator)) 54 | 55 | member __.BuildIndex() = 56 | entries.Sort(indexEntryComparer) 57 | { 58 | new IIndexedNavigableItems with 59 | member __.Find(searchValue, processor) = 60 | if entries.Count > 0 then 61 | let entryToFind = IndexEntry(searchValue, 0, Unchecked.defaultof<_>, Unchecked.defaultof<_>) 62 | let initial = 63 | let p = entries.BinarySearch(entryToFind, indexEntryComparer) 64 | if p < 0 then ~~~p else p 65 | let handle index = 66 | let entry = entries.[index] 67 | let matchKind = 68 | if entry.Offset = 0 then 69 | if entry.Length = searchValue.Length then MatchKind.Exact 70 | else MatchKind.Prefix 71 | else MatchKind.Substring 72 | processor(entry.Item, entry.String, entry.IsOperator, matchKind) 73 | 74 | // in case if there are multiple matching items binary search might return not the first one. 75 | // in this case we'll walk backwards searching for the applicable answers 76 | let mutable pos = initial 77 | while pos >= 0 && pos < entries.Count && entries.[pos].StartsWith searchValue do 78 | handle pos 79 | pos <- pos - 1 80 | 81 | // value of 'initial' position was already handled on the previous step so here we'll bump it 82 | let mutable pos = initial + 1 83 | while pos < entries.Count && entries.[pos].StartsWith searchValue do 84 | handle pos 85 | pos <- pos + 1 86 | } -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/NavigateToItem.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Navigation.NavigateToItem 2 | 3 | open Microsoft.CodeAnalysis 4 | open Microsoft.CodeAnalysis.FindSymbols 5 | 6 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Navigation/NavigateToReferenceSource.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Navigation.NavigateToReferenceSource 2 | 3 | //namespace FSharp.Editing.VisualStudio.Navigation 4 | // 5 | //open System 6 | //open System.IO 7 | //open System.Net.Http 8 | //open System.Net.NetworkInformation 9 | //open System.Windows.Threading 10 | //open System.Security.Cryptography 11 | //open FSharp.Editing 12 | //open System.Text 13 | //open Microsoft.FSharp.Compiler.SourceCodeServices 14 | //open FSharp.Editing.VisualStudio 15 | // 16 | //// Reference https://github.com/SLaks/Ref12/blob/master/Ref12/Services/ReferenceSourceProvider.cs 17 | // 18 | //type ReferenceSourceProvider(baseUrl: string) = 19 | // let timer = DispatcherTimer (DispatcherPriority.ApplicationIdle, Interval = TimeSpan.FromMinutes 60.) 20 | // let mutable availableAssemblies = Set.empty 21 | // 22 | // let lookUpAvailableAssemblies() = 23 | // async { 24 | // use handler = new HttpClientHandler(UseDefaultCredentials = true) 25 | // use http = new HttpClient(handler) 26 | // let! assemblyList = http.GetStringAsync(baseUrl + "/assemblies.txt") |> Async.AwaitTask 27 | // let assemblies = 28 | // assemblyList 29 | // |> String.getNonEmptyLines 30 | // |> Array.map (fun s -> s.Remove(s.IndexOf(';'))) 31 | // |> Set.ofArray 32 | // return availableAssemblies <- assemblies 33 | // } 34 | // |> Async.StartImmediateSafe 35 | // 36 | // let networkAvailabilityChanged (arg: NetworkAvailabilityEventArgs) = 37 | // if arg.IsAvailable then 38 | // lookUpAvailableAssemblies() 39 | // 40 | // let lookUpSubscription = timer.Tick.Subscribe(fun _ -> lookUpAvailableAssemblies()) 41 | // 42 | // let networkAvailabilitySubscription = NetworkChange.NetworkAvailabilityChanged.Subscribe(networkAvailabilityChanged) 43 | // let networkAddressSubscription = NetworkChange.NetworkAddressChanged.Subscribe(fun _ -> lookUpAvailableAssemblies()) 44 | // 45 | // let getMD5Hash (input: string) = 46 | // use md5 = MD5.Create() 47 | // let bytes = Encoding.UTF8.GetBytes(input) 48 | // let hashBytes = md5.ComputeHash(bytes) 49 | // Array.toShortHexString hashBytes 50 | // 51 | // member __.IsActivated = 52 | // timer.IsEnabled 53 | // 54 | // member __.Activate() = 55 | // timer.Start() 56 | // lookUpAvailableAssemblies() 57 | // 58 | // member __.AvailableAssemblies = availableAssemblies 59 | // 60 | // member __.TryGetNavigatedUrl(symbol: FSharpSymbol) = 61 | // let xmlDocSig = 62 | // match symbol with 63 | // | MemberFunctionOrValue mem -> 64 | // Some mem.XmlDocSig 65 | // | TypedAstPatterns.FSharpEntity(entity, _, _) -> 66 | // Some entity.XmlDocSig 67 | // | _ -> None 68 | // xmlDocSig 69 | // |> Option.bind (fun xmlDocSig -> 70 | // symbol.Assembly.FileName 71 | // |> Option.map Path.GetFileNameWithoutExtension 72 | // |> Option.map (fun assemblyName -> 73 | // let url = baseUrl + "/" + assemblyName + "/a.html#" + getMD5Hash xmlDocSig 74 | // Logging.logInfo (fun _ -> sprintf "Go to definition at '%s'." url) 75 | // url)) 76 | // 77 | // interface IDisposable with 78 | // member __.Dispose() = 79 | // lookUpSubscription.Dispose() 80 | // networkAvailabilitySubscription.Dispose() 81 | // networkAddressSubscription.Dispose() 82 | // timer.Stop() 83 | -------------------------------------------------------------------------------- /src/FSharp.Editing/ProjectSystem/FileSystem.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.ProjectSystem 2 | 3 | open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library 4 | open System.IO 5 | open Microsoft.CodeAnalysis 6 | open Microsoft.CodeAnalysis.Editing 7 | open Microsoft.CodeAnalysis.Text 8 | open FSharp.Editing 9 | open FSharp.Editing.ProjectSystem 10 | 11 | type Version = int 12 | 13 | //[] 14 | type WorkspaceFileSystem (workspace:FSharpWorkspace) = 15 | 16 | static let defaultFileSystem = Shim.DefaultFileSystem () :> IFileSystem 17 | 18 | let getDocumentContent (fileName: string) = 19 | workspace.TryGetDocument fileName 20 | |> Option.map ^ fun doc -> 21 | doc.GetText().GetBytes() 22 | 23 | interface IFileSystem with 24 | member __.FileStreamReadShim fileName = 25 | getDocumentContent fileName 26 | |> Option.map ^ fun bytes -> new MemoryStream (bytes) :> Stream 27 | |> Option.getOrTry ^ fun () -> defaultFileSystem.FileStreamReadShim fileName 28 | 29 | member __.ReadAllBytesShim fileName = 30 | getDocumentContent fileName 31 | |> Option.getOrTry ^ fun () -> defaultFileSystem.ReadAllBytesShim fileName 32 | 33 | member __.GetLastWriteTimeShim fileName = 34 | workspace.TryGetDocumentId fileName 35 | |> Option.bind ^ fun docId -> workspace.GetLastWriteTime docId 36 | |> Option.getOrTry ^ fun () -> defaultFileSystem.GetLastWriteTimeShim fileName 37 | 38 | member __.GetTempPathShim () = defaultFileSystem.GetTempPathShim() 39 | member __.FileStreamCreateShim fileName = defaultFileSystem.FileStreamCreateShim fileName 40 | member __.FileStreamWriteExistingShim fileName = defaultFileSystem.FileStreamWriteExistingShim fileName 41 | member __.GetFullPathShim fileName = defaultFileSystem.GetFullPathShim fileName 42 | member __.IsInvalidPathShim fileName = defaultFileSystem.IsInvalidPathShim fileName 43 | member __.IsPathRootedShim fileName = defaultFileSystem.IsPathRootedShim fileName 44 | member __.SafeExists fileName = defaultFileSystem.SafeExists fileName 45 | member __.FileDelete fileName = defaultFileSystem.FileDelete fileName 46 | member __.AssemblyLoadFrom fileName = defaultFileSystem.AssemblyLoadFrom fileName 47 | member __.AssemblyLoad assemblyName = defaultFileSystem.AssemblyLoad assemblyName 48 | -------------------------------------------------------------------------------- /src/FSharp.Editing/ProjectSystem/FileSystemWatcher.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.ProjectSystem.FileSystemWatcher 2 | 3 | open System 4 | open System.IO 5 | open Microsoft.CodeAnalysis 6 | open Microsoft.CodeAnalysis.Text 7 | open Microsoft.CodeAnalysis.Completion 8 | open FSharp.Control 9 | 10 | 11 | 12 | open FSharp.Editing 13 | 14 | 15 | let FsEvent = Event<_>() 16 | let fseventstream = FsEvent.Publish 17 | 18 | let createWatchStream (rootDir:string) = 19 | let watchers = 20 | [ "fs";"fsi";"fsx";"fsscript";"fsproj"] 21 | |> List.map ^ fun ext -> 22 | new FileSystemWatcher(ext,Path=rootDir,IncludeSubdirectories=true) 23 | 24 | ((fseventstream :> IObservable<_>), watchers) 25 | ||> List.fold (fun acc elem -> Observable.merge elem.Changed acc) 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/FSharp.Editing/ProjectSystem/HostServices.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.ProjectSystem.HostServices 2 | 3 | open System 4 | open System.Collections.Generic 5 | open System.Reflection 6 | open System.Composition 7 | open System.Composition.Hosting.Core 8 | open System.Collections.Immutable 9 | open Microsoft.CodeAnalysis 10 | open Microsoft.CodeAnalysis.Host 11 | open Microsoft.CodeAnalysis.Host.Mef 12 | open FSharp.Editing 13 | // based on - https://gist.github.com/praeclarum/953629b2f80860e54747 14 | 15 | type FSharpHostLanguageService (workspace:Workspace) = 16 | inherit HostLanguageServices() 17 | 18 | override __.Language = Constants.FSharpLanguageName 19 | override __.WorkspaceServices with get () = workspace.Services 20 | override __.GetService<'a when 'a :> ILanguageService>() : 'a = Unchecked.defaultof<'a> 21 | 22 | 23 | 24 | type FSharpHostWorkspaceService (workspace:Workspace,baseServices:HostWorkspaceServices) = 25 | inherit HostWorkspaceServices() 26 | 27 | let languageService = FSharpHostLanguageService workspace 28 | 29 | override __.GetService<'a when 'a :> IWorkspaceService >() = 30 | baseServices.GetService<'a>() 31 | 32 | override __.HostServices with get() = workspace.Services.HostServices 33 | 34 | override __.Workspace = workspace 35 | 36 | override __.IsSupported languageName = languageName = Constants.FSharpLanguageName 37 | 38 | override __.SupportedLanguages = seq [Constants.FSharpLanguageName] 39 | 40 | override __.GetLanguageServices _ = languageService :> HostLanguageServices 41 | 42 | override __.FindLanguageServices filter = base.FindLanguageServices filter 43 | 44 | 45 | type FSharpHostService () = 46 | inherit HostServices() 47 | let baseWorkspace = new AdhocWorkspace() 48 | 49 | override __.CreateWorkspaceServices workspace = 50 | FSharpHostWorkspaceService(workspace,baseWorkspace.Services) :> HostWorkspaceServices 51 | 52 | 53 | type IHostServicesProvider = 54 | abstract Assemblies : Assembly ImmutableArray 55 | 56 | type [] HostServicesAggregator [] 57 | ([] hostServicesProviders : seq) = 58 | let builder = ImmutableHashSet.CreateBuilder () 59 | do for asm in MefHostServices.DefaultAssemblies do 60 | builder.Add asm |> ignore 61 | for provider in hostServicesProviders do 62 | for asm in provider.Assemblies do 63 | builder.Add asm |> ignore 64 | let assemblies = builder.ToImmutableArray () 65 | member __.CreateHostServices () = MefHostServices.Create assemblies 66 | 67 | type MefValueProvider<'a> (item:'a) = 68 | inherit ExportDescriptorProvider() 69 | 70 | // override self.GetExportDescriptors (contract:CompositionContract, descriptorAcessor:DependencyAccessor) = 71 | // seq { if contract.ContractType = typeof<'a> then 72 | // yield ExportDescriptorPromise 73 | // ( contract, String.Empty, true, 74 | // (fun () -> Seq.empty : CompositionDependency seq), 75 | // (fun deps -> 76 | // ExportDescriptor.Create 77 | // ( CompositeActivator (fun context operation -> item :> obj) 78 | // , Dictionary()) 79 | // ) 80 | // ) 81 | // else yield! Seq.empty 82 | // } 83 | 84 | override self.GetExportDescriptors (contract:CompositionContract, _ ) = 85 | seq { if contract.ContractType = typeof<'a> then 86 | yield ExportDescriptorPromise 87 | ( contract, String.Empty, true, 88 | (fun () -> Seq.empty : CompositionDependency seq), 89 | (fun _ -> ExportDescriptor.Create(CompositeActivator(fun _ _ -> item :> obj),Dictionary<_,_>())) 90 | ) 91 | else yield! Seq.empty 92 | } 93 | 94 | type MefValueProvider = 95 | static member From<'a> (value:'a) = MefValueProvider<'a> value -------------------------------------------------------------------------------- /src/FSharp.Editing/ProjectSystem/OpenDocumentsTracker.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.ProjectSystem 2 | 3 | open System 4 | open System.Text 5 | open System.Collections.Generic 6 | open Microsoft.CodeAnalysis 7 | open Microsoft.CodeAnalysis.Text 8 | open Microsoft.FSharp.Compiler 9 | open Microsoft.FSharp.Compiler.Range 10 | open FSharp.Editing 11 | 12 | 13 | [] 14 | type EditorBuffer = { 15 | Text : string 16 | Range : range 17 | IsDirty : bool 18 | Encoding : Encoding 19 | LastChangeTime : DateTime 20 | ViewCount : int 21 | } with 22 | static member Create text range isDirty encoding lastChangeTime = { 23 | Text = text 24 | Range = range 25 | IsDirty = isDirty 26 | Encoding = encoding 27 | LastChangeTime = lastChangeTime 28 | ViewCount = 1 29 | } 30 | 31 | 32 | 33 | type IBufferTracker = 34 | abstract MapEditorBuffers : (KeyValuePair -> 'a) -> seq<'a> 35 | abstract TryFindEditorBuffer : string -> EditorBuffer option 36 | abstract TryGetBufferText : string -> string option 37 | abstract BufferChanged : string IEvent 38 | abstract BufferClosed : string IEvent 39 | 40 | 41 | 42 | type IOpenDocument = 43 | abstract Text : Lazy 44 | 45 | type IOpenDocumentsTracker<'OpenDoc when 'OpenDoc :> IOpenDocument> = 46 | abstract MapOpenDocuments: (KeyValuePair -> 'a) -> seq<'a> 47 | abstract TryFindOpenDocument: string -> 'OpenDoc option 48 | abstract TryGetDocumentText: string -> string option 49 | abstract DocumentChanged: IEvent 50 | abstract DocumentClosed: IEvent 51 | 52 | 53 | [] 54 | type OpenDocument = { 55 | Document: Document 56 | Source: SourceText 57 | Encoding: Encoding 58 | LastChangeTime: VersionStamp 59 | ViewCount: int 60 | } with 61 | static member Create (document:Document) = 62 | let src = document.GetText() in 63 | { Document = document 64 | Source = src 65 | Encoding = src.Encoding 66 | LastChangeTime = document.GetTextVerison() 67 | ViewCount = 1 68 | } 69 | member x.Text = lazy x.Source.ToString() 70 | interface IOpenDocument with 71 | member x.Text = lazy x.Source.ToString() 72 | -------------------------------------------------------------------------------- /src/FSharp.Editing/ProjectSystem/ProjectConfig.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.ProjectSystem 2 | 3 | open System 4 | open System.IO 5 | open FSharp.Editing 6 | 7 | type ProjectSettings = 8 | { IsForStandaloneScript : bool 9 | ProjectFile : FileName 10 | TargetFramework : FSharpTargetFramework 11 | CompilerVersion : FSharpCompilerVersion option 12 | CompilerOptions : string [] 13 | SourceFiles : FileName [] 14 | FullOutputFilePath : FileName option 15 | References : FileName [] 16 | ProjectReferences : FileName [] } 17 | 18 | type ProjectConfig = 19 | | FsProject of ProjectSettings 20 | | FsxProject of ProjectSettings 21 | | SigProject of ProjectSettings 22 | 23 | [] 24 | module ProjectConfig = 25 | /// F# project file extension - `.fsproj` 26 | [] 27 | let fsprojext = ".fsproj" 28 | 29 | (* Compiler Flags *) 30 | 31 | /// Compiler Flag `--noframework` 32 | [] 33 | let noframeworkFlag = "--noframework" 34 | 35 | /// Compiler Flag `--debug-` 36 | [] 37 | let debugFlag = "--debug-" 38 | 39 | /// Compiler Flag `--optimize-` 40 | [] 41 | let optimizeFlag = "--optimize-" 42 | 43 | /// Compiler Flag `--tailcalls-` 44 | [] 45 | let tailcallsFlag = "--tailcalls-" 46 | 47 | /// Checks a file path to see if the extension matches `.fsproj` 48 | let isFSharpProject projectPath = String.equalsIgnoreCase (Path.GetExtension projectPath) fsprojext 49 | 50 | /// Creates a ProjectConfig for a normal F# Project 51 | let fsProjectConfig (projectPath, targetFramework, fscVersion, fscOptions, srcFiles, outputPath, references, 52 | projectReferences) = 53 | { IsForStandaloneScript = false 54 | ProjectFile = projectPath 55 | TargetFramework = targetFramework 56 | CompilerVersion = fscVersion 57 | CompilerOptions = fscOptions 58 | SourceFiles = srcFiles 59 | FullOutputFilePath = outputPath 60 | References = references 61 | ProjectReferences = projectReferences } 62 | |> FsProject 63 | 64 | 65 | /// Creates an ad-hoc ProjectConfig to integrate generated signatures into the project system 66 | let signatureProjectConfig (sigpath : FileName) (project : ProjectSettings) = 67 | let sigProjectName = sigpath + fsprojext 68 | let sourceFiles = [| sigpath |] 69 | let flags = [| noframeworkFlag; debugFlag; optimizeFlag; tailcallsFlag |] 70 | { IsForStandaloneScript = true 71 | ProjectFile = sigProjectName 72 | TargetFramework = project.TargetFramework 73 | CompilerVersion = project.CompilerVersion 74 | CompilerOptions = flags 75 | SourceFiles = sourceFiles 76 | FullOutputFilePath = Some(Path.ChangeExtension(sigProjectName, ".dll")) 77 | References = [||] 78 | ProjectReferences = [||] } 79 | |> SigProject 80 | 81 | 82 | /// Creates a standalone ProjectConfig for an fsx script file 83 | let fsxProjectConfig (fsxPath : FileName) (compilerVersion) = 84 | let fsxProjectName = fsxPath + fsprojext 85 | let flags = [| noframeworkFlag; debugFlag; optimizeFlag; tailcallsFlag |] 86 | { IsForStandaloneScript = true 87 | ProjectFile = fsxProjectName 88 | TargetFramework = FSharpTargetFramework.NET_4_5 89 | CompilerVersion = Some compilerVersion 90 | CompilerOptions = flags 91 | SourceFiles = [| fsxPath |] 92 | FullOutputFilePath = Some(Path.ChangeExtension(fsxProjectName, ".dll")) 93 | References = [||] 94 | ProjectReferences = [||] } 95 | |> FsxProject 96 | -------------------------------------------------------------------------------- /src/FSharp.Editing/ProjectSystem/SolutionProvider.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Infrastructure 2 | 3 | open Microsoft.FSharp.Compiler.SourceCodeServices 4 | open FSharp.Editing 5 | 6 | type ProjectDescriptor = 7 | { IsForStandaloneScript : bool 8 | ProjectFile : FileName 9 | TargetFramework : FSharpTargetFramework 10 | CompilerVersion : FSharpCompilerVersion option 11 | CompilerOptions : string array 12 | SourceFiles : FileName array 13 | FullOutputFilePath : FileName option } 14 | 15 | type IProjectProvider = 16 | abstract Project: ProjectDescriptor 17 | abstract GetReferencedProjects: unit -> IProjectProvider list 18 | abstract GetAllReferencedProjectFileNames: unit -> string list 19 | abstract GetProjectCheckerOptions: LanguageService -> Async 20 | 21 | [] 22 | module TypeExtensions = 23 | // this is to avoid unneeded code churn while we figure out further changes to IProjectProvider 24 | type IProjectProvider with 25 | member inline x.IsForStandaloneScript = x.Project.IsForStandaloneScript 26 | member inline x.ProjectFileName = x.Project.ProjectFile 27 | member inline x.TargetFramework = x.Project.TargetFramework 28 | member inline x.CompilerVersion = x.Project.CompilerVersion 29 | member inline x.CompilerOptions = x.Project.CompilerOptions 30 | member inline x.SourceFiles = x.Project.SourceFiles 31 | member inline x.FullOutputFilePath = x.Project.FullOutputFilePath -------------------------------------------------------------------------------- /src/FSharp.Editing/Scratchpad.fsx: -------------------------------------------------------------------------------- 1 | #r "../../bin/FSharp.Compiler.Service.dll" 2 | 3 | #load "../../src/FSharpVSPowerTools.Core/Utils.fs" 4 | "../../src/FSharpVSPowerTools.Core/CompilerLocationUtils.fs" 5 | "../../src/FSharpVSPowerTools.Core/UntypedAstUtils.fs" 6 | "../../src/FSharpVSPowerTools.Core/TypedAstUtils.fs" 7 | "../../src/FSharpVSPowerTools.Core/Lexer.fs" 8 | "../../src/FSharpVSPowerTools.Core/AssemblyContentProvider.fs" 9 | "../../src/FSharpVSPowerTools.Core/LanguageService.fs" 10 | // "../../src/FSharpVSPowerTools.Core/XmlDocParser.fs" 11 | // "../../src/FSharpVSPowerTools.Core/DepthParser.fs" 12 | // "../../src/FSharpVSPowerTools.Core/NavigableItemsCollector.fs" 13 | // "../../src/FSharpVSPowerTools.Core/NavigateToIndex.fs" 14 | // "../../src/FSharpVSPowerTools.Core/IdentifierUtils.fs" 15 | // "../../src/FSharpVSPowerTools.Core/OpenDeclarationsGetter.fs" 16 | // "../../src/FSharpVSPowerTools.Core/SourceCodeClassifier.fs" 17 | // "../../src/FSharpVSPowerTools.Core/CodeGeneration.fs" 18 | // "../../src/FSharpVSPowerTools.Core/InterfaceStubGenerator.fs" 19 | // "../../src/FSharpVSPowerTools.Core/RecordStubGenerator.fs" 20 | // "../../src/FSharpVSPowerTools.Core/UnionPatternMatchCaseGenerator.fs" 21 | // "../../src/FSharpVSPowerTools.Core/UnopenedNamespacesResolver.fs" 22 | // "../../src/FSharpVSPowerTools.Core/SignatureGenerator.fs" 23 | // "../../src/FSharpVSPowerTools.Core/TaskListCommentExtractor.fs" 24 | 25 | open System.IO 26 | open FSharpVSPowerTools 27 | 28 | let fileName = Path.Combine (__SOURCE_DIRECTORY__, __SOURCE_FILE__) 29 | let projectFileName = Path.ChangeExtension(fileName, ".fsproj") 30 | let sourceFiles = [| fileName |] 31 | let framework = FSharpCompilerVersion.FSharp_3_1 32 | let languageService = LanguageService() 33 | 34 | let args = 35 | [|"--noframework"; "--debug-"; "--optimize-"; "--tailcalls-"; 36 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll"; 37 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll"; 38 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll"; 39 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll"; 40 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll"; 41 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Numerics.dll"; 42 | @"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll"|] 43 | 44 | let opts source = 45 | let opts = 46 | languageService.GetCheckerOptions (fileName, projectFileName, source, sourceFiles, args, [||], framework) 47 | |> Async.RunSynchronously 48 | { opts with LoadTime = System.DateTime.UtcNow } 49 | 50 | let getLexer source = 51 | let sourceLines = String.getLines source 52 | let lexer = 53 | { new LexerBase() with 54 | member __.GetSymbolFromTokensAtLocation (_tokens, line, col) = 55 | let lineStr = sourceLines.[line] 56 | Lexer.getSymbol source line col lineStr SymbolLookupKind.ByLongIdent args Lexer.queryLexState 57 | member __.TokenizeLine line = 58 | let lineStr = sourceLines.[line] 59 | Lexer.tokenizeLine source args line lineStr Lexer.queryLexState 60 | member __.LineCount = sourceLines.Length } 61 | lexer 62 | 63 | #time "on";; 64 | 65 | let lexer = 66 | getLexer """open A.B.C.D 67 | """ 68 | 69 | //let tokens = lexer.TokenizeAll();; 70 | let symbol = lexer.GetSymbolFromTokensAtLocation([], 0, 6);; -------------------------------------------------------------------------------- /src/FSharp.Editing/Scripts/load-project-debug.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #load "load-references-debug.fsx" 4 | #load "../ProjectSystem/OpenDocumentsTracker.fs" 5 | "../ProjectSystem/ProjectConfig.fs" 6 | "../ProjectSystem/ProjectSitesAndFiles.fs" 7 | "../ProjectSystem/HostServices.fs" 8 | "../ProjectSystem/FSharpWorkspace.fs" 9 | "../ProjectSystem/FileSystem.fs" 10 | "../ProjectSystem/LanguageService.fs" 11 | "../ProjectSystem/SolutionProvider.fs" 12 | "../ProjectSystem/FileSystemWatcher.fs" 13 | "../ProjectSystem/SolutionFileInfo.fs" 14 | "../Navigation/NavigableItemsCollector.fs" 15 | "../Navigation/NavigateToIndex.fs" 16 | "../Navigation/NavigableItemCache.fs" 17 | "../Navigation/NavigateToItem.fs" 18 | "../Navigation/GoToDefinition.fs" 19 | "../Navigation/GoToSignature.fs" 20 | "../Navigation/GoToImplementation.fs" 21 | "../Navigation/GoToDeclaration.fs" 22 | "../Navigation/NavigateToReferenceSource.fs" 23 | "../Navigation/NavigateToMetadata.fs" 24 | "../Documentation/XmlDocParser.fs" 25 | "../Documentation/XmlDocBuilder.fs" 26 | "../Documentation/XmlDocGenerator.fs" 27 | "../Documentation/XmlDocCache.fs" 28 | "../Coloring/DepthParser.fs" 29 | "../Coloring/OpenDeclarationsGetter.fs" 30 | "../Coloring/UnopenedNamespacesResolver.fs" 31 | "../Coloring/HighlightUsageInFile.fs" 32 | "../Coloring/PrintfSpecifiersUsageGetter.fs" 33 | "../Coloring/DocumentHighlights.fs" 34 | "../Symbols/SymbolHelpers.fs" 35 | "../Symbols/SourceCodeClassifier.fs" 36 | "../Symbols/QuickInfoProvider.fs" 37 | "../CodeGeneration/IndentedTextWriter.fs" 38 | "../CodeGeneration/CodeGeneration.fs" 39 | "../CodeGeneration/SignatureGenerator.fs" 40 | "../CodeGeneration/UnionPatternMatchCaseGenerator.fs" 41 | "../CodeGeneration/InterfaceStubGenerator.fs" 42 | "../CodeGeneration/RecordStubGenerator.fs" 43 | "../Structure/BlockStructure.fs" 44 | "../Completion/SignatureHelp.fs" 45 | "../Completion/FileSystemCompletion.fs" 46 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Scripts/load-project-release.fsx: -------------------------------------------------------------------------------- 1 | // Warning: generated file; your changes could be lost when a new file is generated. 2 | #I __SOURCE_DIRECTORY__ 3 | #load "load-references-release.fsx" 4 | #load "../ProjectSystem/OpenDocumentsTracker.fs" 5 | "../ProjectSystem/ProjectConfig.fs" 6 | "../ProjectSystem/ProjectSitesAndFiles.fs" 7 | "../ProjectSystem/HostServices.fs" 8 | "../ProjectSystem/FSharpWorkspace.fs" 9 | "../ProjectSystem/FileSystem.fs" 10 | "../ProjectSystem/LanguageService.fs" 11 | "../ProjectSystem/SolutionProvider.fs" 12 | "../ProjectSystem/FileSystemWatcher.fs" 13 | "../ProjectSystem/SolutionFileInfo.fs" 14 | "../Navigation/NavigableItemsCollector.fs" 15 | "../Navigation/NavigateToIndex.fs" 16 | "../Navigation/NavigableItemCache.fs" 17 | "../Navigation/NavigateToItem.fs" 18 | "../Navigation/GoToDefinition.fs" 19 | "../Navigation/GoToSignature.fs" 20 | "../Navigation/GoToImplementation.fs" 21 | "../Navigation/GoToDeclaration.fs" 22 | "../Navigation/NavigateToReferenceSource.fs" 23 | "../Navigation/NavigateToMetadata.fs" 24 | "../Documentation/XmlDocParser.fs" 25 | "../Documentation/XmlDocBuilder.fs" 26 | "../Documentation/XmlDocGenerator.fs" 27 | "../Documentation/XmlDocCache.fs" 28 | "../Coloring/DepthParser.fs" 29 | "../Coloring/OpenDeclarationsGetter.fs" 30 | "../Coloring/UnopenedNamespacesResolver.fs" 31 | "../Coloring/HighlightUsageInFile.fs" 32 | "../Coloring/PrintfSpecifiersUsageGetter.fs" 33 | "../Coloring/DocumentHighlights.fs" 34 | "../Symbols/SymbolHelpers.fs" 35 | "../Symbols/SourceCodeClassifier.fs" 36 | "../Symbols/QuickInfoProvider.fs" 37 | "../CodeGeneration/IndentedTextWriter.fs" 38 | "../CodeGeneration/CodeGeneration.fs" 39 | "../CodeGeneration/SignatureGenerator.fs" 40 | "../CodeGeneration/UnionPatternMatchCaseGenerator.fs" 41 | "../CodeGeneration/InterfaceStubGenerator.fs" 42 | "../CodeGeneration/RecordStubGenerator.fs" 43 | "../Structure/BlockStructure.fs" 44 | "../Completion/SignatureHelp.fs" 45 | "../Completion/FileSystemCompletion.fs" 46 | -------------------------------------------------------------------------------- /src/FSharp.Editing/Structure/BlockStructure.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Editing.Structure 2 | 3 | open System.Collections.Immutable 4 | open System.Threading.Tasks 5 | 6 | open Microsoft.CodeAnalysis 7 | open Microsoft.CodeAnalysis.Text 8 | open Microsoft.CodeAnalysis.Structure 9 | 10 | open Microsoft.FSharp.Compiler 11 | open Microsoft.FSharp.Compiler.Range 12 | open Microsoft.FSharp.Compiler.SourceCodeServices 13 | open FSharp.Editing 14 | open FSharp.Editing.UntypedAstUtils 15 | open FSharp.Editing.UntypedAstUtils.Outlining 16 | 17 | //module internal BlockStructure = 18 | // let scopeToBlockType = function 19 | // | Scope.Open -> BlockTypes.Imports 20 | // | Scope.Namespace 21 | // | Scope.Module -> BlockTypes.Namespace 22 | // | Scope.Record 23 | // | Scope.Interface 24 | // | Scope.TypeExtension 25 | // | Scope.RecordDefn 26 | // | Scope.CompExpr 27 | // | Scope.ObjExpr 28 | // | Scope.UnionDefn 29 | // | Scope.Attribute 30 | // | Scope.Type -> BlockTypes.Type 31 | // | Scope.New 32 | // | Scope.RecordField 33 | // | Scope.Member -> BlockTypes.Member 34 | // | Scope.LetOrUse 35 | // | Scope.Match 36 | // | Scope.MatchClause 37 | // | Scope.EnumCase 38 | // | Scope.UnionCase 39 | // | Scope.MatchLambda 40 | // | Scope.ThenInIfThenElse 41 | // | Scope.ElseInIfThenElse 42 | // | Scope.TryWith 43 | // | Scope.TryInTryWith 44 | // | Scope.WithInTryWith 45 | // | Scope.TryFinally 46 | // | Scope.TryInTryFinally 47 | // | Scope.FinallyInTryFinally 48 | // | Scope.IfThenElse-> BlockTypes.Conditional 49 | // | Scope.Tuple 50 | // | Scope.ArrayOrList 51 | // | Scope.CompExprInternal 52 | // | Scope.Quote 53 | // | Scope.SpecialFunc 54 | // | Scope.Lambda 55 | // | Scope.LetOrUseBang 56 | // | Scope.Val 57 | // | Scope.YieldOrReturn 58 | // | Scope.YieldOrReturnBang 59 | // | Scope.TryWith -> BlockTypes.Expression 60 | // | Scope.Do -> BlockTypes.Statement 61 | // | Scope.While 62 | // | Scope.For -> BlockTypes.Loop 63 | // | Scope.HashDirective -> BlockTypes.PreprocessorRegion 64 | // | Scope.Comment 65 | // | Scope.XmlDocComment -> BlockTypes.Comment 66 | 67 | // let createBlockSpans (sourceText:SourceText) (parsedInput:Ast.ParsedInput) = 68 | // let linetext = sourceText.Lines |> Seq.map (fun x -> x.ToString()) |> Seq.toArray 69 | 70 | // getOutliningRanges linetext parsedInput 71 | // |> Seq.distinctBy (fun x -> x.Range.StartLine) 72 | // |> Seq.choose (fun scopeRange -> 73 | // // the range of text to collapse 74 | // let textSpan = CommonRoslynHelpers.TryFSharpRangeToTextSpan(sourceText, scopeRange.CollapseRange) 75 | // // the range of the entire expression 76 | // let hintSpan = CommonRoslynHelpers.TryFSharpRangeToTextSpan(sourceText, scopeRange.Range) 77 | // match textSpan,hintSpan with 78 | // | Some textSpan, Some hintSpan -> 79 | // let line = sourceText.Lines.GetLineFromPosition textSpan.Start 80 | // let bannerText = 81 | // match Option.ofNullable (line.Span.Intersection textSpan) with 82 | // | Some span -> sourceText.GetSubText(span).ToString()+"..." 83 | // | None -> "..." 84 | 85 | // Some <| (BlockSpan(scopeToBlockType scopeRange.Scope, true, textSpan,hintSpan,bannerText):BlockSpan) 86 | // | _, _ -> None 87 | // ) 88 | 89 | -------------------------------------------------------------------------------- /src/FSharp.Editing/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Compiler.Service 2 | Newtonsoft.Json 3 | wire 4 | FSharp.Core 5 | Microsoft.CodeAnalysis.Common 6 | Microsoft.CodeAnalysis.Workspaces.Common 7 | Microsoft.CodeAnalysis.Features 8 | Microsoft.Extensions.Logging.Abstractions 9 | System.Xml.ReaderWriter 10 | 11 | -------------------------------------------------------------------------------- /src/TestConsole/AssemblyInfo.fs: -------------------------------------------------------------------------------- 1 | namespace TestConsole.AssemblyInfo 2 | 3 | open System.Reflection 4 | open System.Runtime.CompilerServices 5 | open System.Runtime.InteropServices 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [] 11 | [] 12 | [] 13 | [] 14 | [] 15 | [] 16 | [] 17 | [] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | [] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [] 37 | [] 38 | [] 39 | 40 | do 41 | () -------------------------------------------------------------------------------- /src/TestConsole/Program.fs: -------------------------------------------------------------------------------- 1 | open System 2 | open System.Threading 3 | open Microsoft.CodeAnalysis 4 | open System.IO 5 | open FSharp.Editing 6 | open FSharp.Editing.ProjectSystem 7 | open Newtonsoft.Json 8 | 9 | 10 | type OutputReader (sr:StreamReader) = 11 | let mutable text = "" 12 | member __.Exec () = 13 | text <- sr.ReadToEnd() 14 | member __.Text = text 15 | 16 | 17 | [] 18 | let main argv = 19 | 20 | 21 | System.IO.Directory.SetCurrentDirectory __SOURCE_DIRECTORY__ 22 | let clientFsproj = "../Fsharp.Editing.Client/FSharp.Editing.Client.fsproj" 23 | 24 | #if DEBUG 25 | let inspectorPath = "../Fsharp.Editing.ProjectInspector/bin/Debug/Fsharp.Editing.ProjectInspector.exe" 26 | let workDir = Path.GetFullPath "../Fsharp.Editing.ProjectInspector/bin/Debug/" 27 | #else 28 | let inspectorPath = "../Fsharp.Editing.ProjectInspector/bin/Release/Fsharp.Editing.ProjectInspector.exe" 29 | let workDir = Path.GetFullPath "../Fsharp.Editing.ProjectInspector/bin/Release/" 30 | #endif 31 | 32 | let fsprojPath = Path.GetFullPath clientFsproj 33 | let inspectorTool = Path.GetFullPath inspectorPath 34 | printfn "%s" fsprojPath 35 | printfn "%s" inspectorTool 36 | 37 | let p = new System.Diagnostics.Process() 38 | p.StartInfo.FileName <- inspectorTool 39 | p.StartInfo.Arguments <- fsprojPath 40 | p.StartInfo.WorkingDirectory <- workDir 41 | p.StartInfo.UseShellExecute <- false 42 | p.StartInfo.CreateNoWindow <- true 43 | p.StartInfo.RedirectStandardOutput <- true 44 | 45 | printfn "Starting msbuild project evaluation\n" 46 | 47 | ignore <| p.Start() 48 | 49 | 50 | let json = p.StandardOutput.ReadToEnd() 51 | let info = JsonConvert.DeserializeObject(json) 52 | 53 | let fsls = FSharp.Editing.LanguageService() 54 | let projinfo = FSharp.Editing.ProjectSystem.ProjectFileInfo.toProjectInfo fsls.Workspace info 55 | let proj = fsls.Workspace.AddProject projinfo 56 | 57 | fsls.Workspace.CurrentSolution.Projects 58 | |> Seq.iter (fun x -> printfn "%s - %s" x.Name x.AssemblyName) 59 | p.WaitForExit() 60 | Console.ReadLine()|> ignore 61 | 62 | 0 // return an integer exit code 63 | -------------------------------------------------------------------------------- /src/TestConsole/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Core 2 | Microsoft.CodeAnalysis.Common 3 | Microsoft.CodeAnalysis.Workspaces.Common 4 | Microsoft.CodeAnalysis.Features 5 | FSharp.Compiler.Service 6 | Microsoft.Build 7 | Newtonsoft.Json -------------------------------------------------------------------------------- /src/netcore/FSharp.Editing.Client/paket.references: -------------------------------------------------------------------------------- 1 | 2 | group netcore 3 | Newtonsoft.Json 4 | 5 | FSharp.Core 6 | System.IO.FileSystem 7 | System.IO.FileSystem.Primitives 8 | System.Reflection.TypeExtensions 9 | System.Runtime.Serialization.Primitives 10 | 11 | FSharp.NET.Sdk 12 | 13 | -------------------------------------------------------------------------------- /src/netcore/FSharp.Editing.Core/paket.references: -------------------------------------------------------------------------------- 1 | 2 | 3 | group netcore 4 | 5 | Newtonsoft.Json 6 | wire 7 | 8 | FSharp.Core 9 | FSharp.Compiler.Service 10 | FSharp.NET.Sdk 11 | NETStandard.Library 12 | 13 | System.Xml.ReaderWriter 14 | System.Xml.XDocument 15 | 16 | Microsoft.Extensions.Logging.Abstractions 17 | 18 | Microsoft.CodeAnalysis.Common 19 | Microsoft.CodeAnalysis.Workspaces.Common 20 | Microsoft.CodeAnalysis.Features -------------------------------------------------------------------------------- /src/netcore/FSharp.Editing.Messages/paket.references: -------------------------------------------------------------------------------- 1 | Newtonsoft.Json 2 | 3 | group netcore 4 | FSharp.Core 5 | FSharp.NET.Sdk -------------------------------------------------------------------------------- /src/netcore/FSharp.Editing.ProjectInspector/paket.references: -------------------------------------------------------------------------------- 1 | 2 | group netcore 3 | Microsoft.Build 4 | Microsoft.Build.Runtime 5 | 6 | Newtonsoft.Json 7 | 8 | Microsoft.CodeAnalysis.Common 9 | Microsoft.CodeAnalysis.Workspaces.Common 10 | 11 | FSharp.Core 12 | FSharp.Compiler.Service 13 | FSharp.NET.Sdk 14 | System.Runtime 15 | Microsoft.NETCore.DotNetHostPolicy 16 | Microsoft.NETCore.Runtime.CoreCLR 17 | System.Runtime.Loader 18 | NETStandard.Library -------------------------------------------------------------------------------- /src/netcore/FSharp.Editing.Server/paket.references: -------------------------------------------------------------------------------- 1 | 2 | group netcore 3 | 4 | Microsoft.CodeAnalysis.Common 5 | 6 | FSharp.Core 7 | FSharp.NET.Sdk 8 | FSharp.Compiler.Service 9 | Microsoft.NETCore.DotNetHostPolicy 10 | Microsoft.NETCore.Runtime.CoreCLR 11 | 12 | NETStandard.Library 13 | 14 | System.Runtime.InteropServices.RuntimeInformation 15 | System.Runtime.Loader 16 | 17 | Suave 18 | -------------------------------------------------------------------------------- /src/netcore/FSharp.Editing/paket.references: -------------------------------------------------------------------------------- 1 | group netcore 2 | 3 | wire 4 | Newtonsoft.Json 5 | 6 | Microsoft.Extensions.Logging.Abstractions 7 | 8 | Microsoft.CodeAnalysis.Common 9 | Microsoft.CodeAnalysis.Workspaces.Common 10 | Microsoft.CodeAnalysis.Features 11 | 12 | FSharp.Core 13 | FSharp.Compiler.Service 14 | 15 | FSharp.NET.Sdk 16 | NETStandard.Library 17 | System.Xml.XDocument 18 | 19 | System.IO.FileSystem.Watcher 20 | System.Runtime.Extensions 21 | System.Runtime.InteropServices 22 | 23 | Microsoft.Extensions.Options.ConfigurationExtensions 24 | Microsoft.Win32.Registry.AccessControl 25 | -------------------------------------------------------------------------------- /src/netcore/TestConsole/paket.references: -------------------------------------------------------------------------------- 1 | 2 | Microsoft.Build 3 | Newtonsoft.Json 4 | 5 | group netcore 6 | Microsoft.CodeAnalysis.Common 7 | Microsoft.CodeAnalysis.Workspaces.Common 8 | Microsoft.CodeAnalysis.Features 9 | 10 | FSharp.Core 11 | FSharp.NET.Sdk 12 | FSharp.Compiler.Service 13 | Microsoft.NETCore.DotNetHostPolicy 14 | Microsoft.NETCore.Runtime.CoreCLR 15 | System.Runtime.Loader 16 | NETStandard.Library -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/GoToDefinitionTests.LoadDirective.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Tests.GoToDefinition.LoadDirectiveTests 2 | 3 | open System.IO 4 | open Microsoft.FSharp.Compiler.Range 5 | open NUnit.Framework 6 | open FSharp.Editing 7 | open FSharp.Editing.UntypedAstUtils.HashDirectiveInfo 8 | open FSharp.Editing.Tests 9 | 10 | [] 11 | let dataFolderName = __SOURCE_DIRECTORY__ + "/../data/" 12 | type dataFolder = FSharp.Management.FileSystem 13 | 14 | open FSharp.Editing.ProjectSystem 15 | let workspace = new FSharpWorkspace () 16 | let languageService = LanguageService workspace 17 | 18 | 19 | let canonicalizeFilename filename = Path.GetFullPathSafe filename //(new FileInfo(filename)).FullName 20 | 21 | let getAst filename = 22 | let contents = File.ReadAllText(filename) 23 | 24 | // Get compiler options for the 'project' implied by a single script file 25 | let projOptions = 26 | languageService.GetScriptCheckerOptions(filename, filename + ".fsproj", contents, FSharpCompilerVersion.FSharp_3_1) 27 | |> Async.RunSynchronously 28 | 29 | let parseFileResults = 30 | languageService.ParseFileInProject(projOptions, filename, contents) 31 | |> Async.RunSynchronously 32 | 33 | match parseFileResults.ParseTree with 34 | | Some tree -> tree 35 | | None -> failwith "Something went wrong during parsing!" 36 | 37 | 38 | [] 39 | let ``test1.fsx: verify parsed #load directives``() = 40 | let ast = getAst dataFolder.ParseLoadDirectives.``test1.fsx`` 41 | let directives = getIncludeAndLoadDirectives ast 42 | 43 | let expectedMatches = 44 | [ 45 | Some <| FileInfo(dataFolder.ParseLoadDirectives.includes.``a.fs``).FullName 46 | Some <| FileInfo(dataFolder.ParseLoadDirectives.includes.``b.fs``).FullName 47 | Some <| FileInfo(dataFolder.ParseLoadDirectives.includes.``b.fs``).FullName 48 | ] 49 | 50 | let results = 51 | directives 52 | |> Seq.map (function 53 | | Load(ExistingFile(filename), _) -> Some ((new FileInfo(filename)).FullName) 54 | | _ -> None 55 | ) 56 | |> Seq.filter (Option.isSome) 57 | |> Seq.toList 58 | 59 | assertEqual expectedMatches results 60 | 61 | [] 62 | let ``test1.fsx: verify parsed position lookup of individual #load directives``() = 63 | let ast = getAst dataFolder.ParseLoadDirectives.``test1.fsx`` 64 | 65 | let expectations = [ 66 | (mkPos 1 1, Some dataFolder.ParseLoadDirectives.includes.``a.fs``) 67 | (mkPos 1 5, Some dataFolder.ParseLoadDirectives.includes.``a.fs``) 68 | (mkPos 2 1, Some dataFolder.ParseLoadDirectives.includes.``b.fs``) 69 | (mkPos 2 5, Some dataFolder.ParseLoadDirectives.includes.``b.fs``) 70 | (mkPos 3 1000, None) 71 | (mkPos 4 5, Some dataFolder.ParseLoadDirectives.includes.``b.fs``) 72 | ] 73 | 74 | let results = 75 | expectations 76 | |> Seq.map fst 77 | |> Seq.map (fun pos -> 78 | let result = getHashLoadDirectiveResolvedPathAtPosition pos ast 79 | match result with 80 | | None -> pos, None 81 | | Some path -> pos, Some (canonicalizeFilename path) 82 | ) 83 | |> Seq.toList 84 | 85 | assertEqual expectations results 86 | -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/IdentifierDetectionTests.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Tests.IdentifierDetectionTest 2 | 3 | open NUnit.Framework 4 | open FSharp.Editing.IdentifierUtils 5 | 6 | [] 7 | let ``should be able to detect backticked identifiers``() = 8 | isDoubleBacktickIdent "``this is already encapsulated``" |> assertTrue 9 | isDoubleBacktickIdent "``this``" |> assertTrue 10 | isDoubleBacktickIdent "``X.Y``" |> assertTrue 11 | isDoubleBacktickIdent "this" |> assertFalse 12 | isDoubleBacktickIdent "myVariable" |> assertFalse 13 | 14 | [] 15 | let ``should be able to detect unioncase identifiers``() = 16 | isUnionCaseIdent "Case1" |> assertTrue 17 | isUnionCaseIdent "``Case 1``" |> assertTrue 18 | isUnionCaseIdent "case1" |> assertFalse 19 | isUnionCaseIdent "``X.Y``" |> assertFalse 20 | isUnionCaseIdent "``Case2[x]``" |> assertFalse 21 | 22 | [] 23 | let ``should be able to detect type names``() = 24 | isTypeNameIdent "Type1" |> assertTrue 25 | isTypeNameIdent "``Type 1``" |> assertTrue 26 | isTypeNameIdent "type1" |> assertTrue 27 | isTypeNameIdent "``type 1``" |> assertTrue 28 | isTypeNameIdent "``X.Y``" |> assertFalse 29 | isTypeNameIdent "My.Foo" |> assertFalse 30 | isTypeNameIdent "``My.Foo``" |> assertFalse 31 | isTypeNameIdent "``Case2[x]``" |> assertFalse 32 | 33 | [] 34 | let ``should be able to detect fixable identifiers``() = 35 | isFixableIdentifier "Type1" |> assertTrue 36 | isFixableIdentifier "``Type 1``" |> assertTrue 37 | isFixableIdentifier "->" |> assertTrue 38 | isFixableIdentifier "x y" |> assertTrue 39 | isFixableIdentifier "``X.Y``" |> assertTrue 40 | isFixableIdentifier "My.Foo" |> assertTrue 41 | isFixableIdentifier null |> assertFalse 42 | isFixableIdentifier "" |> assertFalse 43 | -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/NavigableItemsCollectorTests.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Tests.NavigableItemsCollectorTests 2 | 3 | open NUnit.Framework 4 | open System.IO 5 | open Microsoft.FSharp.Compiler.SourceCodeServices 6 | open FSharp.Editing 7 | open FSharp.Editing.Navigation 8 | 9 | let fileName = Path.Combine (__SOURCE_DIRECTORY__, __SOURCE_FILE__) 10 | let projectFileName = Path.ChangeExtension(fileName, ".fsproj") 11 | let sourceFiles = [| fileName |] 12 | let framework = FSharpCompilerVersion.FSharp_3_1 13 | open FSharp.Editing.ProjectSystem 14 | let workspace = new FSharpWorkspace () 15 | let languageService = LanguageService workspace 16 | 17 | let opts source = 18 | let opts = 19 | languageService.GetCheckerOptions (fileName, projectFileName, source, sourceFiles, LanguageServiceTestHelper.args, [||], framework) 20 | |> Async.RunSynchronously 21 | { opts with LoadTime = System.DateTime.UtcNow } 22 | 23 | let parseSource source = 24 | async { 25 | let! res = languageService.ParseFileInProject(opts fileName, fileName, source) 26 | return res.ParseTree 27 | } 28 | |> Async.RunSynchronously 29 | 30 | let (=>) source expected = 31 | match parseSource source with 32 | | None -> failwith "Language service returned no parse tree" 33 | | Some ast -> 34 | let actual = 35 | NavigableItemsCollector.collect fileName ast 36 | |> Seq.map (fun x -> x.Name, x.Kind, x.Range.Start.Row, x.Range.Start.Col, x.Range.End.Row, x.Range.End.Col) 37 | |> Seq.toList 38 | 39 | try 40 | actual |> Collection.assertEquiv expected 41 | with _ -> 42 | debug "AST: %A" ast 43 | debug "Actual: %A" actual 44 | reraise() 45 | 46 | type Kind = NavigableItemKind 47 | 48 | [] 49 | let ``can collect navigable items of different kinds in a file``() = 50 | """ 51 | module Module1 52 | 53 | module Module2 = 54 | let foo = 1 55 | let bar x = x 56 | type Type1 = Type1 of int 57 | """ 58 | => [ "Module1", Kind.Module, 1, 7, 1, 14 59 | "Module2", Kind.Module, 3, 7, 3, 14 60 | "foo", Kind.ModuleValue, 4, 8, 4, 11 61 | "bar", Kind.ModuleValue, 5, 8, 5, 11 62 | "Type1", Kind.Type, 6, 9, 6, 14 63 | "Type1", Kind.UnionCase, 6, 17, 6, 22 ] -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/NavigateToIndexTests.fs: -------------------------------------------------------------------------------- 1 | #if INTERACTIVE 2 | #r "../../bin/FSharp.Compiler.Service.dll" 3 | #r "../../bin/FSharpVSPowerTools.Core.dll" 4 | #r "../../packages/NUnit/lib/nunit.framework.dll" 5 | #load "TestHelpers.fs" 6 | #else 7 | module FSharp.Editing.Tests.NavigateToIndexTests 8 | #endif 9 | 10 | open NUnit.Framework 11 | open FSharp.Editing 12 | open FSharp.Editing.Navigation 13 | 14 | [] 15 | let ``Index should return all matching entries``() = 16 | let b = Index.Builder() 17 | let item filePath name = 18 | { FilePath = filePath 19 | Name = name 20 | Range = { Start = { Row = 1; Col = 1 }; End = { Row = 1; Col = 1 }} 21 | IsSignature = false 22 | Kind = NavigableItemKind.Type } 23 | let items = 24 | [ item "a.fs" "foo" 25 | item "b.fs" "Symb" 26 | item "c.fs" "SymbolOf" 27 | item "d.fs" "Symbol" 28 | item "e.fs" "Symbol" 29 | item "f.fs" "Symbol" 30 | item "g.fs" "GetSymbol" 31 | item "h.fs" "bar" ] 32 | 33 | b.Add(items) 34 | let index = b.BuildIndex() 35 | let results = ResizeArray() 36 | index.Find("symbol", results.Add) 37 | assertTrue (results.Count = 5) 38 | results 39 | |> Seq.distinctBy (fun (r, _, _, _) -> r.FilePath) 40 | |> Seq.length 41 | |> (assertTrue << ((=)5)) 42 | -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/RenameTests.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Editing.Tests.RenameTests 2 | 3 | open NUnit.Framework 4 | open FSharp.Editing.IdentifierUtils 5 | open FSharp.Editing 6 | 7 | let shouldStaysAsIs symbolKind name = encapsulateIdentifier symbolKind name |> assertEqual name 8 | let shouldBeEncapsulated symbolKind name = encapsulateIdentifier symbolKind name |> assertEqual ("``" + name + "``") 9 | 10 | [] 11 | let ``should not encapsulate normal identifiers``() = 12 | shouldStaysAsIs SymbolKind.Ident "abc" 13 | shouldStaysAsIs SymbolKind.Ident "abc1234" 14 | shouldStaysAsIs SymbolKind.Ident "a_4" 15 | 16 | [] 17 | let ``should encapsulate keywords``() = 18 | shouldBeEncapsulated SymbolKind.Ident "namespace" 19 | shouldBeEncapsulated SymbolKind.Ident "module" 20 | shouldBeEncapsulated SymbolKind.Ident "let" 21 | 22 | [] 23 | let ``should encapsulate special chars``() = 24 | shouldBeEncapsulated SymbolKind.Ident "this is a valid identifierer" 25 | shouldBeEncapsulated SymbolKind.Ident "look!" // reserved for future F# 26 | 27 | [] 28 | let ``should not encapsulate already encapsulated identifiers``() = 29 | shouldStaysAsIs SymbolKind.Ident "``this is already encapsulated``" 30 | shouldStaysAsIs SymbolKind.Ident "``this``" 31 | 32 | [] 33 | let ``should not encapsulate operators``() = 34 | shouldStaysAsIs SymbolKind.Operator "" 35 | shouldStaysAsIs SymbolKind.Operator "*" 36 | 37 | [] 38 | let ``should not encapsulate generic type parameters``() = 39 | shouldStaysAsIs SymbolKind.GenericTypeParameter "'a" 40 | 41 | [] 42 | let ``should not encapsulate statically resolved type parameters``() = 43 | shouldStaysAsIs SymbolKind.StaticallyResolvedTypeParameter "'a" -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/XmlDocTests.fs: -------------------------------------------------------------------------------- 1 | #if INTERACTIVE 2 | #r "../../bin/FSharp.Compiler.Service.dll" 3 | #load "../../src/FSharpVSPowerTools.Core/XmlDocParser.fs" 4 | #r "../../packages/NUnit/lib/nunit.framework.dll" 5 | #load "TestHelpers.fs" 6 | #else 7 | module FSharp.Editing.Tests.XmlDocTests 8 | #endif 9 | 10 | open System.IO 11 | open NUnit.Framework 12 | open TestHelpers.LanguageServiceTestHelper 13 | open FSharp.Editing 14 | open FSharp.Editing.Documentation 15 | 16 | [] 17 | let dataFolderName = __SOURCE_DIRECTORY__ + "/../data/" 18 | type dataFolder = FSharp.Management.FileSystem 19 | 20 | let fileName = dataFolder.``XmlDocSampleFile.fs`` 21 | let input = File.ReadAllText(fileName) 22 | open FSharp.Editing.ProjectSystem 23 | let workspace = new FSharpWorkspace () 24 | let languageService = LanguageService workspace 25 | let output = 26 | lazy 27 | async { 28 | let! parseResults = languageService.ParseFileInProject (projectOptions fileName, fileName, input) 29 | return! XmlDocParser.getXmlDocables (input, parseResults.ParseTree) 30 | } 31 | |> Async.RunSynchronously |> Set.ofList 32 | 33 | [] 34 | let ``should create XML Doc for module-level let bounds``() = 35 | Set.contains (XmlDocable(3, 0, [])) output.Value |> assertEqual true 36 | Set.contains (XmlDocable(5, 0, ["x"; "y"])) output.Value |> assertEqual true 37 | Set.contains (XmlDocable(7, 0, ["x"; "y"])) output.Value |> assertEqual true 38 | Set.contains (XmlDocable(77, 0, ["x"])) output.Value |> assertEqual true 39 | 40 | [] 41 | let ``should not create XML Doc for module-level let bounds which already have non-empty XML Docs``() = 42 | Set.contains (XmlDocable(79, 0, ["x"])) output.Value |> assertEqual false 43 | Set.contains (XmlDocable(82, 0, ["x"])) output.Value |> assertEqual false 44 | 45 | [] 46 | let ``should create XML Doc for type names``() = 47 | Set.contains (XmlDocable(18, 0, [])) output.Value |> assertEqual true 48 | Set.contains (XmlDocable(42, 0, [])) output.Value |> assertEqual true 49 | Set.contains (XmlDocable(45, 0, [])) output.Value |> assertEqual true 50 | Set.contains (XmlDocable(86, 0, [])) output.Value |> assertEqual true 51 | 52 | [] 53 | let ``should not create XML Doc for types which already have non-empty XML Docs``() = 54 | Set.contains (XmlDocable(89, 0, [])) output.Value |> assertEqual false 55 | 56 | [] 57 | let ``should create XML Doc for members``() = 58 | Set.contains (XmlDocable(24, 4, ["z"; "x"; "y"])) output.Value |> assertEqual true 59 | Set.contains (XmlDocable(27, 4, [])) output.Value |> assertEqual true 60 | Set.contains (XmlDocable(33, 4, ["x"; "y"])) output.Value |> assertEqual true 61 | Set.contains (XmlDocable(91, 4, [])) output.Value |> assertEqual true 62 | 63 | [] 64 | let ``should create XML Doc for let bindings of anonymous functions``() = 65 | Set.contains (XmlDocable(97, 0, [ "x"; "y"])) output.Value |> assertEqual true 66 | 67 | [] 68 | let ``should not create XML Doc for members which already have non-empty XML Docs``() = 69 | Set.contains (XmlDocable(93, 4, [])) output.Value |> assertEqual false 70 | 71 | [] 72 | [] 73 | [] 74 | [] 75 | [] 76 | let ``detects blank XML doc comment``(sample, pos) = 77 | XmlDocComment.isBlank sample |> assertEqual (Some pos) 78 | 79 | [] 80 | [] 81 | [] 82 | [] 83 | [] 84 | [] 85 | [] 86 | let ``detects not blank XML doc comment``(sample) = 87 | XmlDocComment.isBlank sample |> assertEqual None 88 | 89 | #if INTERACTIVE 90 | Seq.iter (printfn "%A") output;; 91 | ``should create XML Doc for module-level let bounds``();; 92 | ``should create XML Doc for type names``();; 93 | ``should create XML Doc for members``();; 94 | #endif 95 | -------------------------------------------------------------------------------- /tests/FSharp.Editing.Tests/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Core 2 | FSharp.Compiler.Service 3 | Microsoft.CodeAnalysis.Common 4 | Microsoft.CodeAnalysis.Workspaces.Common 5 | Microsoft.CodeAnalysis.Features 6 | 7 | FSharp.Management 8 | FSharp.Data 9 | 10 | 11 | group Test 12 | FsCheck 13 | NUnit 14 | -------------------------------------------------------------------------------- /tests/data/FSharpSignature/FSharpSignature.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 2.0 8 | d313e95d-f32a-41f1-9c93-a217caed2f31 9 | Exe 10 | FSharpSignature 11 | FSharpSignature 12 | v4.5 13 | 4.3.1.0 14 | FSharpSignature 15 | 16 | 17 | true 18 | full 19 | false 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | 3 24 | bin\Debug\FSharpSignature.XML 25 | 26 | 27 | pdbonly 28 | true 29 | true 30 | bin\Release\ 31 | TRACE 32 | 3 33 | bin\Release\FSharpSignature.XML 34 | 35 | 36 | 37 | 38 | True 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 11 51 | 52 | 53 | 54 | 55 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets 56 | 57 | 58 | 59 | 60 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets 61 | 62 | 63 | 64 | 65 | 72 | 73 | -------------------------------------------------------------------------------- /tests/data/FSharpSignature/Program.fs: -------------------------------------------------------------------------------- 1 | module Program 2 | 3 | [] 4 | let main argv = 5 | Sample.func 10 -------------------------------------------------------------------------------- /tests/data/FSharpSignature/Sample.fs: -------------------------------------------------------------------------------- 1 | module Sample 2 | 3 | let func (x: int) = x + 1 -------------------------------------------------------------------------------- /tests/data/FSharpSignature/Sample.fsi: -------------------------------------------------------------------------------- 1 |  2 | module Sample 3 | 4 | val func : int -> int -------------------------------------------------------------------------------- /tests/data/FSharpSignature/paket.references: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/FSharpSignature/paket.references -------------------------------------------------------------------------------- /tests/data/MultiProjects/MultiProjects.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{45BAD6CB-7EFD-47B0-83EB-D8CEEA3D7197}" 7 | ProjectSection(SolutionItems) = preProject 8 | ..\..\..\paket.dependencies = ..\..\..\paket.dependencies 9 | EndProjectSection 10 | EndProject 11 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Project1", "Project1\Project1.fsproj", "{77AA2E69-FDE6-4163-879F-AA370A036E0E}" 12 | EndProject 13 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Project2", "Project2\Project2.fsproj", "{FBEA1597-C9BF-43AF-9A41-E540FF0ED70E}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {77AA2E69-FDE6-4163-879F-AA370A036E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {77AA2E69-FDE6-4163-879F-AA370A036E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {77AA2E69-FDE6-4163-879F-AA370A036E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {77AA2E69-FDE6-4163-879F-AA370A036E0E}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {FBEA1597-C9BF-43AF-9A41-E540FF0ED70E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {FBEA1597-C9BF-43AF-9A41-E540FF0ED70E}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {FBEA1597-C9BF-43AF-9A41-E540FF0ED70E}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {FBEA1597-C9BF-43AF-9A41-E540FF0ED70E}.Release|Any CPU.Build.0 = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project1.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/MultiProjects/Project1.dll.mdb -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project1/Project1.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 2.0 8 | 77aa2e69-fde6-4163-879f-aa370a036e0e 9 | Library 10 | Project1 11 | Project1 12 | v4.5 13 | 4.3.1.0 14 | Project1 15 | 16 | 17 | true 18 | full 19 | false 20 | false 21 | ..\ 22 | DEBUG;TRACE 23 | 3 24 | bin\Debug\Project1.XML 25 | 26 | 27 | pdbonly 28 | true 29 | true 30 | ..\ 31 | TRACE 32 | 3 33 | bin\Release\Project1.XML 34 | 35 | 36 | 37 | 38 | True 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 11 49 | 50 | 51 | 52 | 53 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets 54 | 55 | 56 | 57 | 58 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets 59 | 60 | 61 | 62 | 63 | 70 | 71 | -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project1/Project11.fs: -------------------------------------------------------------------------------- 1 | namespace Project1 2 | 3 | type Class11() = 4 | static member X = "F#" 5 | -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project1/paket.references: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/MultiProjects/Project1/paket.references -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project2.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/MultiProjects/Project2.dll.mdb -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project2/Project2.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 2.0 8 | fbea1597-c9bf-43af-9a41-e540ff0ed70e 9 | Library 10 | Project2 11 | Project2 12 | v4.5 13 | 4.3.1.0 14 | Project2 15 | 16 | 17 | true 18 | full 19 | false 20 | false 21 | .. 22 | DEBUG;TRACE 23 | 3 24 | bin\Debug\Project2.XML 25 | 26 | 27 | pdbonly 28 | true 29 | true 30 | .. 31 | TRACE 32 | 3 33 | bin\Release\Project2.XML 34 | 35 | 36 | 37 | 38 | True 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Project1 50 | {77aa2e69-fde6-4163-879f-aa370a036e0e} 51 | True 52 | 53 | 54 | 55 | 11 56 | 57 | 58 | 59 | 60 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets 61 | 62 | 63 | 64 | 65 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets 66 | 67 | 68 | 69 | 70 | 77 | 78 | -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project2/Project21.fs: -------------------------------------------------------------------------------- 1 | 2 | namespace Project2 3 | 4 | module Test = 5 | let _ = Project1.Class11() 6 | let _ = Project1.Class11.X 7 | -------------------------------------------------------------------------------- /tests/data/MultiProjects/Project2/paket.references: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/MultiProjects/Project2/paket.references -------------------------------------------------------------------------------- /tests/data/NavigateToSource/FAKETests.fs: -------------------------------------------------------------------------------- 1 | module FAKETests 2 | open Fake 3 | Target "Main" DoNothing 4 | RunTargetOrDefault "Main" -------------------------------------------------------------------------------- /tests/data/NavigateToSource/NavigateToSource.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{D23367E1-1217-4940-A9E5-4AF5FEC4C1B3}" 7 | ProjectSection(SolutionItems) = preProject 8 | ..\..\..\paket.dependencies = ..\..\..\paket.dependencies 9 | EndProjectSection 10 | EndProject 11 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "NavigateToSource", "NavigateToSource.fsproj", "{82ADC5F9-6BB1-4007-B4D3-42A045D0F22F}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {82ADC5F9-6BB1-4007-B4D3-42A045D0F22F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {82ADC5F9-6BB1-4007-B4D3-42A045D0F22F}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {82ADC5F9-6BB1-4007-B4D3-42A045D0F22F}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {82ADC5F9-6BB1-4007-B4D3-42A045D0F22F}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /tests/data/NavigateToSource/OctokitTests.fs: -------------------------------------------------------------------------------- 1 | module OctokitTests 2 | 3 | // https://github.com/octokit/octokit.net/ 4 | let dt = Octokit.Helpers.UnixTimestampExtensions.FromUnixTime 1425868070L 5 | let github = Octokit.GitHubClient(Octokit.ProductHeaderValue "MyAmazingApp") 6 | let a = github.Activity.Events.GetAll() 7 | () 8 | -------------------------------------------------------------------------------- /tests/data/NavigateToSource/paket.references: -------------------------------------------------------------------------------- 1 | group Build 2 | Octokit 3 | FAKE -------------------------------------------------------------------------------- /tests/data/ParseLoadDirectives/includes/a.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/ParseLoadDirectives/includes/a.fs -------------------------------------------------------------------------------- /tests/data/ParseLoadDirectives/includes/b.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsharp-editing/FSharp.Editing/d0324e7aafbf64a39d77d77296c4959ec0fdef8b/tests/data/ParseLoadDirectives/includes/b.fs -------------------------------------------------------------------------------- /tests/data/ParseLoadDirectives/test1.fsx: -------------------------------------------------------------------------------- 1 | #load @"./includes/a.fs" 2 | #load @"./includes/b.fs" 3 | #I "includes/" 4 | #load "b.fs" -------------------------------------------------------------------------------- /tests/data/TypeProviderTests/DesignTimeURIs/0CdPVqScGxbsHluW0KvuHpKSPow%3D.txt: -------------------------------------------------------------------------------- 1 | empty -------------------------------------------------------------------------------- /tests/data/TypeProviderTests/FreebaseSchema/0CdPVqScGxbsHluW0KvuHpKSPow%3D.txt: -------------------------------------------------------------------------------- 1 | empty -------------------------------------------------------------------------------- /tests/data/TypeProviderTests/TypeProviderTests.fs: -------------------------------------------------------------------------------- 1 | module TypeProviderTests 2 | open FSharp.Data 3 | type Project = XmlProvider<"13"> 4 | let _ = Project.GetSample() 5 | -------------------------------------------------------------------------------- /tests/data/TypeProviderTests/TypeProviderTests.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{DAC23AF7-E86E-4129-BF47-5D2C21A9C917}" 7 | ProjectSection(SolutionItems) = preProject 8 | ..\..\..\paket.dependencies = ..\..\..\paket.dependencies 9 | EndProjectSection 10 | EndProject 11 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "TypeProviderTests", "TypeProviderTests.fsproj", "{E630D8EE-A47C-4F64-8BA1-CA41A36A0973}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {E630D8EE-A47C-4F64-8BA1-CA41A36A0973}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {E630D8EE-A47C-4F64-8BA1-CA41A36A0973}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {E630D8EE-A47C-4F64-8BA1-CA41A36A0973}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {E630D8EE-A47C-4F64-8BA1-CA41A36A0973}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /tests/data/TypeProviderTests/WorldBankSchema/0CdPVqScGxbsHluW0KvuHpKSPow%3D.txt: -------------------------------------------------------------------------------- 1 | empty -------------------------------------------------------------------------------- /tests/data/TypeProviderTests/paket.references: -------------------------------------------------------------------------------- 1 | 2 | FSharp.Data -------------------------------------------------------------------------------- /tests/data/XmlDocSampleFile.fs: -------------------------------------------------------------------------------- 1 | module SampleFile 2 | 3 | let noIsAValue = 42 4 | 5 | let YesIsACurriedMethod x y = () 6 | 7 | [] 8 | let YesIsATupledMethod(x, y) = () 9 | 10 | type MyType1() = 11 | member this.Whatever() = () 12 | and MyType2() = 13 | member this.Whatever() = () 14 | and 15 | MyType3() = 16 | member this.Whatever() = () 17 | 18 | [] 19 | type TestXmlDoc() = 20 | let nope() = () 21 | 22 | member this.YesNoArgs() = () 23 | 24 | [] 25 | member this.YesThreeArgs(z,x:int,y:string) = () 26 | 27 | member this.NopeIsAProperty = 42 // does, no args 28 | 29 | member this.NopeIsAPropertyGetterSetter 30 | with get() = 42 // does 31 | and set(x) = () // does 32 | 33 | static member YesIsStatic(x,y) = () 34 | 35 | [] 36 | abstract member YesIsAbstract : x:int * y:string -> unit 37 | 38 | abstract member YesIsAbstractNoNames : int * string -> unit 39 | 40 | override this.ToString() = "" 41 | 42 | type IMyInterface = 43 | abstract member YesIsAbstract : x:int * y:string -> unit 44 | 45 | type MyRecord = { xx:int; yy:string } with 46 | member this.Blah(z:string) = () 47 | member this.Prop = () 48 | 49 | type MyUnion = 50 | | This of int 51 | | That of string * int with 52 | member this.Blah(xx:int) = () 53 | member this.Prop = () 54 | 55 | module LocalModule = 56 | 57 | let noIsAValue = 42 58 | 59 | let YesIsACurriedMethod x y = () 60 | 61 | let YesIsATupledMethod(x, y) = () 62 | 63 | type TestXmlDoc() = 64 | let nope() = () 65 | 66 | member this.YesNoArgs() = () 67 | 68 | member this.YesThreeArgs(z,x:int,y:string) = () 69 | 70 | member this.NopeIsAProperty = 42 71 | 72 | member this.NopeIsAPropertyGetterSetter 73 | with get() = 42 74 | and set(x) = () 75 | 76 | /// 77 | let functionWithEmptyXmlDocComment x = () 78 | 79 | /// < 80 | let functionWithOpenSquareBracketOnlyXmlDocComment x = () 81 | 82 | /// function 83 | let functionWithNormalXmlDocComment x = () 84 | 85 | /// 86 | type TypeWithEmptyXmlDocComment = class end 87 | 88 | /// type 89 | type TypeWithXmlDocComment() = 90 | /// 91 | member x.X = () 92 | /// member 93 | member x.Y = () 94 | 95 | let f = 0 96 | 97 | let func : int -> int -> int list = 98 | fun x y -> 99 | List.append [x] [y] -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/adds-necessary-parenthesis-to-function-parameters/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Control 2 | 3 | open System 4 | 5 | /// This static class holds members for creating and manipulating asynchronous computations. 6 | [] 7 | [] 8 | [] 9 | type Async = 10 | /// Creates three functions that can be used to implement the .NET Asynchronous 11 | /// Programming Model (APM) for a given asynchronous computation. 12 | static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) 13 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/adds-necessary-parenthesis-to-function-parameters/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | let _ = Async.AwaitTask -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/adds-necessary-parenthesis-to-function-parameters/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 8}, "assertType" : "firstLinesEq", "firstLineCount": 10 } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/adds-necessary-parenthesis-to-tuple-parameters/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type T = 4 | new : unit -> T 5 | member Test : x:(int * int) * y:int -> int 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/adds-necessary-parenthesis-to-tuple-parameters/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type T() = 3 | member this.Test(x: int * int, y: int): int = 3 4 | 5 | let x = new T() -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/adds-necessary-parenthesis-to-tuple-parameters/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 5, "col": 16}, "assertType" : "eq"} -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type ``My class`` = 4 | new : unit -> ``My class`` 5 | member ``a method`` : unit -> unit 6 | member ``a property`` : int 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-1/input.fs: -------------------------------------------------------------------------------- 1 | type ``My class``() = 2 | member __.``a property`` = 0 3 | member __.``a method``() = () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-2/expected.fs: -------------------------------------------------------------------------------- 1 | module ``My module`` 2 | 3 | val ``a value`` : int 4 | val f : ``a param``:int -> int 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-2/input.fs: -------------------------------------------------------------------------------- 1 | module ``My module`` 2 | 3 | let ``a value`` = 0 4 | let f (``a param``: int) = ``a param`` * 2 -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 9}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-3/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type ``My abbrev`` = int 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-3/input.fs: -------------------------------------------------------------------------------- 1 | type ``My abbrev`` = int -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-3/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-4/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type Union = 4 | | ``My Case`` of int 5 | | Case2 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-4/input.fs: -------------------------------------------------------------------------------- 1 | type Union = ``My Case`` of int | Case2 -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-4/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-5/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type Record = 4 | { 5 | ``My Record``: string 6 | } 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-5/input.fs: -------------------------------------------------------------------------------- 1 | type Record = { ``My Record`` : string } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-5/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-6/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | exception ``My exception`` 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-6/input.fs: -------------------------------------------------------------------------------- 1 | exception ``My exception`` -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-6/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 12}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-7/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | exception ``My exception 2`` of int 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-7/input.fs: -------------------------------------------------------------------------------- 1 | exception ``My exception 2`` of int -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-7/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 12}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-8/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type ``My delegate`` = 4 | delegate of int -> int 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-8/input.fs: -------------------------------------------------------------------------------- 1 | type ``My delegate``= delegate of int -> int -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/double-backtick-identifiers-are-supported-8/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-abstract-class-definition-with-default-members/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | [] 4 | type MyAbstractClass = 5 | abstract member Method : int -> unit 6 | override Method : x:int -> unit 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-abstract-class-definition-with-default-members/input.fs: -------------------------------------------------------------------------------- 1 | 2 | [] 3 | type MyAbstractClass = 4 | abstract member Method: int -> unit 5 | default this.Method(x) = () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-abstract-class-definition-with-default-members/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-class-definition-with-events/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type Class = 4 | new : unit -> Class 5 | member add_MyEvent : Handler -> unit 6 | [] 7 | member MyEvent : IEvent 8 | member remove_MyEvent : Handler -> unit 9 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-class-definition-with-events/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type Class() = 3 | let event = Event() 4 | [] 5 | member this.MyEvent = event.Publish -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-class-definition-with-events/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-constructor-less-struct-metadata/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System 2 | 3 | /// Represents a Boolean value. 4 | [] 5 | [] 6 | type Boolean = 7 | interface System.IConvertible 8 | /// Compares this instance to a specified object and returns an integer that indicates their relationship to one another. 9 | member CompareTo : obj:obj -> int 10 | /// Compares this instance to a specified object and returns an integer that indicates their relationship to one another. 11 | member CompareTo : value:bool -> int 12 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-constructor-less-struct-metadata/input.fs: -------------------------------------------------------------------------------- 1 | let x: System.Boolean = false -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-constructor-less-struct-metadata/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 14}, "assertType" : "firstLinesEq", "firstLineCount": 11, "ignoreOnUnix" : true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-class-metadata/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass = 4 | class 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-class-metadata/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass = class end 3 | 4 | let x: MyClass = Unchecked.defaultof<_> -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-class-metadata/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 4, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-interface-metadata/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyInterface = 4 | interface 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-interface-metadata/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyInterface = interface end 3 | 4 | let x: MyInterface = () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-interface-metadata/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 4, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-struct-metadata/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyStruct = 4 | struct 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-struct-metadata/input.fs: -------------------------------------------------------------------------------- 1 | 2 | [] 3 | type MyStruct = struct end 4 | 5 | let x = new MyStruct() -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-empty-struct-metadata/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 5, "col": 12}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-enum-type-definition/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type Enum = 4 | | A = 0 5 | | B = 1 6 | | C = 2 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-enum-type-definition/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type Enum = 3 | | A = 0 4 | | B = 1 5 | | C = 2 6 | 7 | let x = Enum.A -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-enum-type-definition/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 7, "col": 8}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-exception-definition-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | exception MyEmptyException 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-exception-definition-1/input.fs: -------------------------------------------------------------------------------- 1 | exception MyEmptyException -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-exception-definition-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 10}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-exception-definition-2/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | exception MyException of int * (int * string) * (int -> unit) 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-exception-definition-2/input.fs: -------------------------------------------------------------------------------- 1 | exception MyException of int * (int * string) * (int -> unit) -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-exception-definition-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 10}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-list-'t-definition/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Collections 2 | 3 | /// The type of immutable singly-linked lists. 4 | [] 5 | [] 6 | [] 7 | [] 8 | type List<'T> = 9 | | ( [] ) 10 | | ( :: ) of Head: 'T * Tail: 'T list 11 | interface System.Collections.IEnumerable 12 | interface System.Collections.Generic.IEnumerable<'T> 13 | /// Gets a slice of the list, the elements of the list from the given start index to the given end index. 14 | member GetSlice : startIndex:int option * endIndex:int option -> 'T list 15 | /// Gets the first element of the list 16 | member Head : 'T 17 | /// Gets a value indicating if the list contains no entries 18 | member IsEmpty : bool 19 | /// Gets the element of the list at the given position. 20 | member Item : 'T 21 | /// Gets the number of items contained in the list 22 | member Length : int 23 | /// Gets the tail of the list, which is a list containing all the elements of the list, excluding the first element 24 | member Tail : 'T list 25 | /// Returns a list with head as its first element and tail as its subsequent elements 26 | static member Cons : head:'T * tail:'T list -> 'T list 27 | /// Returns an empty list of a particular type 28 | static member Empty : 'T list 29 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-list-'t-definition/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | let x: List = [] -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-f#-list-'t-definition/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-interface-definition/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | [] 4 | type MyInterface = 5 | abstract member Method : int -> unit 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-interface-definition/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyInterface = 3 | abstract Method: int -> unit 4 | 5 | let f (x:MyInterface) = () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-interface-definition/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 5, "col": 9}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-metadata-from-module-and-module-function-1/expected.fs: -------------------------------------------------------------------------------- 1 | /// Basic operations on options. 2 | [ (4))>] 3 | module Microsoft.FSharp.Core.Option 4 | 5 | /// Returns true if the option is not None. 6 | val isSome : option:'T option -> bool 7 | /// Returns true if the option is None. 8 | val isNone : option:'T option -> bool 9 | /// Gets the value associated with the option. 10 | val get : option:'T option -> 'T 11 | /// count inp evaluates to match inp with None -> 0 | Some _ -> 1. 12 | val count : option:'T option -> int 13 | /// fold f s inp evaluates to match inp with None -> s | Some x -> f s x. 14 | val fold : folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State 15 | /// fold f inp s evaluates to match inp with None -> s | Some x -> f x s. 16 | val foldBack : folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State 17 | /// exists p inp evaluates to match inp with None -> false | Some x -> p x. 18 | val exists : predicate:('T -> bool) -> option:'T option -> bool 19 | /// forall p inp evaluates to match inp with None -> true | Some x -> p x. 20 | val forall : predicate:('T -> bool) -> option:'T option -> bool 21 | /// iter f inp executes match inp with None -> () | Some x -> f x. 22 | val iter : action:('T -> unit) -> option:'T option -> unit 23 | /// map f inp evaluates to match inp with None -> None | Some x -> Some (f x). 24 | val map : mapping:('T -> 'U) -> option:'T option -> 'U option 25 | /// bind f inp evaluates to match inp with None -> None | Some x -> f x 26 | val bind : binder:('T -> 'U option) -> option:'T option -> 'U option 27 | /// filter f inp evaluates to match inp with None -> None | Some x -> if f x then Some x else None. 28 | val filter : predicate:('T -> bool) -> option:'T option -> 'T option 29 | /// Convert the option to an array of length 0 or 1. 30 | val toArray : option:'T option -> 'T [] 31 | /// Convert the option to a list of length 0 or 1. 32 | val toList : option:'T option -> 'T list 33 | /// Convert the option to a Nullable value. 34 | val toNullable : option:'T option -> System.Nullable<'T> when 'T : (new : unit -> 'T) and 'T : struct and 'T :> System.ValueType 35 | /// Convert a Nullable value to an option. 36 | val ofNullable : value:System.Nullable<'T> -> 'T option when 'T : (new : unit -> 'T) and 'T : struct and 'T :> System.ValueType 37 | /// Convert a potentially null value to an option. 38 | val ofObj : value:'T -> 'T option when 'T : null 39 | /// Convert an option to a potentially null value. 40 | val toObj : value:'T option -> 'T when 'T : null 41 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-metadata-from-module-and-module-function-1/input.fs: -------------------------------------------------------------------------------- 1 | 2 | 3 | let f x = Option.map(x) -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-metadata-from-module-and-module-function-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 17}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-metadata-from-module-and-module-function-2/expected.fs: -------------------------------------------------------------------------------- 1 | /// Basic operations on options. 2 | [ (4))>] 3 | module Microsoft.FSharp.Core.Option 4 | 5 | /// Returns true if the option is not None. 6 | val isSome : option:'T option -> bool 7 | /// Returns true if the option is None. 8 | val isNone : option:'T option -> bool 9 | /// Gets the value associated with the option. 10 | val get : option:'T option -> 'T 11 | /// count inp evaluates to match inp with None -> 0 | Some _ -> 1. 12 | val count : option:'T option -> int 13 | /// fold f s inp evaluates to match inp with None -> s | Some x -> f s x. 14 | val fold : folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State 15 | /// fold f inp s evaluates to match inp with None -> s | Some x -> f x s. 16 | val foldBack : folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State 17 | /// exists p inp evaluates to match inp with None -> false | Some x -> p x. 18 | val exists : predicate:('T -> bool) -> option:'T option -> bool 19 | /// forall p inp evaluates to match inp with None -> true | Some x -> p x. 20 | val forall : predicate:('T -> bool) -> option:'T option -> bool 21 | /// iter f inp executes match inp with None -> () | Some x -> f x. 22 | val iter : action:('T -> unit) -> option:'T option -> unit 23 | /// map f inp evaluates to match inp with None -> None | Some x -> Some (f x). 24 | val map : mapping:('T -> 'U) -> option:'T option -> 'U option 25 | /// bind f inp evaluates to match inp with None -> None | Some x -> f x 26 | val bind : binder:('T -> 'U option) -> option:'T option -> 'U option 27 | /// filter f inp evaluates to match inp with None -> None | Some x -> if f x then Some x else None. 28 | val filter : predicate:('T -> bool) -> option:'T option -> 'T option 29 | /// Convert the option to an array of length 0 or 1. 30 | val toArray : option:'T option -> 'T [] 31 | /// Convert the option to a list of length 0 or 1. 32 | val toList : option:'T option -> 'T list 33 | /// Convert the option to a Nullable value. 34 | val toNullable : option:'T option -> System.Nullable<'T> when 'T : (new : unit -> 'T) and 'T : struct and 'T :> System.ValueType 35 | /// Convert a Nullable value to an option. 36 | val ofNullable : value:System.Nullable<'T> -> 'T option when 'T : (new : unit -> 'T) and 'T : struct and 'T :> System.ValueType 37 | /// Convert a potentially null value to an option. 38 | val ofObj : value:'T -> 'T option when 'T : null 39 | /// Convert an option to a potentially null value. 40 | val toObj : value:'T option -> 'T when 'T : null 41 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-metadata-from-module-and-module-function-2/input.fs: -------------------------------------------------------------------------------- 1 | 2 | 3 | let f x = Option.map(x) -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-metadata-from-module-and-module-function-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 10}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-method-definition-generate-enclosing-type-metadata-and-supports-c#-events/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System 2 | 3 | open System 4 | 5 | /// Represents the standard input, output, and error streams for console applications. This class cannot be inherited. 6 | [] 7 | type Console = 8 | [] 9 | static member add_CancelKeyPress : value:ConsoleCancelEventHandler -> unit 10 | /// Gets or sets the background color of the console. 11 | static member BackgroundColor : ConsoleColor with get, set 12 | /// Plays the sound of a beep through the console speaker. 13 | static member Beep : unit -> unit 14 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-method-definition-generate-enclosing-type-metadata-and-supports-c#-events/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | do Console.WriteLine("xxx") -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-method-definition-generate-enclosing-type-metadata-and-supports-c#-events/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 11}, "assertType" : "firstLinesEq", "firstLineCount": 11, "ignoreOnUnix": true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-non-abstract-class-definition-with-virtual-member/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyBaseClass = 4 | new : unit -> MyBaseClass 5 | abstract member Method : int -> unit 6 | override Method : x:int -> unit 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-non-abstract-class-definition-with-virtual-member/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyBaseClass() = 3 | abstract member Method: int -> unit 4 | default this.Method(x) = () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-non-abstract-class-definition-with-virtual-member/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-partial-active-patterns/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | val (|DivisibleBy|_|) : by:int -> n:int -> unit option 4 | val fizzBuzz : _arg1:int -> string 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-partial-active-patterns/input.fs: -------------------------------------------------------------------------------- 1 | 2 | let (|DivisibleBy|_|) by n = 3 | if n % by = 0 then Some DivisibleBy else None 4 | 5 | let fizzBuzz = function 6 | | DivisibleBy 3 & DivisibleBy 5 -> "FizzBuzz" 7 | | DivisibleBy 3 -> "Fizz" 8 | | DivisibleBy 5 -> "Buzz" 9 | | _ -> "" -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-partial-active-patterns/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 6, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-property-definition-generate-enclosing-type-metadata/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System 2 | 3 | /// Represents a 2-tuple, or pair. 4 | type Tuple<'T1, 'T2> = 5 | /// Initializes a new instance of the class. 6 | new : item1:'T1 * item2:'T2 -> Tuple<'T1, 'T2> 7 | /// Returns a value that indicates whether the current object is equal to a specified object. 8 | member Equals : obj:obj -> bool 9 | /// Returns the hash code for the current object. 10 | member GetHashCode : unit -> int 11 | /// Gets the value of the current object's first component. 12 | member Item1 : 'T1 13 | /// Gets the value of the current object's second component. 14 | member Item2 : 'T2 15 | /// Returns a string that represents the value of this instance. 16 | member ToString : unit -> string 17 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-property-definition-generate-enclosing-type-metadata/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | let t = Tuple(0, 0) 4 | let u = t.Item1 -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-property-definition-generate-enclosing-type-metadata/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 4, "col": 10}, "assertType" : "eq", "ignoreOnUnix" : true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-record-type-definition/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | [] 4 | [] 5 | type MyRecord = 6 | { 7 | Field1: int 8 | Field2: string -> unit 9 | } 10 | interface System.ICloneable 11 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-record-type-definition/input.fs: -------------------------------------------------------------------------------- 1 | 2 | [] 3 | [] 4 | type MyRecord = 5 | { 6 | Field1: int 7 | Field2: string -> unit 8 | } 9 | interface System.ICloneable with 10 | member x.Clone(): obj = null 11 | 12 | let r: MyRecord = Unchecked.defaultof<_> -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-record-type-definition/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 12, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-struct-metadata/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | [] 4 | type MyStruct = 5 | new : x:int * y:string -> MyStruct 6 | val Field1 : int 7 | val Field2 : string 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-struct-metadata/input.fs: -------------------------------------------------------------------------------- 1 | 2 | [] 3 | type MyStruct = 4 | val Field1 : int 5 | val Field2 : string 6 | new(x, y) = { Field1 = x; Field2 = y } 7 | 8 | let x = new MyStruct() -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-struct-metadata/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 8, "col": 12}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-subclass-class-definition-with-override-members/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | open File 4 | 5 | type MyClass = 6 | inherit MyBaseClass 7 | new : unit -> MyClass 8 | override Method : x:int -> unit 9 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-subclass-class-definition-with-override-members/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyBaseClass() = 3 | abstract member Method: int -> unit 4 | default this.Method(x) = () 5 | 6 | type MyClass() = 7 | inherit MyBaseClass() 8 | override this.Method(x) = () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-subclass-class-definition-with-override-members/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 6, "col": 5}, "assertType" : "eq", "validation": false } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-total-active-patterns-should-display-enclosing-module-or-namespace/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | val (|Even|Odd|) : i:int -> Choice 4 | val testNumber : i:int -> unit 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-total-active-patterns-should-display-enclosing-module-or-namespace/input.fs: -------------------------------------------------------------------------------- 1 | 2 | let (|Even|Odd|) i = 3 | if i % 2 = 0 then Even else Odd 4 | 5 | let testNumber i = 6 | match i with 7 | | Even -> printfn "%d is even" i 8 | | Odd -> printfn "%d is odd" i -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-total-active-patterns-should-display-enclosing-module-or-namespace/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 7, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-total-active-patterns/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | val (|Even|Odd|) : i:int -> Choice 4 | val testNumber : i:int -> unit 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-total-active-patterns/input.fs: -------------------------------------------------------------------------------- 1 | 2 | let (|Even|Odd|) i = 3 | if i % 2 = 0 then Even else Odd 4 | 5 | let testNumber i = 6 | match i with 7 | | Even -> printfn "%d is even" i 8 | | Odd -> printfn "%d is odd" i -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-total-active-patterns/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 7, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-tuple-definition-1/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System 2 | 3 | /// Represents a 2-tuple, or pair. 4 | type Tuple<'T1, 'T2> = 5 | /// Initializes a new instance of the class. 6 | new : item1:'T1 * item2:'T2 -> Tuple<'T1, 'T2> 7 | /// Returns a value that indicates whether the current object is equal to a specified object. 8 | member Equals : obj:obj -> bool 9 | /// Returns the hash code for the current object. 10 | member GetHashCode : unit -> int 11 | /// Gets the value of the current object's first component. 12 | member Item1 : 'T1 13 | /// Gets the value of the current object's second component. 14 | member Item2 : 'T2 15 | /// Returns a string that represents the value of this instance. 16 | member ToString : unit -> string 17 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-tuple-definition-1/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | let x = Tuple(1, 2) -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-tuple-definition-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 8}, "assertType" : "eq", "ignoreOnUnix" : true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-tuple-definition-2/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System 2 | 3 | /// Represents a 2-tuple, or pair. 4 | type Tuple<'T1, 'T2> = 5 | /// Initializes a new instance of the class. 6 | new : item1:'T1 * item2:'T2 -> Tuple<'T1, 'T2> 7 | /// Returns a value that indicates whether the current object is equal to a specified object. 8 | member Equals : obj:obj -> bool 9 | /// Returns the hash code for the current object. 10 | member GetHashCode : unit -> int 11 | /// Gets the value of the current object's first component. 12 | member Item1 : 'T1 13 | /// Gets the value of the current object's second component. 14 | member Item2 : 'T2 15 | /// Returns a string that represents the value of this instance. 16 | member ToString : unit -> string 17 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-tuple-definition-2/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | let x = Tuple(1, 2) -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-tuple-definition-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 12}, "assertType" : "eq", "ignoreOnUnix" : true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-type-abbreviation-definition/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Core 2 | 3 | /// An abbreviation for the CLI type System.String. 4 | type string = System.String 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-type-abbreviation-definition/input.fs: -------------------------------------------------------------------------------- 1 | 2 | let x: string = null -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-type-abbreviation-definition/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-type-definition-that-contains-c#-events/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System.ComponentModel 2 | 3 | open System.ComponentModel 4 | 5 | /// Notifies clients that a property value has changed. 6 | [] 7 | type INotifyPropertyChanged = 8 | abstract member add_PropertyChanged : value:PropertyChangedEventHandler -> unit 9 | abstract member remove_PropertyChanged : value:PropertyChangedEventHandler -> unit 10 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-type-definition-that-contains-c#-events/input.fs: -------------------------------------------------------------------------------- 1 | open System.ComponentModel 2 | 3 | let f (x: INotifyPropertyChanged) = failwith "" -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-type-definition-that-contains-c#-events/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 11}, "assertType" : "eq", "ignoreOnUnix" : true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-union-case/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Core 2 | 3 | /// Helper types for active patterns with 2 choices. 4 | [] 5 | [] 6 | [] 7 | type Choice<'T1, 'T2> = 8 | /// Choice 1 of 2 choices 9 | | Choice1Of2 of 'T1 10 | /// Choice 2 of 2 choices 11 | | Choice2Of2 of 'T2 12 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-union-case/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | let x = Choice1Of2 () -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-union-case/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 9}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-union-type-definition/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Core 2 | 3 | /// Helper types for active patterns with 2 choices. 4 | [] 5 | [] 6 | [] 7 | type Choice<'T1, 'T2> = 8 | /// Choice 1 of 2 choices 9 | | Choice1Of2 of 'T1 10 | /// Choice 2 of 2 choices 11 | | Choice2Of2 of 'T2 12 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-union-type-definition/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | let x: Choice<'T, 'U> = failwith "Not implemented yet" -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/go-to-union-type-definition/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-class-extension-members/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass = 4 | new : unit -> MyClass 5 | member Method : unit -> unit 6 | member MyExtensionMethod : unit -> unit 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-class-extension-members/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass() = 3 | member x.Method() = () 4 | 5 | type MyClass with 6 | member x.MyExtensionMethod() = () 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-class-extension-members/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-class-properties-with-setter/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass = 4 | new : unit -> MyClass 5 | member GetterAndSetter : int with get, set 6 | member SetterOnly : int with set 7 | static member StaticGetterAndSetter : int with get, set 8 | static member StaticSetterOnly : int with set 9 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-class-properties-with-setter/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass() = 3 | let mutable instanceValue = 0 4 | static let mutable staticValue = 0 5 | 6 | member val GetterAndSetter = 0 with get, set 7 | member __.SetterOnly with set(value) = instanceValue <- value 8 | 9 | static member val StaticGetterAndSetter = 0 with get, set 10 | static member StaticSetterOnly with set(value) = staticValue <- value 11 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-class-properties-with-setter/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-delegates-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyDelegate = 4 | delegate of unit * int -> unit 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-delegates-1/input.fs: -------------------------------------------------------------------------------- 1 | type MyDelegate = delegate of unit * int -> unit -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-delegates-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-delegates-2/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyDelegate = 4 | delegate of arg1:int -> int 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-delegates-2/input.fs: -------------------------------------------------------------------------------- 1 | type MyDelegate = delegate of arg1:int -> int -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-delegates-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-double-backtick-identifiers-on-member-constraints-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass< ^T when ^T : (static member ``A static member`` : unit -> ^T)> = 4 | class 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-double-backtick-identifiers-on-member-constraints-1/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass<'T when 'T : (static member ``A static member`` : unit -> 'T)> = 3 | class end 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-double-backtick-identifiers-on-member-constraints-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-double-backtick-identifiers-on-member-constraints-2/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass< ^T when ^T : (member ``A property`` : int)> = 4 | class 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-double-backtick-identifiers-on-member-constraints-2/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass<'T when 'T : (member ``A property`` : int)> = 3 | class end 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-double-backtick-identifiers-on-member-constraints-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-methods/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass<'T when 'T : struct> = 4 | new : unit -> MyClass<'T> 5 | member Method : x:'X -> int when 'X : null 6 | member NormalMethod : unit -> unit 7 | static member StaticMethod : x:('X * 'X) -> bool when 'X : equality 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-methods/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass<'T when 'T : struct>() = 3 | member __.NormalMethod() = () 4 | member __.Method<'X when 'X : null>(x: 'X) = 0 5 | static member StaticMethod<'X when 'X : equality>(x: 'X * 'X) = 6 | x = x 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-methods/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-module-functions-and-values-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | val func : x:'X -> int when 'X : null and 'X : comparison 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-module-functions-and-values-1/input.fs: -------------------------------------------------------------------------------- 1 | let func<'X when 'X : null and 'X : comparison>(x: 'X) = 0 -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-module-functions-and-values-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 4}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-module-functions-and-values-2/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | val value : string when 'X : null and 'X : comparison 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-module-functions-and-values-2/input.fs: -------------------------------------------------------------------------------- 1 | let value<'X when 'X : null and 'X : comparison> = typeof<'X>.ToString() -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-module-functions-and-values-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 4}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass<'T, 'U when 'T : null and 'T : (new : unit -> 'T) and 'U : struct> = 4 | new : unit -> MyClass<'T, 'U> 5 | member Method : unit -> unit 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-1/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | type MyClass<'T, 'U when 'T : null and 'T : (new : unit -> 'T) and 'U : struct>() = 3 | member x.Method() = () 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-2/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | open System 4 | 5 | type MyClass<'T, 'U when 'T :> IComparable and 'U : not struct> = 6 | new : unit -> MyClass<'T, 'U> 7 | member Method : unit -> unit 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-2/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | type MyClass<'T, 'U when 'T :> IComparable and 'U : not struct>() = 3 | member x.Method() = () 4 | 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-3/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass<'T, 'U when 'T : comparison and 'U : equality> = 4 | new : unit -> MyClass<'T, 'U> 5 | member Method : unit -> unit 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-3/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | type MyClass<'T, 'U when 'T : comparison and 'U : equality>() = 3 | member x.Method() = () 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-3/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-4/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass<'T, 'U when 'T : unmanaged and 'U : enum> = 4 | new : unit -> MyClass<'T, 'U> 5 | member Method : unit -> unit 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-4/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | type MyClass<'T, 'U when 'T : unmanaged and 'U : enum>() = 3 | member x.Method() = () 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-4/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-5/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass<'T when 'T : delegate> = 4 | new : unit -> MyClass<'T> 5 | member Method : unit -> unit 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-5/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | type MyClass<'T when 'T : delegate>() = 3 | member x.Method() = () 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-generic-constraints-on-type-5/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-nested-modules/input.fs: -------------------------------------------------------------------------------- 1 | 2 | let x = Array.map 3 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-nested-modules/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 9}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-optional-parameters/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type T = 4 | new : unit -> T 5 | static member Method : ?x:int -> int 6 | static member Method2 : ?x:int -> int 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-optional-parameters/input.fs: -------------------------------------------------------------------------------- 1 | 2 | open System.Runtime.InteropServices 3 | type T() = 4 | static member Method([]?x: int) = (defaultArg x 0) * 2 5 | static member Method2(?x: int) = (defaultArg x 0) * 2 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-optional-parameters/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-property-method-attributes/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass = 4 | new : unit -> MyClass 5 | [] 6 | member Method : unit -> unit 7 | [] 8 | member Prop : int 9 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-property-method-attributes/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass() = 3 | [] 4 | member __.Prop = 0 5 | [] 6 | member __.Method() = () 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-property-method-attributes/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-record-extension-members/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyRecord = 4 | { 5 | A: string 6 | B: int 7 | } 8 | member Method1 : unit -> unit 9 | member Method2 : unit -> unit 10 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-record-extension-members/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyRecord = 3 | { A: string; B: int } 4 | member __.Method1() = () 5 | 6 | type MyRecord with 7 | member __.Method2() = () 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-record-extension-members/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-record-field-attributes/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | open System 4 | 5 | type Record = 6 | { 7 | [] 8 | [] 9 | Field1: int 10 | [] 11 | Field2: float 12 | } 13 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-record-field-attributes/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | open System.Runtime.Serialization 3 | type Record = { 4 | [] 5 | [] 6 | Field1: int 7 | 8 | [] 9 | Field2: float 10 | } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-record-field-attributes/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 3, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-1/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass< ^T when ^T : (static member Create : unit -> ^T) and ^T : (member Prop : int)> = 4 | class 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-1/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass<'T when 'T : (static member Create : unit -> 'T) and 'T : (member Prop : int)> = 3 | class end 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-1/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-2/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass< ^T when ^T : (member Create : int * ^T -> ^T)> = 4 | class 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-2/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass<'T when 'T : (member Create : int * 'T -> 'T)> = 3 | class end 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-2/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-3/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass< ^T when ^T : (static member MyProp : int)> = 4 | class 5 | end 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-3/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass<'T when 'T : (static member MyProp : int)> = 3 | class end 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-3/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-4/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyClass = 4 | new : unit -> MyClass 5 | member inline Method : t: ^T -> unit when ^T : (member ConstraintMethod : unit -> unit) 6 | static member inline StaticMethod : unit -> ^T when ^T : (static member Create : unit -> ^T) 7 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-4/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyClass() = 3 | member inline __.Method< ^T when ^T : (member ConstraintMethod : unit -> unit)>(t : ^T) = () 4 | static member inline StaticMethod< ^T when ^T : (static member Create : unit -> ^T)>() = 5 | (^T : (static member Create : unit -> ^T) ()) 6 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-statically-resolved-constraints-4/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-union-case-attributes/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type Union = 4 | | [] 5 | [] 6 | Case1 of int 7 | | [] 8 | Case2 of string 9 | | Case3 10 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-union-case-attributes/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type Union = 3 | | [] 4 | [] 5 | Case1 of int 6 | | [] Case2 of string 7 | | Case3 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-union-case-attributes/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-union-type-extension-members/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | type MyUnion = 4 | | A of int 5 | | B of float 6 | member Method1 : unit -> unit 7 | member Method2 : unit -> string 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-union-type-extension-members/input.fs: -------------------------------------------------------------------------------- 1 | 2 | type MyUnion = A of int | B of float 3 | with 4 | member __.Method1() = () 5 | 6 | type MyUnion with 7 | member __.Method2() = "allo!" 8 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/handle-union-type-extension-members/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 5}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/members-are-sorted-this-way-abstract-member-member-static-member/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | [] 4 | type Abstract = 5 | abstract member AP : float 6 | abstract member M : unit -> int 7 | member M1 : unit -> unit 8 | member P : int 9 | static member SM : unit -> unit 10 | static member SP : int 11 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/members-are-sorted-this-way-abstract-member-member-static-member/input.fs: -------------------------------------------------------------------------------- 1 | 2 | [] 3 | type Abstract = 4 | member this.P = 3 5 | abstract member AP: float 6 | static member SP = 3 7 | static member SM() = () 8 | member this.M1() = () 9 | abstract member M: unit -> int 10 | 11 | let x: Abstract = Unchecked.defaultof<_> -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/members-are-sorted-this-way-abstract-member-member-static-member/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 11, "col": 7}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/operator-names-are-demangled/expected.fs: -------------------------------------------------------------------------------- 1 | module File 2 | 3 | val inline func : x: ^a -> ^b when ^a : (static member ( + ) : ^a * ^a -> ^b) 4 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/operator-names-are-demangled/input.fs: -------------------------------------------------------------------------------- 1 | let inline func x = x + x -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/operator-names-are-demangled/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 11}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/set-up-transitive-open-declarations-correctly/expected.fs: -------------------------------------------------------------------------------- 1 | namespace System.Runtime.InteropServices 2 | 3 | open System 4 | 5 | /// Controls accessibility of an individual managed type or member, or of all types within an assembly, to COM. 6 | [] 7 | type ComVisibleAttribute = 8 | inherit System.Attribute 9 | /// Initializes a new instance of the ComVisibleAttribute class. 10 | new : visibility:bool -> ComVisibleAttribute 11 | /// Gets a value that indicates whether the COM type is visible. 12 | member Value : bool 13 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/set-up-transitive-open-declarations-correctly/input.fs: -------------------------------------------------------------------------------- 1 | namespace System 2 | [] 3 | type T() = class end -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/set-up-transitive-open-declarations-correctly/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 35}, "assertType" : "eq", "ignoreOnUnix" : true } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/support-compiled-name-attribute/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Core 2 | 3 | /// Adding this attribute to a value or function definition in an F# module changes the name used 4 | /// for the value in compiled CLI code. 5 | [] 6 | type CompiledNameAttribute = 7 | inherit System.Attribute 8 | /// Creates an instance of the attribute 9 | new : compiledName:string -> CompiledNameAttribute 10 | /// The name of the value as it appears in compiled code 11 | member CompiledName : string 12 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/support-compiled-name-attribute/input.fs: -------------------------------------------------------------------------------- 1 | open System 2 | [] 3 | type C() = class end -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/support-compiled-name-attribute/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 2, "col": 8}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/type-abbreviations-for-basic-types/expected.fs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.FSharp.Collections 2 | 3 | /// An abbreviation for the CLI type System.Collections.Generic.List<_> 4 | type ResizeArray<'T> = System.Collections.Generic.List<'T> 5 | -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/type-abbreviations-for-basic-types/input.fs: -------------------------------------------------------------------------------- 1 | let x: ResizeArray<'T> = failwith "" -------------------------------------------------------------------------------- /tests/data/gotodef/generic-cases/type-abbreviations-for-basic-types/settings.json: -------------------------------------------------------------------------------- 1 | { "pos": { "line": 1, "col": 8}, "assertType" : "eq" } -------------------------------------------------------------------------------- /tests/data/gotodef/generic-sample/settings.list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "pos": { "line": 50, "col": 10}, "assertType" : "eq" } 3 | , { "pos": { "line": 50, "col": 10}, "assertType" : "eq", "validation": false } 4 | , { "pos": { "line":52, "col": 5}, "assertType" : "firstLinesEq", "firstLineCount": 5 } 5 | , { "pos": { "line": 50, "col": 10}, "assertType" : "eq" , "ignoreOnUnix" : true } 6 | , { "pos": { "line":52, "col": 5}, "assertType" : "firstLinesEq", "firstLineCount": 5, "ignoreOnUnix" : true } 7 | ] --------------------------------------------------------------------------------