• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EduardSergeev / vscode-haskutil / 5984201582

26 Aug 2023 10:10AM UTC coverage: 92.845% (-3.3%) from 96.173%
5984201582

push

github

web-flow
Fix operator import

- Do not add `(..)` when adding import for operators

158 of 200 branches covered (0.0%)

1 of 1 new or added line in 1 file covered. (100.0%)

558 of 601 relevant lines covered (92.85%)

10.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.36
/src/features/topLevelSignatureProvider.ts
1
'use strict';
2

3
import { CodeActionProvider, Disposable, TextDocument, Range, CodeActionContext, CancellationToken, CodeAction, WorkspaceEdit, CodeActionKind } from 'vscode';
1✔
4
import * as vscode from 'vscode';
1✔
5

6

7
export default class TopLevelSignatureProvider implements CodeActionProvider {
1✔
8
  private static commandId: string = 'haskell.addTopLevelSignature';
1✔
9

10
  public activate(subscriptions: Disposable[]) {
11
    const command = vscode.commands.registerCommand(TopLevelSignatureProvider.commandId, this.runCodeAction, this);
1✔
12
    subscriptions.push(command);
1✔
13
  }
14

15
  public async provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): Promise<any> {
16
    const pattern = /Top-level binding with no type signature:\s+([^]+)/;
13✔
17
    const codeActions = [];
13✔
18
    for (const diagnostic of context.diagnostics) {
13✔
19
      const match = pattern.exec(diagnostic.message);
25✔
20
      if (match === null) {
25✔
21
        continue;
23✔
22
      }
23

24
      const signature = match[1].trim();
2✔
25
      const title = `Add: ${signature}`;
2✔
26
      const codeAction = new CodeAction(title, CodeActionKind.QuickFix);
2✔
27
      codeAction.command = {
2✔
28
        title: title,
29
        command: TopLevelSignatureProvider.commandId,
30
        arguments: [
31
          document,
32
          signature,
33
          diagnostic.range
34
        ]
35
      };
36
      codeAction.diagnostics = [diagnostic];
2✔
37
      codeActions.push(codeAction);
2✔
38
    }
39
    return codeActions;
13✔
40
  }
41

42
  private runCodeAction(document: TextDocument, signature: string, range: Range): Thenable<boolean> {
43
    const edit = new WorkspaceEdit();
×
44
    edit.insert(document.uri, range.start, `${signature}\n`);
×
45
    return vscode.workspace.applyEdit(edit);
×
46
  }
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc