diff --git a/tests/projects/stress/Templates/netstandard_fsproj.template b/tests/projects/stress/Templates/netstandard_fsproj.template
new file mode 100644
index 00000000000..9931b51c2fe
--- /dev/null
+++ b/tests/projects/stress/Templates/netstandard_fsproj.template
@@ -0,0 +1,14 @@
+
+
+ netstandard2.0
+
+
+[FILES]
+
+
+[PROJECTREFERENCES]
+
+
+[PACKAGEREFERENCES]
+
+
\ No newline at end of file
diff --git a/tests/projects/stress/gen.fsx b/tests/projects/stress/gen.fsx
index bf6014e4d60..bbb0c1bc03e 100644
--- a/tests/projects/stress/gen.fsx
+++ b/tests/projects/stress/gen.fsx
@@ -4,14 +4,27 @@ open Perf
open System
printfn "%A" fsi.CommandLineArgs
-if fsi.CommandLineArgs.Length <> 3 then printfn "usage: fsi gen.fsx "
+if fsi.CommandLineArgs.Length <> 4 then printfn "usage: fsi gen.fsx "
let D = string fsi.CommandLineArgs.[1]
let N = int fsi.CommandLineArgs.[2]
+let isNetStandard = Boolean.Parse(fsi.CommandLineArgs.[3])
try System.IO.Directory.Delete(D, true) with _ -> ()
System.IO.Directory.CreateDirectory D
System.Environment.CurrentDirectory <- D
+let fsharpProjectWrite =
+ if isNetStandard then
+ FSharpProject.writeNetStandard
+ else
+ FSharpProject.write
+
+let csharpProjectWrite =
+ if isNetStandard then
+ CSharpProject.writeNetStandard
+ else
+ CSharpProject.write
+
let writeDense (dir : string) (projectType : ProjectType) (count : int) =
let extension = match projectType with FSharp -> "fsproj" | CSharp -> "csproj"
@@ -30,7 +43,7 @@ let writeDense (dir : string) (projectType : ProjectType) (count : int) =
let fileName = sprintf "%s.fs" name
yield fileName ]
let project = { Name = name ; Guid = guid ; Files = files ; References = references ; BinaryReferences = [] }
- let writer = match projectType with FSharp -> FSharpProject.write | CSharp -> CSharpProject.write
+ let writer = match projectType with FSharp -> fsharpProjectWrite | CSharp -> csharpProjectWrite
writer path project
projects |> List.iteri writeProject
@@ -62,7 +75,7 @@ let writeShallow (dir : string) (projectType : ProjectType) (count1 : int) (coun
let writeAProject (name, guid) =
let path = sprintf @"%s\%s\%s.%s" dir name name extension
let project = { Name = name ; Guid = guid ; Files = [] ; References = [] ; BinaryReferences = [] }
- let writer = match projectType with FSharp -> FSharpProject.write | CSharp -> CSharpProject.write
+ let writer = match projectType with FSharp -> fsharpProjectWrite | CSharp -> csharpProjectWrite
writer path project
let writeBProject (name, guid) =
@@ -71,7 +84,7 @@ let writeShallow (dir : string) (projectType : ProjectType) (count1 : int) (coun
let makeRef (name, guid) = { Name = name ; Guid = guid ; RelativePath = sprintf @"..\%s\%s.%s" name name extension }
aProjects |> List.map makeRef
let project = { Name = name ; Guid = guid ; Files = [] ; References = references ; BinaryReferences = [] }
- let writer = match projectType with FSharp -> FSharpProject.write | CSharp -> CSharpProject.write
+ let writer = match projectType with FSharp -> fsharpProjectWrite | CSharp -> csharpProjectWrite
writer path project
aProjects |> List.iter writeAProject
@@ -103,7 +116,7 @@ let writeDenseBin (dir : string) (projectType : ProjectType) (count : int) =
let makeRef (name, guid) : BinaryRef = { Name = name ; RelativePath = sprintf @"..\%s\bin\Debug\%s.dll" name name }
projects.[0..i-1] |> List.map makeRef
let project = { Name = name ; Guid = guid ; Files = [] ; References = [] ; BinaryReferences = references }
- let writer = match projectType with FSharp -> FSharpProject.write | CSharp -> CSharpProject.write
+ let writer = match projectType with FSharp -> fsharpProjectWrite | CSharp -> csharpProjectWrite
writer path project
projects |> List.iteri writeProject
diff --git a/tests/projects/stress/perf.fsx b/tests/projects/stress/perf.fsx
index c8b629084a4..e1cb690258e 100644
--- a/tests/projects/stress/perf.fsx
+++ b/tests/projects/stress/perf.fsx
@@ -105,6 +105,30 @@ module FSharpProject =
safeWrite path text
+ let writeNetStandard path (project : Project) =
+
+ let files =
+ let printFileReference = sprintf " "
+ project.Files |> List.map printFileReference |> String.concat "\n"
+
+ for f in project.Files do
+ let filePath = Path.Combine(Path.GetDirectoryName(path),f)
+ let fileContents = sprintf "module %s\n\nlet x = 1" (Path.GetFileNameWithoutExtension(f))
+ safeWrite filePath fileContents
+
+ let references =
+ let printProjectReference (r : ProjectRef) =
+ sprintf " " r.RelativePath
+ project.References |> List.map printProjectReference |> String.concat "\n"
+
+ let text =
+ File.ReadAllText(Path.Combine(__SOURCE_DIRECTORY__,@"Templates\netstandard_fsproj.template"))
+ .Replace("[FILES]", files)
+ .Replace("[PROJECTREFERENCES]", references)
+ .Replace("[PACKAGEREFERENCES]", String.Empty)
+
+ safeWrite path text
+
[]
module CSharpProject =
@@ -135,6 +159,30 @@ module CSharpProject =
safeWrite path text
+ let writeNetStandard path (project : Project) =
+
+ let files =
+ let printFileReference = sprintf " "
+ project.Files |> List.map printFileReference |> String.concat "\n"
+
+ for f in project.Files do
+ let filePath = Path.Combine(Path.GetDirectoryName(path),f)
+ let fileContents = sprintf "module %s\n\nlet x = 1" (Path.GetFileNameWithoutExtension(f))
+ safeWrite filePath fileContents
+
+ let references =
+ let printProjectReference (r : ProjectRef) =
+ sprintf " " r.RelativePath
+ project.References |> List.map printProjectReference |> String.concat "\n"
+
+ let text =
+ File.ReadAllText(Path.Combine(__SOURCE_DIRECTORY__,@"Templates\netstandard_fsproj.template"))
+ .Replace("[FILES]", files)
+ .Replace("[PROJECTREFERENCES]", references)
+ .Replace("[PACKAGEREFERENCES]", String.Empty)
+
+ safeWrite path text
+
module Testing =
let testWrite () =
diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
index b5f643a1ee8..930749038c2 100644
--- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
+++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
@@ -427,7 +427,6 @@ type internal FSharpLanguageService(package : FSharpPackage) =
member private this.OnProjectAdded(projectId:ProjectId) = projectInfoManager.UpdateProjectInfoWithProjectId(projectId, "OnProjectAdded", invalidateConfig=true)
member private this.OnProjectReloaded(projectId:ProjectId) = projectInfoManager.UpdateProjectInfoWithProjectId(projectId, "OnProjectReloaded", invalidateConfig=true)
member private this.OnDocumentAdded(projectId:ProjectId, documentId:DocumentId) = projectInfoManager.UpdateDocumentInfoWithProjectId(projectId, documentId, "OnDocumentAdded", invalidateConfig=true)
- member private this.OnDocumentChanged(projectId:ProjectId, documentId:DocumentId) = projectInfoManager.UpdateDocumentInfoWithProjectId(projectId, documentId, "OnDocumentChanged", invalidateConfig=false)
member private this.OnDocumentReloaded(projectId:ProjectId, documentId:DocumentId) = projectInfoManager.UpdateDocumentInfoWithProjectId(projectId, documentId, "OnDocumentReloaded", invalidateConfig=true)
override this.Initialize() =
@@ -439,7 +438,6 @@ type internal FSharpLanguageService(package : FSharpPackage) =
| WorkspaceChangeKind.ProjectAdded -> this.OnProjectAdded(args.ProjectId)
| WorkspaceChangeKind.ProjectReloaded -> this.OnProjectReloaded(args.ProjectId)
| WorkspaceChangeKind.DocumentAdded -> this.OnDocumentAdded(args.ProjectId, args.DocumentId)
- | WorkspaceChangeKind.DocumentChanged -> this.OnDocumentChanged(args.ProjectId, args.DocumentId)
| WorkspaceChangeKind.DocumentReloaded -> this.OnDocumentReloaded(args.ProjectId, args.DocumentId)
| WorkspaceChangeKind.DocumentRemoved
| WorkspaceChangeKind.ProjectRemoved
@@ -686,17 +684,7 @@ type internal FSharpLanguageService(package : FSharpPackage) =
let fileContents = VsTextLines.GetFileContents(textLines, textViewAdapter)
this.SetupStandAloneFile(filename, fileContents, this.Workspace, hier)
- | id ->
-
- // This is the path when opening in-project .fs/.fsi files in CPS projects when
- // there is already an existing DocumentId for that document in the solution (which
- // will normally be the case)
- //
- // However, it is not clear this call to UpdateProjectInfoWithProjectId is needed, and it seems
- // harmful as it will cause a complete recheck of the project every time a view for a file in the
- // project is freshly opened.
-
- projectInfoManager.UpdateProjectInfoWithProjectId(id.ProjectId, "SetupNewTextView", invalidateConfig=true)
+ | _ -> ()
| _ ->
// This is the path for both in-project and out-of-project .fsx files