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
Add support for scriptcs, Cake, and FAKE #1035
base: main
Are you sure you want to change the base?
Conversation
#module nuget:?package=Cake.DotNetTool.Module&version=0.4.0 | ||
|
||
// @OctoLinkerResolve(https://www.nuget.org/packages/Cake.Coveralls) | ||
#addin "nuget:https://api.nuget.org/v3/index.json?package=Cake.Coveralls&version=0.10.1" |
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.
@stefanbuck I'm having trouble getting these lines to work as I wanted.
I was trying to make everything after #module
& #addin
the link so you didn't have to search for the package name in the url, but GitHub's parsing the lines with a full url and everything after //
is in a span so no link gets injected.
Is there a way to support making that whole value a link or are we stuck with making just the package name the link?
This is the file I was testing against https://github.com/cake-build/cake/blob/develop/build.cake.
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.
This sounds similar to an issue I'm currently facing getting PHP / laravel support in.
<td>
<span class="pl-k">use</span><span data-rgh-whitespace="space"> </span><span class="pl-v">Illuminate</span>\<span class="pl-v">Contracts</span>\<span class="pl-v">Container</span>\<span class="pl-v">Container</span>;
</td>
Yesterday, I spent two hours try to come up with a solution without luck. It's mainly a lack of support for such markup in https://github.com/padolsey/findAndReplaceDOMText which we use in the insert-link
package.
I've noticed that refined-github is able to wrap the url in your case. If we find a solution we should make sure it doesn't conflict with refined-github
which is a widely used extension as well.
Is this a blocker for you? Maybe best to ignore it for now and investigate into it separately.
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.
No not a blocker. I can have just the package name be the link until we find a better solution.
95e5994
to
621fa4a
Compare
My other PR was failing as well for some odd reason. After rebasing it passed |
621fa4a
to
71940b7
Compare
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.
Overall looks great. I left one comment about a potential optimization
e2e/automated.test.js
Outdated
} catch (ex) { | ||
process.stdout.write( | ||
`\n::error file=${file},line=${lineNumber}::${ex.message}\n`, | ||
); |
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.
😍
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 think a console.log
should work here too. That way you can get rid of the newline operator.
resolve(path, [target]) { | ||
// this reference doesn't resolve to anything | ||
if (target === './.fake/build.fsx/intellisense.fsx') { | ||
return []; |
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.
Just to share some insights, you can use undefined
as a return value as well. Just saying, no need to change 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.
@stefanbuck I just tried return;
and return undefined;
and both give me an error. I guess that's why I was using an empty array here.
Uncaught (in promise) TypeError: Cannot read property 'registry' of undefined
at app.js:41806
at Array.map (<anonymous>)
at app.js:41795
at app.js:40329
at Array.map (<anonymous>)
at run (app.js:40322)
at app.js:40355
at gitHubInjection (app.js:15027)
at init (app.js:40350)
The error points back to this line
if (url.registry) { |
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.
Ohh sorry for pointing you into the wrong direction. I guess there is some value in having a consistent return type 😉
return []; | ||
} | ||
|
||
return [relativeFile({ path, target }), nugetResolver({ target })]; |
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.
The signature of the resolve
handler is resolve(path, target, meta, regExp)
.
Side note: Meta defaults to an empty object and is used in the context of plugin-npm-manifest.
What I want to talk about is the fourth argument regExp
which is the matching RegExp from line 29. In my PHP PR I make use of this to use different resolvers
OctoLinker/packages/plugin-php/index.js
Lines 7 to 13 in 87a137a
resolve(path, [target], meta, regExp) { | |
if (target.includes('\\')) { | |
return; | |
} | |
if (regExp === PHP_FUNC) { | |
return liveResolverQuery({ |
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.
That's awesome, I'll have to revisit some of the css & dotnet things I was working on because I'm pretty sure I'll be able to simplify them by checking the regex.
5bccd42
to
fc58fe0
Compare
Once this is merged a PR needs to be sent to fsprojects/awesome-fsharp#125 adding OctoLinker to the list. |
Checklist:
Example files: