summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clangd/fixits.test
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Send CodeAction responses to textDocument/codeAction (LSP 3.8)Sam McCall2018-10-161-210/+0
| | | | | | | | | | | | | | Summary: I don't bother mirroring the full capabilities struct, just parse the bits we care about. I'll send a new patch to use this approach elsewhere too. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53213 llvm-svn: 344617
* [clangd] send diagnostic categories only when 'categorySupport'Alex Lorenz2018-08-221-1/+0
| | | | | | | | | | | | capability was given by the client After r339738 Clangd started sending categories with each diagnostic, but that broke the eglot client. This commit puts the categories behind a capability to fix that breakage. Differential Revision: https://reviews.llvm.org/D51077 llvm-svn: 340449
* [clangd] add an extension field to LSP to transfer the diagnostic's categoryAlex Lorenz2018-08-141-0/+1
| | | | | | | | | This patch adds a 'category' extension field to the LSP diagnostic that's sent by Clangd. This extension is always on by default. Differential Revision: https://reviews.llvm.org/D50571 llvm-svn: 339738
* [clangd] capitalize diagnostic messagesAlex Lorenz2018-08-031-3/+3
| | | | | | | | | The diagnostic messages that are sent to the client from Clangd are now always capitalized. Differential Revision: https://reviews.llvm.org/D50154 llvm-svn: 338919
* [clangd] Revamp handling of diagnostics.Ilya Biryukov2018-03-121-34/+6
| | | | | | | | | | | | | | | | Summary: The new implementation attaches notes to diagnostic message and shows the original diagnostics in the message of the note. Reviewers: hokein, ioeric, sammccall Reviewed By: sammccall Subscribers: klimek, mgorny, cfe-commits, jkorous-apple Differential Revision: https://reviews.llvm.org/D44142 llvm-svn: 327282
* [clangd] Support simpler JSON-RPC stream parsing for lit tests.Sam McCall2018-02-061-249/+238
| | | | | | | | | | | | | | Summary: Instead of content-length, we delimit messages with ---. This also removes the need for (most) dos-formatted test files. Reviewers: ioeric Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D42919 llvm-svn: 324333
* [clangd] Add a test URI scheme for lit tests to unbreak platform-specific ↵Eric Liu2018-01-311-10/+10
| | | | | | | | | | | | | | | | URI failures. Summary: This should also fix the current windows buildbot breakage (http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/9838/steps/ninja%20check%201/logs/stdio) Reviewers: sammccall Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D42735 llvm-svn: 323885
* [clangd] Emit ranges for clangd diagnostics, and fix off-by-one positionsSam McCall2017-12-131-7/+7
| | | | | | | | | | | | | | | | | | | Summary: - when the diagnostic has an explicit range, we prefer that - if the diagnostic has a fixit, its RemoveRange is our next choice - otherwise we try to expand the diagnostic location into a whole token. (inspired by VSCode, which does this client-side when given an empty range) - if all else fails, we return the zero-width range as now. (clients react in different ways to this, highlighting a token or a char) - this includes the off-by-one fix from D40860, and borrows heavily from it Reviewers: rwols, hokein Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41118 llvm-svn: 320555
* Adds a json::Expr type to represent intermediate JSON expressions.Sam McCall2017-11-061-15/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This form can be created with a nice clang-format-friendly literal syntax, and gets escaping right. It knows how to call unparse() on our Protocol types. All the places where we pass around JSON internally now use this type. Object properties are sorted (stored as std::map) and so serialization is canonicalized, with optional prettyprinting (triggered by a -pretty flag). This makes the lit tests much nicer to read and somewhat nicer to debug. (Unfortunately the completion tests use CHECK-DAG, which only has line-granularity, so pretty-printing is disabled there. In future we could make completion ordering deterministic, or switch to unittests). Compared to the current approach, it has some efficiencies like avoiding copies of string literals used as object keys, but is probably slower overall. I think the code/test quality benefits are worth it. This patch doesn't attempt to do anything about JSON *parsing*. It takes direction from the proposal in this doc[1], but is limited in scope and visibility, for now. I am of half a mind just to use Expr as the target of a parser, and maybe do a little string deduplication, but not bother with clever memory allocation. That would be simple, and fast enough for clangd... [1] https://docs.google.com/document/d/1OEF9IauWwNuSigZzvvbjc1cVS1uGHRyGTXaoy3DjqM4/edit +cc d0k so he can tell me not to use std::map. Reviewers: ioeric, malaperle Subscribers: bkramer, ilya-biryukov, mgorny, klimek Differential Revision: https://reviews.llvm.org/D39435 llvm-svn: 317486
* [clangd] Handle clangd.applyFix server-sideMarc-Andre Laperle2017-11-031-3/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: When the user selects a fix-it (or any code action with commands), it is possible to let the client forward the selected command to the server. When the clangd.applyFix command is handled on the server, it can send a workspace/applyEdit request to the client. This has the advantage that the client doesn't explicitly have to know how to handle clangd.applyFix. Therefore, the code to handle clangd.applyFix in the VS Code extension (and any other Clangd client) is not required anymore. Reviewers: ilya-biryukov, sammccall, Nebiroth, hokein Reviewed By: hokein Subscribers: ioeric, hokein, rwols, puremourning, bkramer, ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D39276 llvm-svn: 317322
* [clangd] Handle exit notification (proper shutdown)Ilya Biryukov2017-10-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This changes the onShutdown handler to do essentially nothing (for now), and instead exits the runloop when we receive the exit notification from the client. Some clients may wait on the reply from the shutdown request before sending an exit notification. If we exit the runloop already in the shutdown request, a client might block forever. This also gives us the opportunity to do any global cleanups and/or serializations of PCH preambles to disk, but I've left that out for now. See the LSP protocol documentation for details. Reviewers: malaperle, krasimir, bkramer, sammccall, ilya-biryukov Reviewed By: malaperle, sammccall, ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38939 llvm-svn: 316564
* [clangd] less boilerplate in RPC dispatchSam McCall2017-10-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make the ProtocolHandlers glue between JSONRPCDispatcher and ClangdLSPServer generic. Eliminate small differences between methods, de-emphasize the unimportant distinction between notifications and methods. ClangdLSPServer is no longer responsible for producing a complete JSON-RPC response, just the JSON of the result object. (In future, we should move that JSON serialization out, too). Handler methods now take a context object that we may hang more functionality off in the future. Added documentation to ProtocolHandlers. Reviewers: ilya-biryukov, bkramer Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38464 llvm-svn: 315577
* [clangd] Fix codeAction not decoded properly when sent from some clientsMarc-Andre Laperle2017-09-181-0/+6
| | | | | | | | | | | | | | | | | | | | Summary: Fix for bug https://bugs.llvm.org/show_bug.cgi?id=34559 Also log unknown fields instead of aborting the JSON parsing because it's common that new optional fields are added either in new versions of the protocol or extensions. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D37754 llvm-svn: 313536
* Revert "XFAIL clangd tests on Windows"Reid Kleckner2017-04-101-2/+0
| | | | | | This reverts r299849, apparently these tests only fail on my machine. llvm-svn: 299850
* XFAIL clangd tests on WindowsReid Kleckner2017-04-101-0/+2
| | | | | | They all assert. Filed as PR32596. llvm-svn: 299849
* [clangd] Add support for FixIts.Benjamin Kramer2017-03-011-0/+22
Summary: This uses CodeActions to show 'apply fix' actions when code actions are requested for a location. The actions themselves make use of a clangd.applyFix command which has to be implemented on the editor side. I included an implementation for vscode. This also adds a -run-synchronously flag which runs everything on the main thread. This is useful for testing. Reviewers: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30498 llvm-svn: 296636
OpenPOWER on IntegriCloud