Browse Source

Fix workspace symbols appear twice
Close #2

Geequlim 8 years ago
parent
commit
f318df4f3d
2 changed files with 7 additions and 5 deletions
  1. 6 4
      src/config.ts
  2. 1 1
      src/tool_manager.ts

+ 6 - 4
src/config.ts

@@ -37,11 +37,11 @@ class Config {
   }
   }
 
 
   setSymbols(path, s) {
   setSymbols(path, s) {
-    this.symbols[path] = s;
+    this.symbols[this.normalizePath(path)] = s;
   }
   }
 
 
   getSymbols(path) {
   getSymbols(path) {
-    return this.symbols[path];
+    return this.symbols[this.normalizePath(path)];
   }
   }
 
 
   setAllSymbols(s) {
   setAllSymbols(s) {
@@ -53,13 +53,15 @@ class Config {
   }
   }
 
 
   normalizePath(path) {
   normalizePath(path) {
-    let newpath = path.replace(/\\/g, "/");
+    let newpath = path;
     if( path.indexOf(":") != -1){
     if( path.indexOf(":") != -1){
       let parts = path.split(":");
       let parts = path.split(":");
-      newpath = parts[0].toUpperCase()
+      newpath = parts[0].toUpperCase();
+      newpath += ":";
       for(let i=1; i<parts.length; i++)
       for(let i=1; i<parts.length; i++)
         newpath += parts[i];
         newpath += parts[i];
     }
     }
+    newpath = newpath.replace(/\\/g, "/");
     return newpath;
     return newpath;
   }
   }
 
 

+ 1 - 1
src/tool_manager.ts

@@ -78,7 +78,7 @@ class ToolManager {
         if(!err) {
         if(!err) {
           const symbols = {};
           const symbols = {};
           for(let i=0; i< files.length; i++)
           for(let i=0; i< files.length; i++)
-            symbols[files[i]] = config.loadSymbolsFromFile(files[i]);
+            symbols[config.normalizePath(files[i])] = config.loadSymbolsFromFile(files[i]);
           // load autoloads from engin.cfg
           // load autoloads from engin.cfg
           const engincfg = path.join(self.workspaceDir, "engine.cfg");
           const engincfg = path.join(self.workspaceDir, "engine.cfg");
           if(fs.existsSync(engincfg) && fs.statSync(engincfg).isFile()) {
           if(fs.existsSync(engincfg) && fs.statSync(engincfg).isFile()) {