This revision was automatically updated to reflect the committed changes.
Closed by commit rL320972: [clangd] in VSCode client, filter extensions 
properly and only accept file: URIs (authored by sammccall, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D41343

Files:
  clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts


Index: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
===================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
@@ -22,20 +22,20 @@
 
     const serverOptions: vscodelc.ServerOptions = { command: clangdPath, args: 
clangdArgs };
 
-    const cppFileExtensions: string[] = ['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 
'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'];
-    const cppFileExtensionsPattern = cppFileExtensions.join();
+    const filePattern: string = '**/*.{' +
+      ['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 
'inc'].join() + '}';
     const clientOptions: vscodelc.LanguageClientOptions = {
         // Register the server for C/C++ files
-        documentSelector: cppFileExtensions,
+        documentSelector: [{scheme: 'file', pattern: filePattern}],
         uriConverters: {
             // FIXME: by default the URI sent over the protocol will be 
percent encoded (see rfc3986#section-2.1)
             //        the "workaround" below disables temporarily the encoding 
until decoding
             //        is implemented properly in clangd
             code2Protocol: (uri: vscode.Uri) : string => uri.toString(true),
             protocol2Code: (uri: string) : vscode.Uri => vscode.Uri.parse(uri)
         },
         synchronize: !syncFileEvents ? undefined : {
-            fileEvents: vscode.workspace.createFileSystemWatcher('**/*.{' + 
cppFileExtensionsPattern + '}')
+            fileEvents: vscode.workspace.createFileSystemWatcher(filePattern)
         }
     };
 


Index: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
===================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
@@ -22,20 +22,20 @@
 
     const serverOptions: vscodelc.ServerOptions = { command: clangdPath, args: clangdArgs };
 
-    const cppFileExtensions: string[] = ['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'];
-    const cppFileExtensionsPattern = cppFileExtensions.join();
+    const filePattern: string = '**/*.{' +
+      ['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'].join() + '}';
     const clientOptions: vscodelc.LanguageClientOptions = {
         // Register the server for C/C++ files
-        documentSelector: cppFileExtensions,
+        documentSelector: [{scheme: 'file', pattern: filePattern}],
         uriConverters: {
             // FIXME: by default the URI sent over the protocol will be percent encoded (see rfc3986#section-2.1)
             //        the "workaround" below disables temporarily the encoding until decoding
             //        is implemented properly in clangd
             code2Protocol: (uri: vscode.Uri) : string => uri.toString(true),
             protocol2Code: (uri: string) : vscode.Uri => vscode.Uri.parse(uri)
         },
         synchronize: !syncFileEvents ? undefined : {
-            fileEvents: vscode.workspace.createFileSystemWatcher('**/*.{' + cppFileExtensionsPattern + '}')
+            fileEvents: vscode.workspace.createFileSystemWatcher(filePattern)
         }
     };
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to