Clang language server - SkorikSergey/Language-servers-test-plan GitHub Wiki
- Create workspace from the C++ stack with console-cpp-simple project.
- Enable Clangd language server in the Installers tab and start the workspace.
- Create "hello.cc" file with content:
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
return 0;
}
- Create “iseven.h” file with content:
#ifndef VARIABLE
#define VARIABLE
int isEven(int arg);
#endif
- Create "iseven.cpp" with content:
int isEven(int x) {
return x % 2 == 0;
}
- Create "hello.cpp" with content:
#include <iostream>
#include "iseven.h"
void test(int);
int main()
{
int x = 4;
std::cout << "Hello World!" << std::endl;
std::cout << isEven(x) << std::endl;
return 0;
}
- Language server initialization
- From the project open "hello.cc" file.
- Check
Finished language servers initialization, file path '/console-cpp-simple/hello.ccmessage in the dev-machine console.
- Code validation feature, Autocomplete feature
- Open "hello.cc" file.
- Add a new line in line 6. Type
std::. Make sure that error marker withexpected unqualified-idmessage appears. - Type
std::couand launch code assistant by Ctrl+Space. Selectcout outstreamfrom the proposal menu. Type<< "Hello World!;"Make sure that there is no any errors. - Erase
std::. Make sure that error marker appears in line 6. Addusing namespace std;in the line 2. 5. Make sure that there is no any errors.
- Find definition feature
- Open "hello.cpp" file.
- Set cursor to 10:20 position and invoke Assistant -> Find Definition. The "iseven.h" file should be opened and add function should be selected.
- Close the "iseven.h" file. Repeat previous step using F4 key instead of Assistant -> Find Definition invocation.
- Comment line
- Open "hello.cc" file.
- Move cursor in line 5 position and comment this line by Ctrl+/ buttons.
- Check that text in line 3 was changed from
std::cout << "Hello World!" << std::endl;to// std::cout << "Hello World!" << std::endl;. - Uncomment this line by Ctrl+/ buttons.
- Format code feature
- Open "hello.cpp" file.
- Select all text on line 8.
- Start Format option from context menu in the Editor;
- Check that the file content after formatting selected code was changed to:
int x = 4;- Open "iseven.cpp" file.
- Start Format option from context menu.
- Check that the file content after full file formatting was changed to:
int isEven(int x) { return x % 2 == 0; }Rename
- Open "hello.cpp" file.
- Select "x" variable.
- Start Rename feature by Shift+F6 or from Assistant menu.
- Type new variable name.
- Check that the variable name was changed.
Signature Help
- Open "hello.cpp" file.
- Add a new line in line 8 and type
isEven. - Type '(' symbol and wait for hover popup with
isEven(int arg)->inttext. - Delete added line.