salesforcedx-vscode
salesforcedx-vscode copied to clipboard
feat: create apex class in classes directory when right clicking to create class
feat: create apex class in classes directory when right clicking to create class
This is just draft PR and I am pretty sure my implementation is not the best. Would love to get any feedback on this. I strongly believe that the code I have written resembles spaghetti code🤣.
#4294
What does this PR do?
When creating an apex class by right clicking on the classes directory, it will create the class directly in this classes directory without prompting the user for a file path.
What issues does this PR fix or reference?
#4294
Functionality Before
When creating apex class by right clicking the classes directory, the extension still asks for a directory.
Functionality After
When creating apex class by right clicking the classes directory, class is created automatically in the directory.
Thanks for taking a pass at this @kaustubhdapurkar ! I'm actually about to go on parental leave and I'm not sure I'll be able to review before starting leave. I'll make sure the team is aware of this PR and is able to give you some feedback on it!
Hi @kaustubhdapurkar! Thanks for this. Just a small comment after a quick bird's eye review, is that you'd also need to update the tests related to this🙂
Hi @CristiCanizales , yes, I have updated the test classes locally but didn't include that in the commit since I was not sure of the solution I wrote. Do you see any issues with it in its current state? I will add a commit for the tests as well.
Hi, I am trying to write the tests for this change but am struggling with this piece of code,
const classesDirectoryPath = path.join('classes');
const classesDirectoryUri = vscode.Uri.file(classesDirectoryPath);
const classesSubDirectoryPath = path.join(
classesDirectoryPath,
'subdirectory'
);
const classesSubDirectoryUri = vscode.Uri.file(classesSubDirectoryPath);
The values of the variables classesDirectoryUri
and classesSubDirectoryUri
is undefined
when I run the test. This is probably because I am doing something wrong but I am not able to figure it out.
Would greatly appreciate any help here 🙂.
@kaustubhdapurkar what is the state of this? I was thinking about trying to tackle this feature but I see you've already got something in progress.
@kaustubhdapurkar what is the state of this? I was thinking about trying to tackle this feature but I see you've already got something in progress.
Hey @aheber , You can give it a try, I have paused my work on this as of now.
Thank you. I'll take a look then.
Hi @aheber - thanks for picking this up again! Let us know once you have an updated solution and we'll ask the team to review
@AnanyaJha will do. It'll take me a bit to get my bearings on the project but I'll let you know when I get it done.
@kaustubhdapurkar would you be ok if we close this one to focus on #5544?
Hey @randi274 , yes, this one can be closed.