summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Protocol.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Handle InitializeParams and store rootUriMarc-Andre Laperle2017-09-271-0/+57
| | | | | | | | | | | | | | | | | | | Summary: The root Uri is the workspace location and will be useful in the context of indexing. We could also add more things to InitializeParams in order to configure Clangd for C/C++ sepecific extensions. Reviewers: ilya-biryukov, bkramer, krasimir, Nebiroth Reviewed By: ilya-biryukov Subscribers: ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D38093 llvm-svn: 314309
* [clangd] Introduced Logger interface.Ilya Biryukov2017-09-201-62/+64
| | | | | | | | | | | | | | Summary: This fixes a bunch of logging-related FIXMEs. Reviewers: bkramer, krasimir, malaperle Reviewed By: malaperle Subscribers: malaperle, klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D37972 llvm-svn: 313730
* [clangd] Fix codeAction not decoded properly when sent from some clientsMarc-Andre Laperle2017-09-181-58/+87
| | | | | | | | | | | | | | | | | | | | 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
* [clangd] Add support for snippet completionsIlya Biryukov2017-09-121-2/+2
| | | | | | | | | | | | | | Enhances CompletionItemsCollector in such a way that snippet completions can be presented to the client. Enable snippet completion items by specifying -enable-snippets while invoking the clangd executable. See: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#completion-request See: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/browser/snippet.md Patch by Raoul Wols. llvm-svn: 313029
* [clangd] Run clang-format on all clangd sources. NFC.Ilya Biryukov2017-08-021-5/+2
| | | | llvm-svn: 309801
* [clangd] Add support for per-file extra flagsKrasimir Georgiev2017-07-061-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to specify user-defined extra flags per opened file through the LSP layer. This is a non-standard extension to the protocol. I've already created a feature request about it for upstream lsp: https://github.com/Microsoft/language-server-protocol/issues/255 The particular use-case is ycmd, which has a python script for figuring out extra flags per file: https://github.com/Valloric/ycmd#flagsforfile-filename-kwargs- Reviewers: ilya-biryukov, klimek, bkramer Reviewed By: ilya-biryukov Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34947 llvm-svn: 307241
* [clangd] Add "Go to Declaration" functionalityMarc-Andre Laperle2017-06-281-1/+9
| | | | | | | | | | | | | | | | Summary: This change allows to navigate to most identifiers' declarations in code. This is a first step towards implementing "Go to Definition". It reuses clangIndex in order to detect which occurrences corresponds to the position requested. The occurrences' Decls are then used to generate locations suitable for navigating to the declarations. Reviewers: krasimir, bkramer, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34269 llvm-svn: 306558
* [Clangd] Failed to decode params using 1.x-compatible request messageBenjamin Kramer2017-04-211-1/+1
| | | | | | | | | | | | | | | | | | textDocument/completion sends a TextDocumentPositionParams message in the 2.x and 3.x. But in 1.x it was instead a TextDocumentPosition with inlined parameters. This means that the "uri" field is at the top level and not in textDocument. Because of this, some clients that maintain compability with 1.x have both uri and textDocument.uri. Clangd, however, early returns in the presence of anything but 'textDocument' or 'position' which prevents a client compatible with both 3.x and 1.x to work correctly. If Clangd was a bit more permissive (no early return), clients implementing all the versions of the protocol would work. Patch by Marc-Andre Laperle! Differential Revision: https://reviews.llvm.org/D32238 llvm-svn: 300991
* [Clangd] Support Authority-less URIsBenjamin Kramer2017-04-211-0/+2
| | | | | | | | | | | | | Clangd strips URIs by removing the file:// part but some clients can send file: which is also valid according to RFC 3896. For example, if a client sends file:///home/user, it gets converted to /home/user but if a client sends file:/home/user, it is left untouched and problems arise. Patch by Marc-Andre Laperle! Differential Revision: https://reviews.llvm.org/D32234 llvm-svn: 300990
* [clangd] Implement item kind for completion resultsKrasimir Georgiev2017-04-111-1/+1
| | | | | | | | | | | | | | | Summary: The patch implements the conversion method from CXCursorKind to clangd::CompletionItemKind. Contributed by stanionascu! Reviewers: cfe-commits, bkramer, krasimir Reviewed By: krasimir Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D31853 llvm-svn: 299935
* [clangd] Remove ASTUnits for closed documents and cache CompilationDatabase ↵Krasimir Georgiev2017-04-101-0/+27
| | | | | | | | | | per directory. Contributed by ilya-biryukov! Differential Revision: https://reviews.llvm.org/D31746 llvm-svn: 299843
* [clangd] Extract FsPath from file:// uriKrasimir Georgiev2017-04-071-3/+38
| | | | | | | | | | | | | Patch contributed by stanionascu! rfc8089#appendix-E.2 specifies that paths can begin with a drive letter e.g. as file:///c:/. In this case just consuming front file:// is not enough and the 3rd slash must be consumed to produce a valid path on windows. The patch introduce a generic way of converting an uri to a filesystem path and back. Differential Revision: https://reviews.llvm.org/D31401 llvm-svn: 299758
* [clangd] Add code completion supportKrasimir Georgiev2017-04-041-0/+72
| | | | | | | | | | | | | | 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] Add support for FixIts.Benjamin Kramer2017-03-011-0/+113
| | | | | | | | | | | | | | | | | | | 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/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a prototype for clangdBenjamin Kramer2017-02-071-0/+412
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