-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fixes #113 add hook to pretty print code to show in diff in atlascode #114
base: main
Are you sure you want to change the base?
Conversation
Reviewing |
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.
@marcellourbani great to see this PR. I may have missed something, but it doesn't look quite complete.
@@ -26,3 +26,15 @@ export const AuthInfoVersionKey = 'authInfoVersion'; | |||
|
|||
export const ATLASCODE_TEST_USER_EMAIL = 'axontest2025@gmail.com'; | |||
export const ATLASCODE_TEST_HOST = 'axontest2025.atlassian.net'; | |||
export enum CommandContext { |
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 don't see where this is used.
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.
Same thing you did in commandContext.ts, I'll refactor.
in normalize.ts:
function setCommandContext(key: CommandContext | string, value: any) {
return commands.executeCommand('setContext', key, value);
}
{ | ||
"command": "atlascode.bb.togglediffNormalize", | ||
"group": "navigation", | ||
"when": "isInDiffEditor && resourceScheme == atlascode.bbpr && atlascode:IsNormalizerEnabled" |
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.
How is atlascode:IsNormalizerEnabled
being set?
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.
in enableDiffNormalize, in normalize.ts:
const enableDiffNormalize = (e?: TextEditor) => {
const relevant = e?.document.uri.scheme === 'atlascode.bbpr';
const active = relevant && normalizers.some((n) => n.isRelevant(e.document.uri));
setCommandContext(CommandContext.IsNormalizerEnabled, active);
};
normalizers are populated by calling the extension API, like in vscode-abaplint:
if (ext.exports?.registerCodeNormalizer) {
const norm = getAbapCodeNormalizer(client);
integrationIsActive = (u) => u.scheme === ATLASCODEDIFF && norm.isRelevant(u);
ext.exports.registerCodeNormalizer(norm);
}
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.
It's set in enableDiffNormalize (see normalize.ts):
const enableDiffNormalize = (e?: TextEditor) => {
const relevant = e?.document.uri.scheme === 'atlascode.bbpr';
const active = relevant && normalizers.some((n) => n.isRelevant(e.document.uri));
setCommandContext(CommandContext.IsNormalizerEnabled, active);
};
this only happens if a normalizer is registered, as for instance vscode-abaplint
if (ext.exports?.registerCodeNormalizer) {
const norm = getAbapCodeNormalizer(client);
integrationIsActive = (u) => u.scheme === ATLASCODEDIFF && norm.isRelevant(u);
ext.exports.registerCodeNormalizer(norm);
}
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.
To explain better, I created a public repo with a PR here:
becomes:
abaplint always has the normalizer, but with this can be enabled by default, as normalization is run by bitbucket
…ow-in-diff-in-atlascode
Fixes / implements #113