-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Implement new interfaces for adding files #30527
Implement new interfaces for adding files #30527
Conversation
Note I do not actually intend to merge this into |
41546c6
to
d19fd35
Compare
135691b
to
1c1407b
Compare
@tmeschter I've pointed this PR now at the dev16.0.x branch but a word of explanation: the branch you were targeting was me merging my branch (which went into dev16.0.x) with dev16.0.x-vs-deps to make sure I had any changes there that might impact RPS. As a result, your branch implicitly is including those. You're going to have to do a |
@jasonmalinowski Yes, I was originally targeting your branch in order to make it easier to review--the my plan was always to wait until your change was in and then rebase my change. |
1c1407b
to
ccb5f8e
Compare
@jasonmalinowski I've rebased the changes and updated the PR to point to master. |
{ | ||
internal partial class CSharpProjectShim : ICSharpProjectSiteEx | ||
{ | ||
public void OnSourceFileAddedEx(string filename, string folder) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an agreement here that synchronization is being done by the project system to avoid parallel calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(As it stands, your AddFile isn't mutating any state and VisualStudioProject is fine itself...but I'm not sure if that'll ever hold if somebody else adds something further to AddFile.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's on the project system to deal with that.
Ideally these interfaces are just a temporary stepping stone and I'll eventually be able to remove them in favor of the legacy project system shims implementing IWorkspaceProjectContext
.
test this |
@dotnet-bot test this |
test this please |
test this please |
Implement a new interface to allow csproj/msvbprj to add files. The existing `ICSharpProjecSite.OnSourceFileAdded` and `IVbCompilerProject.AddFile` had to go back to the hierarchy to check if the file had any `<Link>` metadata on it, effectively requiring that these methods only be called on the main thread. However, this metadata is readily available to csproj/msvbprj; the new `IProjectSiteEx.AddFilEx` method allow it to be passed in. This should make it possible to call this method on a background thread. Also, the language service supports batching up project changes before pushing them to the workspace, but does not currently expose a way for csproj/msvbprj to tell it when a batch of changes is starting or ending. The `StartBatch` and `EndBatch` methods on `IProjectSiteEx` fill this need.
ccb5f8e
to
5b250f6
Compare
@tmeschter A somewhat related question: are we gonna have a flag or something on the document to indicate it's linked (i.e. using ) vs. just a regular document (e.g. could be a document in a MTFM project, which has multiple documents in the solution with same path, but not necessarily a linked document) |
@genlu I don't think I fully understand your question, but this work doesn't change anything about how source files (with |
I'm just curious, because the information that if and how a document is linked into the project is not readily available in workspace. There's |
test windows_release_vs-integration_prtest |
test this please |
@Pilchie I just retargeted this to |
@tmeschter yes you need M2 Approval for preview2 @agocke is the branch ready for preview2 changes ? |
var folders = ImmutableArray<string>.Empty; | ||
if (!string.IsNullOrEmpty(linkMetadata)) | ||
{ | ||
var linkFolderPath = Path.GetDirectoryName(linkMetadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has something validated that this is valid filename? If not, I believe this will throw
test windows_release_vs-integration_prtest |
test integration |
Implement a new set of interfaces to allow csproj/msvbprj to add files.
The existing
ICSharpProjecSite.OnSourceFileAdded
andIVbCompilerProject.AddFile
had to go back to the hierarchy to check ifthe file had any
<Link>
metadata on it, effectively requiring thatthese methods only be called on the main thread. However, this metadata
is readily available to csproj/msvbprj; the new
OnSourceFileEx
`AddFileEx` methods allow it to be passed in. Thisshould make it possible to call these methods on a background thread.