Skip to content

Added Suppress rule for this line / Suppress rule for file quick actions / Show documentation#530

Merged
dbaeumer merged 5 commits intomicrosoft:masterfrom
loune:disable-eslint
Oct 19, 2018
Merged

Added Suppress rule for this line / Suppress rule for file quick actions / Show documentation#530
dbaeumer merged 5 commits intomicrosoft:masterfrom
loune:disable-eslint

Conversation

@loune
Copy link
Contributor

@loune loune commented Aug 25, 2018

eslint

  • Added show documentation quick action

  • Fix possible issue with incorrect command run when 2 rule single fixes are available. This is due to CommandIds.applySingleFix getting overriden inside commands by the last added single fix quick action. The fix is to include the ruleId in the key when adding to commands.

Fix possible issue with incorrect command run when 2 rule single fixes are available
@msftclas
Copy link

msftclas commented Aug 25, 2018

CLA assistant check
All CLA requirements met.

@loune
Copy link
Contributor Author

loune commented Aug 29, 2018

@dbaeumer any chance this could be merged? Thanks

}

// cache documentation urls for all rules
ruleDocUrls.clear();
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to cache this on every validate which is actually run very frequently or could we cache this once on only clear the cache if the .eslintrc file changes?

CommandIds.applyAutoFix,
CommandIds.applyDisableLine,
CommandIds.applyDisableFile,
CommandIds.openRuleDoc,
Copy link
Member

Choose a reason for hiding this comment

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

This is not necessary since the is sent from the server to the client and not the other way.

Copy link
Member

Choose a reason for hiding this comment

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

I mean CommandIds.openRuleDoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I removed this, the quick action for Show documentation stopped working. I think if we don't specify it here, the command doesn't get sent from quick actions to the server.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. I misunderstood what you wanted to achieve

let workspaceChange = new WorkspaceChange();
workspaceChange.getTextEditChange({uri, version: documentVersion}).add(createTextEdit(editInfo));
commands.set(CommandIds.applySingleFix, workspaceChange);
let lineText = textDocument.getText(Range.create(Position.create(editInfo.line - 1, 0), Position.create(editInfo.line - 1, 255)));
Copy link
Member

Choose a reason for hiding this comment

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

You can use Integer.MAX_VALUE here instead of 255 to be on the save side. Will have the same effect.

@@ -181,7 +198,8 @@ interface AutoFix {
label: string;
Copy link
Member

Choose a reason for hiding this comment

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

Since with the change we now store problem in general per file shouldn't we rename this. Something that contains problem in the name

Copy link
Member

Choose a reason for hiding this comment

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

FixableProblem might be an idea.

@loune loune changed the title Added Suppress rule for this line / Suppress rule for file quick actions Added Suppress rule for this line / Suppress rule for file quick actions / Show documentation Oct 19, 2018
@dbaeumer
Copy link
Member

Very nice work.

@dbaeumer dbaeumer merged commit f040572 into microsoft:master Oct 19, 2018
@loune
Copy link
Contributor Author

loune commented Oct 19, 2018

Thanks @dbaeumer !

@loune loune deleted the disable-eslint branch October 19, 2018 11:40
@dbaeumer
Copy link
Member

I did some minor tweaks. One thing I forgot about is that different files can have different .eslintrc files (in different workspace folders) so we need to remember the rules per file. Changed this and pushed.

Will publish a new version of ESLint beginning of next week.

@Friksel
Copy link

Friksel commented Nov 5, 2018

Great improvement! Thanks a lot for this!

@TimShilov
Copy link

TimShilov commented Nov 6, 2018

Is there an option to hide those additional menu items?
I usually don't suppress rules at all and I don't need the Documentation links
When I open Light Bulb menu I want to only see recommendations and for me those new menu items are just noise.
default

@dbaeumer
Copy link
Member

dbaeumer commented Nov 6, 2018

Actually that is a fair request. @loune would you be willing to add such a setting ?

@loune
Copy link
Contributor Author

loune commented Nov 8, 2018

Sure, I can have a look at adding a setting.

@alexiosd
Copy link

Hello, great addition, but what happened to Fix All of a specific problem?
The Fix all auto-fixable problems could be problematic if you don't know what it will fix.

thank you.

@loune
Copy link
Contributor Author

loune commented Nov 18, 2018

@alexiosd this patch shouldn't change how Fix All of a specific problem works. I'll see what's wrong with that as well.

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.

6 participants