[clangd] Update clangd-vscode docs to be more user-focused.

Summary: Relegate "updating the extension" docs to a separate file.

Reviewers: hokein, kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67092

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@371390 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clangd/clients/clangd-vscode/DEVELOPING.md b/clangd/clients/clangd-vscode/DEVELOPING.md
new file mode 100644
index 0000000..92aad52
--- /dev/null
+++ b/clangd/clients/clangd-vscode/DEVELOPING.md
@@ -0,0 +1,53 @@
+# Development
+
+A guide of developing `vscode-clangd` extension.
+
+## Requirements
+
+* VS Code
+* node.js and npm
+
+## Steps
+
+1. Make sure you disable the installed `vscode-clangd` extension in VS Code.
+2. Make sure you have clangd in /usr/bin/clangd or edit src/extension.ts to
+point to the binary.
+3. In order to start a development instance of VS code extended with this, run:
+
+```bash
+   $ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/
+   $ npm install
+   $ code .
+   # When VS Code starts, press <F5>.
+```
+
+# Contributing
+
+Please follow the exsiting code style when contributing to the extension, we
+recommend to run `npm run format` before sending a patch.
+
+# Publish to VS Code Marketplace
+
+New changes to `clangd-vscode` are not released until a new version is published
+to the marketplace.
+
+## Requirements
+
+* Make sure install the `vsce` command (`npm install -g vsce`)
+* `llvm-vs-code-extensions` account
+* Bump the version in `package.json`, and commit the change to upstream
+
+The extension is published under `llvm-vs-code-extensions` account, which is
+currently maintained by clangd developers. If you want to make a new release,
+please contact clangd-dev@lists.llvm.org.
+
+## Steps
+
+```bash
+  $ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/
+  # For the first time, you need to login in the account. vsce will ask you for
+    the Personal Access Token, and remember it for future commands.
+  $ vsce login llvm-vs-code-extensions
+  $ vsce publish
+```
+
diff --git a/clangd/clients/clangd-vscode/README.md b/clangd/clients/clangd-vscode/README.md
index 929dd4c..a9c35db 100644
--- a/clangd/clients/clangd-vscode/README.md
+++ b/clangd/clients/clangd-vscode/README.md
@@ -1,81 +1,103 @@
 # vscode-clangd
 
-Provides C/C++ language IDE features for VS Code using [clangd](https://clang.llvm.org/extra/clangd.html).
+Provides C/C++ language IDE features for VS Code using [clangd](https://clang.llvm.org/extra/clangd.html):
 
-## Usage
+ - code completion
+ - compile errors and warnings
+ - go-to-definition and cross references
+ - include management
+ - code formatting
+ - simple refactorings
 
-`vscode-clangd` provides the features designated by the [Language Server
-Protocol](https://github.com/Microsoft/language-server-protocol), such as
-code completion, code formatting and goto definition.
+## Setup
 
-**Note**: `clangd` is under heavy development, not all LSP features are
-implemented. See [Current Status](https://clang.llvm.org/extra/clangd/Features.html#complete-list-of-features)
-for details.
+### `clangd` server
 
-To use `vscode-clangd` extension in VS Code, you need to install `vscode-clangd`
-from VS Code extension marketplace.
+`clangd` is a language server that must be installed separately, see
+[https://clangd.github.io/installation.html](getting started).
+The vscode-clangd plugin will look for `clangd` on your PATH (you can change
+this in the settings).
 
-`vscode-clangd` will attempt to find the `clangd` binary on your `PATH`.
-Alternatively, the `clangd` executable can be specified in your VS Code
-`settings.json` file:
+### Project setup
 
-```json
-{
-    "clangd.path": "/absolute/path/to/clangd"
-}
-```
+clangd is based on the clang C++ compiler, and understands even complex C++
+code.  However, you must tell clangd how your project is built (compile flags).
+[A `compile_commands.json` file](http://clang.llvm.org/docs/JSONCompilationDatabase.html)
+can usually be generated by your build system
+(e.g. by setting `-DCMAKE_EXPORT_COMPILE_COMMANDS=1` when building with CMake,
+or with
+[many other tools](https://sarcasm.github.io/notes/dev/compilation-database.html)).
 
-To obtain `clangd` binary, please see the [installing Clangd](https://clang.llvm.org/extra/clangd/Installation.html#installing-clangd).
+It should live at the top of your source tree: symlink or copy it there.
 
-## Development
+## Features
 
-A guide of developing `vscode-clangd` extension.
+### Code completion
 
-### Requirements
+Suggestions will appear as you type names, or after `.` or `->`.
+Because clangd uses a full C++ parser, code completion has access to precise
+type information.
 
-* VS Code
-* node.js and npm
+![Code completion](doc-assets/complete.png)
 
-### Steps
+### Errors, warnings, and clang-tidy
 
-1. Make sure you disable the installed `vscode-clangd` extension in VS Code.
-2. Make sure you have clangd in /usr/bin/clangd or edit src/extension.ts to
-point to the binary.
-3. In order to start a development instance of VS code extended with this, run:
+Code errors are shown as you type (both as red squiggle underlines, and in the
+"Problems" panel). These are the same as produced by the clang compiler, and
+suggested fixes can automatically be applied.
 
-```bash
-   $ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/
-   $ npm install
-   $ code .
-   # When VS Code starts, press <F5>.
-```
+![Error with fix](doc-assets/diagnostics.png)
 
-## Contributing
+Most clang-tidy checks are supported (these can be enabled using a [.clang-tidy
+file](https://clang.llvm.org/extra/clang-tidy/)).
 
-Please follow the exsiting code style when contributing to the extension, we
-recommend to run `npm run format` before sending a patch.
+### Cross-references
 
-## Publish to VS Code Marketplace
+Go-to-definition and find-references work across your code, using a project-wide
+index.
 
-New changes to `clangd-vscode` are not released until a new version is published
-to the marketplace.
+![Cross-reference list](doc-assets/xrefs.png)
 
-### Requirements
+Press `Ctrl-P #` to quickly navigate to a symbol by name.
 
-* Make sure install the `vsce` command (`npm install -g vsce`)
-* `llvm-vs-code-extensions` account
-* Bump the version in `package.json`, and commit the change to upstream
+### Include management
 
-The extension is published under `llvm-vs-code-extensions` account, which is
-currently maintained by clangd developers. If you want to make a new release,
-please contact clangd-dev@lists.llvm.org.
+Code completion works across your codebase and adds `#include` directives where
+needed. The `&bull;` shows includes that will be inserted.
 
-### Steps
+clangd can also suggest inserting missing #includes, where they cause errors.
 
-```bash
-  $ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/
-  # For the first time, you need to login in the account. vsce will ask you for
-    the Personal Access Token, and remember it for future commands.
-  $ vsce login llvm-vs-code-extensions
-  $ vsce publish
-```
+![Fix inserts include](doc-assets/include.png)
+
+### Formatting
+
+clangd uses the `clang-format` engine. You can format a file or the selection.
+When "Format on Type" is enabled in the settings, pressing enter will cause
+clangd to format the old line and semantically reindent.
+
+![Format-on-type](doc-assets/format.png)
+
+The style used for formatting (and certain other operations) is controlled by
+the .clang-format file is controlled by the project's
+[.clang-format file](https://clang.llvm.org/docs/ClangFormatStyleOptions.html).
+
+### Refactoring
+
+clangd supports some local refactorings. When you select an expression or
+declaration, the lightbulb menu appears and you can choose a code action.
+
+![Extract variable code action](doc-assets/extract.png)
+
+Current refactorings include:
+ - extract variable/function
+ - expand `auto` types and macros
+ - use raw strings
+ - rename (bound to `<F2>`, rather than a contextual code action)
+
+## Bugs/contributing
+
+clangd and vscode-clangd are part of the [LLVM project](https://llvm.org).
+
+If you'd like to help out, reach out to clangd-dev@lists.llvm.org.
+
+If you've found a bug, please file at https://github.com/clangd/clangd/issues.
diff --git a/clangd/clients/clangd-vscode/doc-assets/complete.png b/clangd/clients/clangd-vscode/doc-assets/complete.png
new file mode 100644
index 0000000..1ce9e82
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/complete.png
Binary files differ
diff --git a/clangd/clients/clangd-vscode/doc-assets/diagnostics.png b/clangd/clients/clangd-vscode/doc-assets/diagnostics.png
new file mode 100644
index 0000000..2ca335b
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/diagnostics.png
Binary files differ
diff --git a/clangd/clients/clangd-vscode/doc-assets/extract.png b/clangd/clients/clangd-vscode/doc-assets/extract.png
new file mode 100644
index 0000000..d62aeeb
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/extract.png
Binary files differ
diff --git a/clangd/clients/clangd-vscode/doc-assets/format.png b/clangd/clients/clangd-vscode/doc-assets/format.png
new file mode 100644
index 0000000..b68d37e
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/format.png
Binary files differ
diff --git a/clangd/clients/clangd-vscode/doc-assets/include.png b/clangd/clients/clangd-vscode/doc-assets/include.png
new file mode 100644
index 0000000..8909fd7
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/include.png
Binary files differ
diff --git a/clangd/clients/clangd-vscode/doc-assets/symbolsearch.png b/clangd/clients/clangd-vscode/doc-assets/symbolsearch.png
new file mode 100644
index 0000000..cce137a
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/symbolsearch.png
Binary files differ
diff --git a/clangd/clients/clangd-vscode/doc-assets/xrefs.png b/clangd/clients/clangd-vscode/doc-assets/xrefs.png
new file mode 100644
index 0000000..622eb69
--- /dev/null
+++ b/clangd/clients/clangd-vscode/doc-assets/xrefs.png
Binary files differ