[PATCH] D88071: [clangd] Add a trained DecisionForest for code completion.

UTKARSH SAXENA via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 23:12:46 PDT 2020


usaxena95 created this revision.
Herald added subscribers: cfe-commits, kadircet, arphaman.
Herald added a project: clang.
usaxena95 requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

Replaces the dummy CodeCompletion model with a trained DecisionForest
model.
The features.json needs to be manually curated specifying the features
to be used. This is a one-time cost and does not change if the model
changes until we decide to add/remove features.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88071

Files:
  clang-tools-extra/clangd/quality/model/features.json
  clang-tools-extra/clangd/quality/model/forest.json


Index: clang-tools-extra/clangd/quality/model/features.json
===================================================================
--- clang-tools-extra/clangd/quality/model/features.json
+++ clang-tools-extra/clangd/quality/model/features.json
@@ -1,8 +1,84 @@
 [
+    {
+        "name": "FilterLength",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsDeprecated",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsReservedName",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsImplementationDetail",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "NumReferences",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsNameInContext",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsForbidden",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsInBaseClass",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "FileProximityDistance",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "SemaFileProximityScore",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "SymbolScopeDistance",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "SemaSaysInScope",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "IsInstanceMember",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "HadContextType",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "HadSymbolType",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "TypeMatchesPreferred",
+        "kind": "NUMBER"
+    },
+    {
+        "name": "SymbolCategory",
+        "kind": "ENUM",
+        "type": "clang::clangd::SymbolQualitySignals::SymbolCategory",
+        "header": "Quality.h"
+    },
     {
         "name": "ContextKind",
         "kind": "ENUM",
         "type": "clang::CodeCompletionContext::Kind",
         "header": "clang/Sema/CodeCompleteConsumer.h"
+    },
+    {
+        "name": "Scope",
+        "kind": "ENUM",
+        "type": "clang::clangd::SymbolRelevanceSignals::AccessibleScope",
+        "header": "Quality.h"
     }
 ]
\ No newline at end of file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88071.293346.patch
Type: text/x-patch
Size: 2068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200922/2ef57a1e/attachment.bin>


More information about the cfe-commits mailing list