Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9f94f89

Browse files
feat(shellcheck): add code actions to disable rule
Implements #933. Always add a code action to disable a given diagnostic for a given line or for the whole file. This patch handles: * indentation * existing directive. It also sorts the disable directives if any * multi-line command Add corresponding tests. Signed-off-by: Thomas Faivre <thfaivre@gmail.com>
1 parent aec18c7 commit 9f94f89

File tree

4 files changed

+2274
-69
lines changed

4 files changed

+2274
-69
lines changed

‎server/src/__tests__/server.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('server', () => {
216216
{} as any,
217217
)
218218

219-
expect(result).toHaveLength(1)
219+
expect(result).toHaveLength(3)
220220
const codeAction = (result as CodeAction[])[0]
221221
expect(codeAction.diagnostics).toEqual([fixableDiagnostic])
222222
expect(codeAction.diagnostics).toEqual([fixableDiagnostic])

‎server/src/server.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export default class BashServer {
398398

399399
const codeActions = params.context.diagnostics
400400
.map(({ data }) => codeActionsForUri[data?.id])
401-
.filter((action): action is LSP.CodeAction=>action!=null)
401+
.flat()
402402

403403
logger.debug(`onCodeAction: found ${codeActions.length} code action(s)`)
404404

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /