2018-02-06 18:47:30 +08:00
|
|
|
# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
|
|
|
|
# Test with invalid initialize request parameters
|
2018-03-01 04:31:00 +08:00
|
|
|
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":"","rootUri":"test:///workspace","capabilities":{},"trace":"off"}}
|
2018-02-06 18:47:30 +08:00
|
|
|
# CHECK: "id": 0,
|
|
|
|
# CHECK-NEXT: "jsonrpc": "2.0",
|
|
|
|
# CHECK-NEXT: "result": {
|
|
|
|
# CHECK-NEXT: "capabilities": {
|
|
|
|
# CHECK-NEXT: "codeActionProvider": true,
|
|
|
|
# CHECK-NEXT: "completionProvider": {
|
|
|
|
# CHECK-NEXT: "resolveProvider": false,
|
|
|
|
# CHECK-NEXT: "triggerCharacters": [
|
|
|
|
# CHECK-NEXT: ".",
|
|
|
|
# CHECK-NEXT: ">",
|
|
|
|
# CHECK-NEXT: ":"
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: },
|
|
|
|
# CHECK-NEXT: "definitionProvider": true,
|
|
|
|
# CHECK-NEXT: "documentFormattingProvider": true,
|
|
|
|
# CHECK-NEXT: "documentHighlightProvider": true,
|
|
|
|
# CHECK-NEXT: "documentOnTypeFormattingProvider": {
|
|
|
|
# CHECK-NEXT: "firstTriggerCharacter": "}",
|
|
|
|
# CHECK-NEXT: "moreTriggerCharacter": []
|
|
|
|
# CHECK-NEXT: },
|
|
|
|
# CHECK-NEXT: "documentRangeFormattingProvider": true,
|
|
|
|
# CHECK-NEXT: "executeCommandProvider": {
|
|
|
|
# CHECK-NEXT: "commands": [
|
2018-02-16 22:15:55 +08:00
|
|
|
# CHECK-NEXT: "clangd.applyFix",
|
|
|
|
# CHECK-NEXT: "clangd.insertInclude"
|
2018-02-06 18:47:30 +08:00
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: },
|
[clangd] Implement textDocument/hover
Summary: Implemention of textDocument/hover as described in LSP definition.
This patch adds a basic Hover implementation. When hovering a variable,
function, method or namespace, clangd will return a text containing the
declaration's scope, as well as the declaration of the hovered entity.
For example, for a variable:
Declared in class Foo::Bar
int hello = 2
For macros, the macro definition is returned.
This patch doesn't include:
- markdown support (the client I use doesn't support it yet)
- range support (optional in the Hover response)
- comments associated to variables/functions/classes
They are kept as future work to keep this patch simpler.
I added tests in XRefsTests.cpp. hover.test contains one simple
smoketest to make sure the feature works from a black box perspective.
Reviewers: malaperle, krasimir, bkramer, ilya-biryukov
Subscribers: sammccall, mgrang, klimek, rwols, ilya-biryukov, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D35894
Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Signed-off-by: William Enright <william.enright@polymtl.ca>
llvm-svn: 325395
2018-02-17 05:38:15 +08:00
|
|
|
# CHECK-NEXT: "hoverProvider": true,
|
2018-02-06 18:47:30 +08:00
|
|
|
# CHECK-NEXT: "renameProvider": true,
|
|
|
|
# CHECK-NEXT: "signatureHelpProvider": {
|
|
|
|
# CHECK-NEXT: "triggerCharacters": [
|
|
|
|
# CHECK-NEXT: "(",
|
|
|
|
# CHECK-NEXT: ","
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: },
|
[clangd] Support incremental document syncing
Summary:
This patch adds support for incremental document syncing, as described
in the LSP spec. The protocol specifies ranges in terms of Position (a
line and a character), and our drafts are stored as plain strings. So I
see two things that may not be super efficient for very large files:
- Converting a Position to an offset (the positionToOffset function)
requires searching for end of lines until we reach the desired line.
- When we update a range, we construct a new string, which implies
copying the whole document.
However, for the typical size of a C++ document and the frequency of
update (at which a user types), it may not be an issue. This patch aims
at getting the basic feature in, and we can always improve it later if
we find it's too slow.
Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Reviewers: malaperle, ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: MaskRay, klimek, mgorny, ilya-biryukov, jkorous-apple, ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D44272
llvm-svn: 328500
2018-03-26 22:41:40 +08:00
|
|
|
# CHECK-NEXT: "textDocumentSync": 2
|
2018-02-06 18:47:30 +08:00
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
---
|
|
|
|
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
|
|
|
|
---
|
|
|
|
{"jsonrpc":"2.0","method":"exit"}
|