Browse Source

Add configuration to control is complete with node pathes

geequlim 8 năm trước cách đây
mục cha
commit
32b3449bf2
2 tập tin đã thay đổi với 30 bổ sung23 xóa
  1. 7 2
      package.json
  2. 23 21
      src/config.ts

+ 7 - 2
package.json

@@ -3,7 +3,7 @@
   "displayName": "Godot Tools",
   "icon": "newIcon.png",
   "description": "Tools for game development with godot game engine",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "publisher": "geequlim",
   "repository": "https://github.com/GodotExplorer/godot-tools",
   "license": "MIT",
@@ -69,8 +69,13 @@
         },
         "GodotTools.parseTextScene": {
             "type": "boolean",
-            "default": false,
+            "default": true,
             "description": "Parse scene files with extention ends with tscn"
+        },
+        "GodotTools.completeNodePath": {
+            "type": "boolean",
+            "default": false,
+            "description": "Show node pathes of of workspace in the code completion"
         }
       }
     },

+ 23 - 21
src/config.ts

@@ -214,28 +214,30 @@ class Config {
         if(script.enumerations)
           symbols.constants = [...(symbols.constants), ...(addScriptItems(script.enumerations, CompletionItemKind.Enum, "Enumeration"))];
       }
+      
+      if(workspace.getConfiguration("GodotTools").get("completeNodePath", false)) {
+        const addSceneNodes = ()=>{
+          const _items: CompletionItem[] = [];
+          for (let scnenepath of Object.keys(this.nodeInfoMap)) {
+            const nodes: NodeInfo[] = this.nodeInfoMap[scnenepath];
+            nodes.map((n=>{
+              const item = new CompletionItem(n.name, CompletionItemKind.Reference);
+              item.detail = n.type;
+              item.documentation = `${n.parent}/${n.name} in ${scnenepath}`;
+              _items.push(item);
 
-      const addSceneNodes = ()=>{
-        const _items: CompletionItem[] = [];
-        for (let scnenepath of Object.keys(this.nodeInfoMap)) {
-          const nodes: NodeInfo[] = this.nodeInfoMap[scnenepath];
-          nodes.map((n=>{
-            const item = new CompletionItem(n.name, CompletionItemKind.Reference);
-            item.detail = n.type;
-            item.documentation = `${n.parent}/${n.name} in ${scnenepath}`;
-            _items.push(item);
-
-            const fullitem = new CompletionItem(`${n.parent}/${n.name}`, CompletionItemKind.Reference);
-            fullitem.detail = n.type;
-            fullitem.filterText = n.name;
-            fullitem.sortText = n.name;
-            fullitem.documentation = `${n.parent}/${n.name} in ${scnenepath}`;
-            _items.push(fullitem);
-          }));
-        }
-        return _items;
-      };
-      symbols.nodes = [...(symbols.nodes), ...(addSceneNodes())];
+              const fullitem = new CompletionItem(`${n.parent}/${n.name}`, CompletionItemKind.Reference);
+              fullitem.detail = n.type;
+              fullitem.filterText = n.name;
+              fullitem.sortText = n.name;
+              fullitem.documentation = `${n.parent}/${n.name} in ${scnenepath}`;
+              _items.push(fullitem);
+            }));
+          }
+          return _items;
+        };
+        symbols.nodes = [...(symbols.nodes), ...(addSceneNodes())];
+      }
 
       return symbols;
   }