Skip to content

Commit 9f94f89

Browse files
committed
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 <[email protected]>
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

+1-1
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

+1-1
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)