summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/ClangDMain.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Rename ClangDMain.cpp -> ClangdMain.cpp, NFCKrasimir Georgiev2017-04-121-122/+0
| | | | llvm-svn: 300077
* [clangd] Remove ASTUnits for closed documents and cache CompilationDatabase ↵Krasimir Georgiev2017-04-101-1/+3
| | | | | | | | | | per directory. Contributed by ilya-biryukov! Differential Revision: https://reviews.llvm.org/D31746 llvm-svn: 299843
* [clangd] Add code completion supportKrasimir Georgiev2017-04-041-0/+2
| | | | | | | | | | | | | | Summary: Adds code completion support to clangd. Reviewers: bkramer, malaperle-ericsson Reviewed By: bkramer, malaperle-ericsson Subscribers: stanionascu, malaperle-ericsson, cfe-commits Differential Revision: https://reviews.llvm.org/D31328 llvm-svn: 299421
* [clangd] Fix not being able to attach a debugger on macOSBenjamin Kramer2017-03-141-0/+4
| | | | | | | | | | | | | | | | | | | | | Clangd is often waiting for input on getline as it awaits requests. If the getline is interrupted, it causes the system call (read) to fail and the EINTR error to be set. This can be seen when attaching a debugger such as LLDB on macOS. On macOS (and possibly other operating systems), this system call is not restarted after interruption but on Linux it is restarted which is why attaching a debugger does work correctly there. The solution is to work around the non-restarting system call by checking the errno for EINTR when the stream fails and try again. This should be safe on all Unixish platforms. See also http://bugs.llvm.org/show_bug.cgi?id=32149 for some background discussion. Patch by Marc-Andre Laperle! Differential Revision: https://reviews.llvm.org/D30675 llvm-svn: 297779
* [clangd] Add support for FixIts.Benjamin Kramer2017-03-011-2/+11
| | | | | | | | | | | | | | | | | | | 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
* [clangd] Implement format on typeKrasimir Georgiev2017-02-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds onTypeFormatting to clangd. The trigger character is '}' and it works by scanning for the matching '{' and formatting the range in-between. There are problems with ';' as a trigger character, the cursor position is before the `|`: ``` int main() { int i;| } ``` becomes: ``` int main() { int i;| } ``` which is not likely what the user intended. Also formatting at semicolon in a non-properly closed scope puts the following tokens in the same unwrapped line, which doesn't reformat nicely. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29990 llvm-svn: 295304
* [clangd] Synchronize logs access.Benjamin Kramer2017-02-151-3/+2
| | | | | | | I don't think that this is necessary for correctness, but makes tsan much more useful. llvm-svn: 295194
* [clangd] Wire up ASTUnit and publish diagnostics with it.Benjamin Kramer2017-02-151-0/+3
| | | | | | | | | | | | | | Summary: This requires an accessible compilation database. The parsing is done asynchronously on a separate thread. Reviewers: klimek, krasimir Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D29886 llvm-svn: 295180
* [clangd] Move isDone from the JSONOutput to ShutdownHandler.Benjamin Kramer2017-02-101-3/+4
| | | | | | | This is just as easy to check from main but prevents random code from shutting down the server. llvm-svn: 294760
* [clangd] Refactor stream output into a single thread-safe output object.Benjamin Kramer2017-02-101-7/+12
| | | | | | | This abstracts away the passing of raw_ostreams everywhere, thread safety will be used soon. llvm-svn: 294747
* [clangd] Ignore comments in clangd input, so we can write tests without sed.Benjamin Kramer2017-02-071-0/+5
| | | | | | Another attempt on making this work on windows. llvm-svn: 294312
* [clangd] Set stdin to binary to fix tests on windows.Benjamin Kramer2017-02-071-0/+4
| | | | llvm-svn: 294297
* [clangd] Harden test against sed implementations that strip \r.Benjamin Kramer2017-02-071-5/+4
| | | | | | Also clean up logging and don't print \0. llvm-svn: 294294
* Add a prototype for clangdBenjamin Kramer2017-02-071-0/+86
clangd is a language server protocol implementation based on clang. It's supposed to provide editor integration while not suffering from the confined ABI of libclang. This implementation is limited to the bare minimum functionality of doing (whole-document) formatting and rangeFormatting. The JSON parsing is based on LLVM's YAMLParser but yet most of the code of clangd is currently dealing with JSON serialization and deserialization. This was only tested with VS Code so far, mileage with other LSP clients may vary. Differential Revision: https://reviews.llvm.org/D29451 llvm-svn: 294291
OpenPOWER on IntegriCloud