Skip to content

Conversation

@KevinRansom
Copy link
Contributor

Use the Roslyn workspace as a datasource for source files and referenced projects for the F# Editor language service.

Note: as of right now the source files are not in project file order.

@vasily-kirichenko
Copy link
Contributor

I cannot build it locally:

 E:\github\visualfsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(329,35): error FS 0039: The field, constructor or member 'DocumentInfoChanged' is not defined. [E:\github\visualfsharp\vsintegr ation\src\FSharp.Editor\FSharp.Editor.fsproj]

How to fix it?

@KevinRansom
Copy link
Contributor Author

@vasily-kirichenko working on it.

Copy link
Member

@Pilchie Pilchie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonmalinowski it would be great if you could also look at this.

| WorkspaceChangeKind.AdditionalDocumentAdded
| WorkspaceChangeKind.AdditionalDocumentRemoved
| WorkspaceChangeKind.DocumentInfoChanged
| WorkspaceChangeKind.SolutionCleared ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need SolutionAdded/SolutionRemoved here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilchie yes.

let workspaceChanged (args:WorkspaceChangeEventArgs) =
match args.Kind with
| WorkspaceChangeKind.ProjectAdded
| WorkspaceChangeKind.ProjectChanged
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The event tells you the affect projects in these cases, instead of needing to iterate all projects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilchie I have had it both ways. I will go back to per project ... it seems like less overhead.

let p = workspace.ProjectTracker.GetProject projectId
match p with
| null ->
true, projectContextFactory.CreateProjectContext(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments about the fact that the language service is the one responsible for putting legacy projects into the workspace, but the project system does it for CPS based projects might make this clearer.

At first glance it was strange that this existed in a method that is hooked up to WorkspaceChanged events. It wasn't clear how there could ever be projects that would be null here.


for referencedSite in referencedProjectSites do
let referencedProjectId = setup referencedSite
| _ -> ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is reachable - we don't have any implementations of IWorkspaceProjectContext that aren't AbstractProject.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilchie I don't think the compiler knows that, and that may also change in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - I forgot F# pattern matches were complete.

[|
for reference in project.ProjectReferences do
let p = workspace.CurrentSolution.GetProject(reference.ProjectId)
yield (p.OutputFilePath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want the compiler output path (usually in obj), or the final, msbuild output path (usually in bin) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilchie either works since we need metadata from the built dll. Final might be better if the FCS does magic resolution for dependencies not specified in the project.

let taskReporter = None
let targetFrameworkMoniker = ""
let projectGuid () = project.Id.Id.ToString()
let creationTime = System.DateTime.Now
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using UTC - this could go backwards if VS is running when the timezone/DST of the machine changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilchie ... yes of course, thanks.


member private __.ProvideProjectSiteProvider(workspace:Workspace, project:Project) =
let visualStudioWorkspace = workspace :?> VisualStudioWorkspace
let hier = visualStudioWorkspace.GetHierarchy(project.Id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider handling null, particularly for Lightweight solution load.

@Pilchie
Copy link
Member

Pilchie commented Jul 26, 2017

Also tagging @srivatsn here.

{new IProvideProjectSite with
member this.GetProjectSite() =
let compileItems () = [| for document in project.Documents do yield document.FilePath |]
let compilerFlags () = [| "" |]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is the piece that we'll have to address by storing the string in the Workspace here

@KevinRansom
Copy link
Contributor Author

closing for a pr targeting vs2017-rtm

@KevinRansom KevinRansom closed this Aug 8, 2017
@KevinRansom KevinRansom deleted the iprojectsite branch September 17, 2017 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants