Skip to content
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

Fix whole of style (Extends #361) #474

Merged
merged 4 commits into from
Nov 30, 2020
Merged

Fix whole of style (Extends #361) #474

merged 4 commits into from
Nov 30, 2020

Conversation

Ikuyadeu
Copy link
Member

@Ikuyadeu Ikuyadeu commented Nov 29, 2020

What problem did you solve?

#361 was too large to solve all issues.
This PR only apply the easy fix, and I gave up that fixing all rule violation once, especially for the any value warnings.
I want to fix remained violations in another issue, after merge this.

I confirmed that fixing current new functions source code readability is very hard work.
This PR can be the first step to keeping this extension maintainability

Next TODO:

  • Refactor any values it can be object

    • extension.ts
    • rHelpPanel.ts
    • RHelpProviderBuiltin.ts
    • rstudioapi.ts
    • session.ts
    • test/suite/index.ts
  • Simplify extension.ts

    • Remove goto label it can be simple for statement
    • Move Rmd functions to another file

@Ikuyadeu
Copy link
Member Author

Ikuyadeu commented Nov 29, 2020

Could someone review this?
I think this change has no impact on the code behavior, but I want to someones check.

@Ikuyadeu Ikuyadeu mentioned this pull request Nov 29, 2020
4 tasks
@@ -20,7 +20,7 @@ suite('Extension Tests', () => {
y
}
`.split('\n');
function f(i) {return (doc[i]); }
function f(i: number) { return (doc[i]); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here on my side, eslint complains about the use of the deprecated assert.equal:

image

Should we do anything about it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your point.
Maybe it is not eslint, it is a typescript function alert.
But It's good timing, I'll fix it to assert.strictEqual

@renkun-ken
Copy link
Member

I go through the changes and all look good. Tested on macOS and everything works well.

Comment on lines -2 to +7
import * as vscode from 'vscode';
import { commands, window, QuickPickItem, Uri, Webview, WebviewPanel, WebviewOptions, WebviewPanelOnDidChangeViewStateEvent, ViewColumn } from 'vscode';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a performance benefit from importing each item explicitly or is this just a stylistic choice?

Copy link
Member Author

@Ikuyadeu Ikuyadeu Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not alerted by ESLint and performance issue, but it is useful to refactoring based on the vscode API.
In this case, we can confirm rHelpPanel.ts manage the Webview API related function.
If someone implements a related function in another file, we should combine that in this file or implement super-class

@Ikuyadeu
Copy link
Member Author

I merge this, thank you @renkun-ken and @ManuelHentschel for your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants