This is an archive of the discontinued LLVM Phabricator instance.

[mlir-lsp-server] Add support for sending diagnostics to the client
ClosedPublic

Authored by rriddle on May 11 2021, 5:34 PM.

Details

Summary

This allows for diagnostics emitted during parsing/verification to be surfaced to the user by the language client, as opposed to just being emitted to the logs like they are now.

Diff Detail

Event Timeline

rriddle created this revision.May 11 2021, 5:34 PM
rriddle requested review of this revision.May 11 2021, 5:34 PM
jpienaar accepted this revision.May 12 2021, 10:36 AM

Looks good in general thanks

mlir/include/mlir/Parser/AsmParserState.h
88

When would one do this vs just creating a new instance? (I'm assuming that is effectively what this is doing, keeping a reference constant but hollowing out - which a unique_ptr to parser state could also do)

mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
197

Not: s/lsp/LSP/ in comment text

204

It's not just conceptually :-)

218
221

Could you add comment explaining why a warning is an error when converted?

mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
416

Not: newline in between

471

Same nit

This revision is now accepted and ready to land.May 12 2021, 10:36 AM
rriddle updated this revision to Diff 344889.May 12 2021, 11:41 AM
rriddle marked 7 inline comments as done.

update

mlir/include/mlir/Parser/AsmParserState.h
88

Switched to using a r-val operator=, which is what I originally wanted but couldn't get to work yesterday for some reason.

mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
221

Oops, thanks for the catch.

mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
416

This follows the style of the rest of the file, will fix the whole thing in a followup if that's okay.

471

Same as above.