-
Notifications
You must be signed in to change notification settings - Fork 1
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
NEW (Extension) @W-16442046@ Apex guru fixer logic - to show and insert apex guru suggestions #116
Conversation
src/apexguru/apex-guru-service.ts
Outdated
currentCode: Buffer.from(encodedCodeBefore, 'base64').toString('utf8'), | ||
suggestedCode: Buffer.from(encodedCodeAfter, 'base64').toString('utf8'), |
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.
If currentCode and suggestedCode is equal to `` (i.e. empty)… does it show this in the popup box still?
I ask because I would have assumed that to trigger whether it shows up or not would be based on undefined or null instead. Because maybe the after code is indeed empty and we want to show that instead of hide it.
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 explained in slack, this doesn't show up.
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.
Maybe not today. But it could in the future.
Instead of
(prop: ApexGuruProperty) => prop.name === 'code_after')?.value ?? ''
Why not just send in the value always even if it is undefined.
Then your line
if (apexGuruViolation.suggestedCode) {
code could just switch to
if (apexGuruViolation.suggestedCode !== undefined) {
or maybe just
if (typeof apexGuruViolation.suggestedCode === 'string') {
so that it allows for empty strings.
src/lib/diagnostics.ts
Outdated
if (engine === 'apexguru') { | ||
const apexGuruViolation = violation as ApexGuruViolation; | ||
|
||
if (apexGuruViolation.suggestedCode?.trim()) { |
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.
If the suggestedCode is empty... maybe that is because we are suggesting to replace it. Can we instead just explicitly check if the suggestedCode is undefined as a way of determining this.
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.
Ah! this is a super-edge case. But valid point. Let me take care of this.
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.
Done!
No description provided.