-
-
Notifications
You must be signed in to change notification settings - Fork 0
Support linking to packages in .[c|m]?[j|t]s[x]? files #10
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
Comments
FYI there's a dedicated extension for this, but the react code editor you see broke it a while back, so now it only works on PRs and other code embeds. |
I found this gist that works already, on ctrl-click: https://gist.github.com/kiliman/5d7a3826bc16f5967978336d026805a3 However it does not give any feedback on hover because it does the parsing on click and it does not alter the DOM. |
Ah thank you! That's great. I might make this into a separate extension - support other package managers and file paths in general. Appreciate the advice! |
The hope is to pick up Octolinker again since it already supports and parses a lot of package managers, rather than publish a brand new extension. The missing/broken part is the new React code widget parser/linkifier. I'm currently exploring what's possible, but it's not easy |
Sweet! I'll close this as not planned and look to improve upon those other solutions :) Side note: have there been any benefits of GitHub's migration to React? Just breaks things, like external extensions, but also stuff on their own site! π |
To extension developers absolutely not. For them I assume it's easier to create more interactive and faster UIs, like the file explorer. But particularly the file viewer has become insanely convoluted (not because of React though) |
As seen below!
Implementation thoughts:
/\.[c|m]?[j|t]s[x]?/
..react-code-file-contents
element..react-code-line-contents
in thereact-code-file-contents .react-code-lines
.textContent
matches regex frommlly
'sfindStaticImports
.display: inline-flex;
to the styles of the line's.react-file-line
element.span
who'stextContent
contains theparseStaticImport(lineContents).specifier
.innerHTML
with<span>'</span><a style="color: inherit;text-decoration: underline;">${import.specifier}</a><span>'</span>
.The text was updated successfully, but these errors were encountered: