-
Notifications
You must be signed in to change notification settings - Fork 2
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
Unconstrain project folder names (623) #653
Conversation
…older names. Local projects do seem to load, but I'm getting errors when trying to retrieve them from the ScrTextCollection.
Local projects do seem to load, but I'm getting errors when trying to retrieve them from the ScrTextCollection. |
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.
I did some debugging and found the problem. If you haven't tried it, you can use a normal debugger in VS Code for our .NET Data Provider by using the "Attach to .NET Core" option on the "Run and Debug" tab. You first have to start the platform separately (I usually use "Debug Platform Backend".) Once it is running, you can switch to "Attach to .NET Core" and then click the green triangle next to the dropdown. Unfortunately there isn't a way to start the .NET process in the debugger itself easily, but for this scenario it's fine to attach it later then use the new code.
Reviewable status: 0 of 8 files reviewed, 2 unresolved discussions (waiting on @tombogle)
c-sharp/Projects/LocalProjects.cs
line 138 at r1 (raw file):
projectDetails.HomeDirectory, PROJECT_SUBDIRECTORY, projectDetails.Metadata.ProjectType
This is not "paratext". This is generally "ParatextStandard" I believe. You can't substitute one for the other as currently designed. This line should be reverted for now.
c-sharp/Projects/LocalProjects.cs
line 149 at r1 (raw file):
_projectDetailsMap[id.ToUpperInvariant()] = projectDetails; if (projectDetails.Metadata.ProjectType == ProjectMetadata.PARATEXT)
Same problem as above. Since the metadata project type doesn't match "paratext", the project never gets added to the ScrTextCollection. That is why Get
fails to work later.
Until we have more project types and figure out exactly what that looks like, I would drop this if
check and just add the projects to the ScrTextCollection
always.
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.
Reviewable status: 0 of 18 files reviewed, all discussions resolved
c-sharp/Projects/LocalProjects.cs
line 138 at r1 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
This is not "paratext". This is generally "ParatextStandard" I believe. You can't substitute one for the other as currently designed. This line should be reverted for now.
Fixed
c-sharp/Projects/LocalProjects.cs
line 149 at r1 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
Same problem as above. Since the metadata project type doesn't match "paratext", the project never gets added to the ScrTextCollection. That is why
Get
fails to work later.Until we have more project types and figure out exactly what that looks like, I would drop this
if
check and just add the projects to theScrTextCollection
always.
Fixed
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.
I picked up where Tom paused for the EMDC trip and tried to finish this off. As part of the work I tried to clarify that LocalProjects
is really focused only on Paratext projects as it is written for now. Once we add more project types we can think about how to refactor it, but I feel like exactly what that should look like is outside the scope of this ticket and requires having another project type available to try it out with real examples.
Reviewable status: 0 of 18 files reviewed, all discussions resolved
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.
Oh, and all the spacing changes were from the prettier plug-in that auto formats lines that are too long. I assume others just don't have this installed, but I'm surprised it wasn't done automatically on previous check-ins.
Reviewable status: 0 of 18 files reviewed, all discussions resolved
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.
Reviewed 4 of 8 files at r1, 13 of 14 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tombogle)
c-sharp/Projects/LocalParatextProjects.cs
line 86 at r3 (raw file):
#region Protected properties and methods protected virtual string ProjectRootFolder { get; }
BTW I'm wondering if this should be at the top of the class with the other field declarations? I couldn't easily see its declaration when the constructor assigned to it.
c-sharp/Projects/LocalParatextProjects.cs
line 108 at r3 (raw file):
} protected static void CreateDirectory(string dir)
Thanks for making the code DRYer.
c-sharp-tests/Projects/LocalParatextProjectsTests.cs
line 7 at r3 (raw file):
[ExcludeFromCodeCoverage] [TestFixture]
FYI thanks for the improvement to the tests.
(Although strictly these are no longer unit tests because they are writting to the actual FS, whereas before I think they were still unit tests.)
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.
thanks to Tom for the great stuff and to Matt for finishing things off!
Reviewed 4 of 8 files at r1, 13 of 14 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tombogle)
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @irahopkinson)
c-sharp/Projects/LocalParatextProjects.cs
line 86 at r3 (raw file):
Previously, irahopkinson (Ira Hopkinson) wrote…
BTW I'm wondering if this should be at the top of the class with the other field declarations? I couldn't easily see its declaration when the constructor assigned to it.
This isn't a field, it's a property. They are similar, but not really the same. One important difference is that fields will always be assigned a value when an object is constructed, but a property may or may not. As such, fields are almost always listed next to the constructors, but not so with properties. This kind of getter property (i.e., one without a setter and without a function body) is the only kind of property that typically has an assigned value in the constructor. Getters are usually in my experience either set apart on their own or grouped together with functions inside of a file.
Prior to this change, this was a private readonly
field. It was made a protected virtual
for testing purposes, and the only things that are protected
here are marked that way because tests want to override them or call them even though they aren't public
. I thought, then, it would be easier to keep all the protected
things together since tests will want to do something with them.
If it's too obscure/hidden down here, I think I would change it from a getter to a field again. It's really weird to mix properties and getters right by the constructor in my experience.
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tombogle)
c-sharp/Projects/LocalParatextProjects.cs
line 86 at r3 (raw file):
Previously, lyonsil (Matt Lyons) wrote…
This isn't a field, it's a property. They are similar, but not really the same. One important difference is that fields will always be assigned a value when an object is constructed, but a property may or may not. As such, fields are almost always listed next to the constructors, but not so with properties. This kind of getter property (i.e., one without a setter and without a function body) is the only kind of property that typically has an assigned value in the constructor. Getters are usually in my experience either set apart on their own or grouped together with functions inside of a file.
Prior to this change, this was a private
readonly
field. It was made aprotected virtual
for testing purposes, and the only things that areprotected
here are marked that way because tests want to override them or call them even though they aren'tpublic
. I thought, then, it would be easier to keep all theprotected
things together since tests will want to do something with them.If it's too obscure/hidden down here, I think I would change it from a getter to a field again. It's really weird to mix properties and getters right by the constructor in my experience.
I think I'm going to merge this as-is and let @tombogle decide if he thinks it makes more sense to change back to a field. He switched it from a field to a property originally, and I don't know if he had something in mind when making that change that I'm not aware of.
This change is