[clang-tools-extra] r363554 - [clangd] Detect C++ for extension-less source files in vscode extension

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 05:59:14 PDT 2019


Author: hokein
Date: Mon Jun 17 05:59:14 2019
New Revision: 363554

URL: http://llvm.org/viewvc/llvm-project?rev=363554&view=rev
Log:
[clangd] Detect C++ for extension-less source files in vscode extension

Summary:
Extend our extension to support detecting these files as C++ files based on the first
line (`-*- C++ -*-`), it will make clangd work on C++ standard headers
(e.g. iostream).

We use the contributes.languages[1] to enrich the builtin VScode C++
support.

[1]: https://code.visualstudio.com/api/references/contribution-points#contributes.languages

Reviewers: kadircet

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

Tags: #clang

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

Modified:
    clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json

Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json?rev=363554&r1=363553&r2=363554&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json (original)
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json Mon Jun 17 05:59:14 2019
@@ -50,6 +50,10 @@
         "url": "http://llvm.org/svn/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/"
     },
     "contributes": {
+        "languages": [{
+            "id": "cpp",
+            "firstLine": "^\/[/*].*-\\*-\\s*C\\+\\+\\s*-\\*-.*"
+        }],
         "configuration": {
             "type": "object",
             "title": "clangd configuration",




More information about the cfe-commits mailing list