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 dd1f805

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 29621ff commit dd1f805

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
@@ -222,7 +222,7 @@ describe('server', () => {
222222
{} as any,
223223
)
224224

225-
expect(result).toHaveLength(1)
225+
expect(result).toHaveLength(3)
226226
const codeAction = (result as CodeAction[])[0]
227227
expect(codeAction.diagnostics).toEqual([fixableDiagnostic])
228228
expect(codeAction.diagnostics).toEqual([fixableDiagnostic])

‎server/src/server.ts

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

406406
const codeActions = params.context.diagnostics
407407
.map(({ data }) => codeActionsForUri[data?.id])
408-
.filter((action): action is LSP.CodeAction=>action!=null)
408+
.flat()
409409

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

0 commit comments

Comments
(0)

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