[PATCH] D63483: [clangd] Detect C++ language based on well-known file path in vscode extension

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 04:30:23 PDT 2019


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

Matching the "C++" pattern on the first line of the file doesn't cover
all cases, MSVC C++ headers doesn't have such pattern. This patch
introduce a new heuristic to detect language based on the file path.

MSVC C++ standard headers are in the directory like
"c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63483

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


Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===================================================================
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -52,6 +52,10 @@
     "contributes": {
         "languages": [{
             "id": "cpp",
+            "filenamePatterns": [
+                "**/include/c++/**",
+                "**/MSVC/*/include/**"
+            ],
             "firstLine": "^\/[/*].*-\\*-\\s*C\\+\\+\\s*-\\*-.*"
         }],
         "configuration": {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63483.205300.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190618/02945925/attachment.bin>


More information about the cfe-commits mailing list