-
Notifications
You must be signed in to change notification settings - Fork 56
added code actions for disabling theme-check rules #1057
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
base: main
Are you sure you want to change the base?
Conversation
eda6b09 to
142ef1c
Compare
packages/theme-language-server-common/src/codeActions/providers/DisableCheckProvider.ts
Outdated
Show resolved
Hide resolved
| case 'next-line': { | ||
| let existingCommentLine = -1; | ||
|
|
||
| for (let i = lineNumber - 1; i >= Math.max(0, lineNumber - 5); i--) { |
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.
what's with these numbers? Why are we deducting -5 from lineNumber?
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.
Initially, I thought of only looking at maximum 5 lines above the current line because I didn't think people would write more than 5 lines of whitespace, but I now that I think of it, devs should do anything they want.
(same on line 88)
packages/theme-language-server-common/src/commands/providers/ApplyDisableCheckProvider.ts
Show resolved
Hide resolved
| const { textDocument } = document; | ||
|
|
||
| const isInLiquidTag = this.isInLiquidTagContext( | ||
| document as AugmentedLiquidSourceCode, |
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.
| document as AugmentedLiquidSourceCode, | |
| document, |
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.
See previous comment
28600e9 to
574b199
Compare
574b199 to
b0e517b
Compare

What are you adding in this PR?
Solves #432
Added a new code action provider that allows users to disable Theme Check rules in the quick fix menu. This feature adds two types of actions:
{% # theme-check-disable-next-line CheckName %}comment above the line with the offense{% # theme-check-disable CheckName %}comment at the top of the fileWhat's next? Any followup issues?
What did you learn?
Working with code actions requires careful handling of cursor position and document ranges. It's important to filter duplicate actions when multiple offenses of the same type exist on the same line to avoid cluttering the quick fix menu.
Before you deploy
changeset