-
Notifications
You must be signed in to change notification settings - Fork 97
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
Enforce code style via linter (part of #446) #448
Conversation
I had thought it would be good to set up a test framework prior to making "big changes" but the extension does still seem to work at this point. I have no experience as to whether linters are likely to break working code. |
The reason
Yes, otherwise we will need to rebase and resolve conflicts.
Indeed that would be good but it will take time until we have a good test overage.
I believe that |
Something is happening -- and it certainly took some time.
The I haven't done any significant testing yet and I would want to spend some time on it because there were quite a few non-automatic changes and I may have introduced errors (particularly around |
I think we need to add: {
"env": {
"node": true,
"es6": true
}
} in the
I can't understand why we do such things: Promise.resolve(void 0)
.then(() => vscode.commands.executeCommand('vscode.open', resource))
.then(() => void 0)
public async execute(args: OpenDocumentLinkArgs) {
// ...
await vscode.commands.executeCommand('vscode.open', resource)
return
} That's almost what the Markdown plugin is doing: https://github.com/microsoft/vscode/blob/2f33470e28c1a3440b2c5e0ea9205b1d0a1e6f1b/extensions/markdown-language-features/src/commands/openDocumentLink.ts#L66-L82 |
@danyill I've replaced |
I've also enabled GitHub Action CI workflow (lint and compile) on pull requests |
Thank you, that's marvellous. I'd like to spend an hour or two on the weekend seeing if I can find obvious flaws and then hopefully we can merge a few things. |
I did some tests.
In general things seem to be working OK, somewhat obscured by the number of bugs and usability issues on various features. If you're happy with this PR @Mogztter feel free to merge away otherwise I'll be happy to look into any aspect in more detail. |
From what I seen in the code (before your changes) it won't work because the regular expressions are designed to work with Markdown syntax (not AsciiDoc syntax). asciidoctor-vscode/src/features/documentLinkProvider.ts Lines 53 to 55 in 74bce1d
If you can confirm what exactly is not working with links (to make sure that this is related to existing issues) that would be great. Then, I think we can safely merge this pull request. Great work 🎉 |
Ah yes, those too.
I was thinking of links in the WebView which I think used to work...
…On Sat, 25 Sep 2021, 21:51 Guillaume Grossetie, ***@***.***> wrote:
Check that links work correctly (FAIL they don't but I think there are
issues logged about this so I haven't fixed here)
From what I seen in the code (before your changes) it won't work because
the regular expressions are designed to work with Markdown syntax (not
AsciiDoc syntax).
https://github.com/asciidoctor/asciidoctor-vscode/blob/74bce1d292f36a1672d6df608d1aa4d1e8a85720/src/features/documentLinkProvider.ts#L53-L55
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFEXX6U3ID252DH4XSRDE3UDWLRDANCNFSM5EIJKHVQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I've had a look, I think it's unrelated. Links within the preview were only recently added (see #397 and #400) and worked fine previously. I think the Webview is now handled differently due to upstream changes and file links end up with a prefix of asciidoctor-vscode/src-preview/index.ts Lines 143 to 155 in 74bce1d
At least half a fix looks something like the following where we make sure we don't pass through file links and then ensure that it is handled by VS code to resolve. let hrefText = node.getAttribute('data-href');
if (!hrefText) {
// Pass through known schemes
if (passThroughLinkSchemes.some((scheme) => node.href.startsWith(scheme) && !node.href.startsWith('https://file+.vscode-resource.vscode-webview.net/'))) {
return;
}
hrefText = node.getAttribute('href');
}
// If original link doesn't look like a url, delegate back to VS Code to resolve
if (!/^[a-z\-]+:/i.test(hrefText) || hrefText.startsWith('http://https//file+.vscode-resource.vscode-webview.net')) {
messaging.postMessage('clickLink', { href: hrefText });
event.preventDefault();
event.stopPropagation();
return;
} I'll look into this as part of #435. |
Perfect, then we are good to go 😀 |
This will eventually close #446 but is draft for now.
Updating dependencies to use
standard
for lining has resulted inpackage-lock
being rewritten to a new version.Immediate output is:
3242 problems
.After auto-fixing we get
1269 problems
.Most seem to be spaces and tabs and things which are never used.
I'm happy to go through these.
I guess ideally we would wait until we had no open PRs before doing something like this but this PR just allows us to understand the implications.
WDYT?