Skip to content

Conversation

@Iskaban10
Copy link

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Iskaban10! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#21979"

@Iskaban10 Iskaban10 changed the title Custom errorsink for diagnostics in json format for lsp integration Custom errorsink for diagnostics in json format Oct 15, 2025
@Iskaban10 Iskaban10 requested a review from ibuclaw as a code owner October 18, 2025 06:14
@Iskaban10 Iskaban10 changed the title Custom errorsink for diagnostics in json format Implemetation of LSP format for diagnostics in json format Oct 20, 2025
@Iskaban10 Iskaban10 changed the title Implemetation of LSP format for diagnostics in json format Implementation of LSP format for diagnostics in dmd Oct 20, 2025
Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems it would be good idea to refactor

if (global.params.v.messageStyle == MessageStyle.lsp)
            {
                printLSPDiagnostic(format, ap, info);
                return;
            }
            if (global.params.v.messageStyle == MessageStyle.sarif)
            {
                addSarifDiagnostic(loc, format, ap, kind);
                return;
            }
            printDiagnostic(format, ap, info);

and make printDiagnostic take the message style as an argument


void vdeprecationSupplemental(Loc loc, const(char)* format, va_list ap) { }
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave to newline at EOF in place

Comment on lines +26 to +27
sarif, /// JSON SARIF output, see https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html
lsp /// JSON output in Language Server protocol format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also you will probably have to update frontend.h with this change, see the CircleCI failure

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this in frontend.h?

enum class MessageStyle : uint8_t
{
    digitalmars = 0u,
    gnu = 1u,
    sarif = 2u,
    lsp = 3u,
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@Iskaban10
Copy link
Author

Thanks for the review @thewilsonator. Will make the changes.

{
int ch = num(5);
writeln(ch);
} No newline at end of file
Copy link
Contributor

@thewilsonator thewilsonator Oct 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line at end of file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants