From 9647069fc353b3ae6ec810cf0eb5adea8117e857 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 10 Aug 2017 17:41:04 +0300 Subject: [PATCH] trying to fix #203 --- src/dlangide/tools/d/dcdinterface.d | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/dlangide/tools/d/dcdinterface.d b/src/dlangide/tools/d/dcdinterface.d index 07ac8ec..4bc3c65 100644 --- a/src/dlangide/tools/d/dcdinterface.d +++ b/src/dlangide/tools/d/dcdinterface.d @@ -4,6 +4,7 @@ import dlangui.core.logger; import dlangui.core.files; import dlangui.platforms.common.platform; import ddebug.common.queue; +import dsymbol.string_interning : internString; import core.thread; @@ -47,7 +48,7 @@ class DCDTask { } void createRequest() { request.sourceCode = cast(ubyte[])_content; - request.fileName = _filename; + request.fileName = internString(_filename); request.cursorPosition = _index; request.importPaths = _importPaths; } @@ -70,16 +71,25 @@ class DCDTask { } } +string[] internStrings(in string[] src) { + if (!src) + return null; + string[] res; + foreach(s; src) + res ~= internString(s); + return res; +} + class ModuleCacheAccessor { import dsymbol.modulecache; //protected ASTAllocator _astAllocator; protected ModuleCache _moduleCache; this(in string[] importPaths) { _moduleCache = ModuleCache(new ASTAllocator); - _moduleCache.addImportPaths(importPaths); + _moduleCache.addImportPaths(internStrings(importPaths)); } protected ModuleCache * getModuleCache(in string[] importPaths) { - _moduleCache.addImportPaths(importPaths); + _moduleCache.addImportPaths(internStrings(importPaths)); return &_moduleCache; } }