Repository navigation
Add indented-code-wrapping feature - #1989
Conversation
|
Temporarily blocked by lukechilds/github-custom-tab-size#3. |
|
Need to look into performance of the code, test it out more on ajaxed diff tables in PR files and reviews, decide on name of this feature, and can then only this PR should be good to go. |
fregante
left a comment
There was a problem hiding this comment.
A few last changes I think.
In PR Files, files can be loaded asynchronously so we need to listen to that. Look at raw-file-link to see how to implement it. Can you pull out that function into on-pr-file-load.ts?
|
Can you commit to maintain this feature going forward? For example, in case GitHub changes something that breaks it. We already have way too many features to maintain, so we need to find a way to make this sustainable. If so, can you add a line to CODEOWNERS? |
I would be glad to, and yes I added my name to the list. Thanks! |
…style Because for some unknown reason in this world, using `!important` or overriding and elements `style` which already has `!important` applied doesn't work from JS. Debuggers work, but not JS. 🤷
Done.
I have no idea how changing this would affect other features. Ideally all layout changes should be done under 50ms (just a random value off the top of my head). How about lowering the delay instead of dropping it. |
| line-height: 21px; /* Compensation for block-ifying table cells */ | ||
| } | ||
|
|
||
| .rgh-code-wrapping-enabled .blob-code-hunk, /* Wrap code eagerly to avoid layout changes later */ |
There was a problem hiding this comment.
- add a
rgh-softwrapped-codeclass onbodyto enable regular wrapping on all elements before the rest of the javascript runs;
This should do the task, but I'm assuming this might affect fragment-targeted-link-loading (changing layout after page load might move the page over the desired view).
|
Is GitHub testing soft-wrapping? I don't remember seeing these CSS classes before. Test PR: sindresorhus/awesome-lint#82 |
1. Open https://github.com/sindresorhus/refined-github/pull/1881/files 2. Notice minimal layout change when the page stops loading
1. Open refined-github#1881 2. Expand add-co-authored-by.tsx 3. Notice no indentation change in the "Suggested change" diff
|
Last note: mixed indentation will break even after the suggested fix a few weeks ago. If Random indentation however should worry us, it should look broken. I think the current implementation still works correctly for "accettable" mixed indentation, like: -> -webkit-transform: none;
-> ••••••••transform: none; |
|
Thanks @notlmn! I think will make the code more readable and is more performant than what I would have come up with 🏎 |
|
Not sure if it's just that I haven't properly looked around, but is there any possibility to disable the soft-wrapping introduced here in unified view ? It's annoying the hell out of me (I can understand though that some may prefer that). So introducing a button or something to toggle on / off the soft-wrapping. Can make a new issue if needed. Thanks. |
|
All the JavaScript features can already be disabled in the options. This one is called |
|
Awesome, didn't see the field in the extension's config. Is there a list somewhere of all the extensions names (Just being curious) ? :} Thanks. |
|
In the options itself there’s a link to the list |
|
Can you add this to the readme? It needs simple before/after screenshot (copy-pasted arrows/test from https://user-images.githubusercontent.com/1402241/34438653-f66535a4-ecda-11e7-9406-2e1258050cfa.png) |




Closes #1908
Uses JS to detect number of spaces at the start of each line, and then uses CSS to move the block forward.
PRs to test
PR conversations and files (dynamically loaded comments, review, and files)
PRs with suggestions