salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

feat: create apex class in classes directory when right clicking to create class

Open kaustubhdapurkar opened this issue 1 year ago • 4 comments

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.

kaustubhdapurkar avatar Jun 01 '23 18:06 kaustubhdapurkar

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!

randi274 avatar Jun 08 '23 20:06 randi274

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🙂

CristiCanizales avatar Jun 12 '23 16:06 CristiCanizales

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.

kaustubhdapurkar avatar Jun 12 '23 16:06 kaustubhdapurkar

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 avatar Jun 15 '23 18:06 kaustubhdapurkar

@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.

aheber avatar Mar 31 '24 20:03 aheber

@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.

kaustubhdapurkar avatar Apr 07 '24 08:04 kaustubhdapurkar

Thank you. I'll take a look then.

aheber avatar Apr 07 '24 13:04 aheber

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 avatar Apr 08 '24 15:04 AnanyaJha

@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.

aheber avatar Apr 08 '24 15:04 aheber

@kaustubhdapurkar would you be ok if we close this one to focus on #5544?

randi274 avatar Apr 18 '24 15:04 randi274

Hey @randi274 , yes, this one can be closed.

kaustubhdapurkar avatar Apr 19 '24 03:04 kaustubhdapurkar