Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dev16 Preview2]Single File Management Refactor #5845

Merged
merged 26 commits into from
Nov 18, 2018
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3944a88
Trying to fix dev16 with latest changes
TIHan Oct 25, 2018
9a6bb62
Dev16 is partially working
TIHan Oct 26, 2018
e5b98f8
Fixed several issues, should be working dev16
TIHan Oct 27, 2018
2ea60a7
Using try..with on computing options
TIHan Oct 29, 2018
3e85e8b
Deleting unused code
TIHan Oct 29, 2018
3d633bb
Minor refactor
TIHan Oct 29, 2018
736bf3a
Check command line option cps stamps for recompute as a backup
TIHan Oct 29, 2018
d05af2e
Using ProjectId for project options
TIHan Oct 29, 2018
415bdbb
Updating binoutputpath for legacy projects to workspace project
TIHan Oct 30, 2018
f4e0c88
Removing cps stamp as we don't need it
TIHan Oct 30, 2018
8169490
Updated roslyn package. Using IWorkspaceProjectContext.Id.
TIHan Oct 30, 2018
a099e6d
Handling single files (script files) differently
TIHan Oct 31, 2018
c7ead94
Removing dead code
TIHan Oct 31, 2018
ca4e2a9
Removing dead code
TIHan Oct 31, 2018
557d281
Removing dead code
TIHan Oct 31, 2018
5b9e6dd
Removing dead code
TIHan Oct 31, 2018
5d0e105
Removing dead code
TIHan Oct 31, 2018
a45274c
Removing ProjectSitesAndFiles.fs
TIHan Oct 31, 2018
61c976b
Initializing early to capture solution/workspace events
TIHan Oct 31, 2018
d50fce6
Handling rename of script files
TIHan Nov 1, 2018
ac0a91d
Merged into dev16
TIHan Nov 13, 2018
671e7aa
Delete Fsi.nuget.props
TIHan Nov 15, 2018
9b49622
Update Extensions.fs
TIHan Nov 15, 2018
44bf2a4
Create project per script file
TIHan Nov 18, 2018
13f579c
Make sure to dispose in fallback
TIHan Nov 18, 2018
ded440f
Don't need that
TIHan Nov 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removing cps stamp as we don't need it
  • Loading branch information
TIHan committed Oct 30, 2018
commit f4e0c881bf0da04b20bc83f9bda8569a3fd40913
Original file line number Diff line number Diff line change
@@ -22,18 +22,15 @@ open System.Threading
open Microsoft.VisualStudio.Shell.Interop
open Microsoft.VisualStudio.LanguageServices.Implementation.TaskList

type private CpsStamp = DateTime

[<AutoOpen>]
module private FSharpProjectOptionsHelpers =

let mapCpsProjectToSite(workspace:VisualStudioWorkspaceImpl, project:Project, serviceProvider:System.IServiceProvider, cpsCommandLineOptions: IDictionary<ProjectId, CpsStamp * string[] * string[]>) =
let mapCpsProjectToSite(workspace:VisualStudioWorkspaceImpl, project:Project, serviceProvider:System.IServiceProvider, cpsCommandLineOptions: IDictionary<ProjectId, string[] * string[]>) =
let hier = workspace.GetHierarchy(project.Id)
let cpsStampOpt, sourcePaths, referencePaths, options =
let sourcePaths, referencePaths, options =
match cpsCommandLineOptions.TryGetValue(project.Id) with
| true, (cpsStamp, sourcePaths, options) -> Some(cpsStamp), sourcePaths, [||], options
| false, _ -> None, [||], [||], [||]
cpsStampOpt,
| true, (sourcePaths, options) -> sourcePaths, [||], options
| false, _ -> [||], [||], [||]
{
new IProvideProjectSite with
member x.GetProjectSite() =
@@ -94,9 +91,9 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
let cancellationTokenSource = new CancellationTokenSource()

// Hack to store command line options from HandleCommandLineChanges
let cpsCommandLineOptions = new ConcurrentDictionary<ProjectId, DateTime * string[] * string[]>()
let cpsCommandLineOptions = new ConcurrentDictionary<ProjectId, string[] * string[]>()

let cache = Dictionary<ProjectId, CpsStamp option * VersionStamp * FSharpParsingOptions * FSharpProjectOptions>()
let cache = Dictionary<ProjectId, VersionStamp * FSharpParsingOptions * FSharpProjectOptions>()

let rec tryComputeOptions (project: Project) =
let projectId = project.Id
@@ -133,14 +130,14 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
else

let hier = workspace.GetHierarchy(projectId)
let cpsStampOpt, projectSite =
let projectSite =
match hier with
// Legacy
| (:? IProvideProjectSite as provideSite) -> None, provideSite.GetProjectSite()
| (:? IProvideProjectSite as provideSite) -> provideSite.GetProjectSite()
// Cps
| _ ->
let cpsStampOpt, provideSite = mapCpsProjectToSite(workspace, project, serviceProvider, cpsCommandLineOptions)
cpsStampOpt, provideSite.GetProjectSite()
let provideSite = mapCpsProjectToSite(workspace, project, serviceProvider, cpsCommandLineOptions)
provideSite.GetProjectSite()

let otherOptions =
project.ProjectReferences
@@ -182,16 +179,12 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,

let parsingOptions, _ = checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions)

cache.[projectId] <- (cpsStampOpt, projectStamp, parsingOptions, projectOptions)
cache.[projectId] <- (projectStamp, parsingOptions, projectOptions)

Some(parsingOptions, projectOptions)

| true, (cpsStampOpt, projectStamp2, parsingOptions, projectOptions) ->
let cpsStampOpt2 =
match cpsCommandLineOptions.TryGetValue(projectId) with
| true, (cpsStampOpt2, _, _) -> Some(cpsStampOpt2)
| _ -> None
if projectStamp <> projectStamp2 || cpsStampOpt <> cpsStampOpt2 then
| true, (projectStamp2, parsingOptions, projectOptions) ->
if projectStamp <> projectStamp2 then
cache.Remove(projectId) |> ignore
tryComputeOptions project
else
@@ -219,8 +212,8 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
member __.ClearOptionsByProjectId(projectId) =
agent.Post(FSharpProjectOptionsMessage.ClearOptions(projectId))

member __.SetCpsCommandLineOptions(projectId, stamp, sourcePaths, options) =
cpsCommandLineOptions.[projectId] <- (stamp, sourcePaths, options)
member __.SetCpsCommandLineOptions(projectId, sourcePaths, options) =
cpsCommandLineOptions.[projectId] <- (sourcePaths, options)

member __.TryGetCachedOptionsByProjectId(projectId) =
match cache.TryGetValue(projectId) with
@@ -302,7 +295,7 @@ type internal FSharpProjectOptionsManager
member this.GetCompilationDefinesForEditingDocument(document:Document) =
let parsingOptions =
match reactor.TryGetCachedOptionsByProjectId(document.Project.Id) with
| Some (_, _, parsingOptions, _) -> parsingOptions
| Some (_, parsingOptions, _) -> parsingOptions
| _ -> { FSharpParsingOptions.Default with IsInteractive = IsScript document.Name }
CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions

@@ -370,6 +363,6 @@ type internal FSharpProjectOptionsManager
else Path.Combine(Path.GetDirectoryName(path), p)
let sourcePaths = sources |> Seq.map(fun s -> fullPath s.Path) |> Seq.toArray

reactor.SetCpsCommandLineOptions(projectId, DateTime.UtcNow, sourcePaths, options.ToArray())
reactor.SetCpsCommandLineOptions(projectId, sourcePaths, options.ToArray())

member __.Checker = checkerProvider.Checker