diff --git a/dsymbol b/dsymbol index f6aac6c..86cf39c 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit f6aac6cab1ffebdc2a56321f0c5fed2c896f38c4 +Subproject commit 86cf39c41e3173818a3ad9aa60bb253f0da26523 diff --git a/dub.json b/dub.json index d5f9530..76c4ba0 100644 --- a/dub.json +++ b/dub.json @@ -7,8 +7,8 @@ ], "license": "GPL-3.0", "dependencies": { - "dsymbol": "~>0.1.2", - "libdparse": "~>0.6.0", + "dsymbol": "~>0.2.0-alpha1", + "libdparse": "~>0.7.0-alpha1", "msgpack-d": "~>1.0.0-beta.2" }, "versions": ["built_with_dub"], diff --git a/libdparse b/libdparse index 516a053..3257b3c 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 516a053c9b16d05aee30d2606a88b7f815cd55df +Subproject commit 3257b3c905127e8bccf4b9b2ebc50b9b448c0fba diff --git a/makefile b/makefile index 04e60c2..8f0cfa2 100644 --- a/makefile +++ b/makefile @@ -67,6 +67,8 @@ SERVER_SRC := \ ${DPARSE_DIR}/src/dparse/lexer.d\ ${DPARSE_DIR}/src/dparse/parser.d\ ${DPARSE_DIR}/src/dparse/formatter.d\ + ${DPARSE_DIR}/src/dparse/rollback_allocator.d\ + ${DPARSE_DIR}/src/dparse/stack_buffer.d\ ${DPARSE_DIR}/src/std/experimental/lexer.d\ $(shell find containers/experimental_allocator/src/std/experimental/allocator/ -name "*.d")\ containers/src/containers/dynamicarray.d\ diff --git a/src/common/dcd_version.d b/src/common/dcd_version.d index 2d3b77c..085443b 100644 --- a/src/common/dcd_version.d +++ b/src/common/dcd_version.d @@ -21,7 +21,7 @@ module common.dcd_version; /** * Human-readable version number */ -enum DCD_VERSION = "v0.8.0"; +enum DCD_VERSION = "v0.9.0-alpha1"; version (Windows) {} else version (built_with_dub) {} diff --git a/src/server/autocomplete.d b/src/server/autocomplete.d index 6b47f4a..d0e9c95 100644 --- a/src/server/autocomplete.d +++ b/src/server/autocomplete.d @@ -35,6 +35,7 @@ import std.uni; import dparse.ast; import dparse.lexer; import dparse.parser; +import dparse.rollback_allocator; import dsymbol.conversion; import dsymbol.modulecache; @@ -59,10 +60,11 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request, { // trace("Getting doc comments"); AutocompleteResponse response; + RollbackAllocator rba; auto allocator = scoped!(ASTAllocator)(); auto cache = StringCache(StringCache.defaultBucketCount); SymbolStuff stuff = getSymbolsForCompletion(request, CompletionType.ddoc, - allocator, cache, moduleCache); + allocator, &rba, cache, moduleCache); if (stuff.symbols.length == 0) warning("Could not find symbol"); else @@ -121,10 +123,11 @@ public AutocompleteResponse findDeclaration(const AutocompleteRequest request, ref ModuleCache moduleCache) { AutocompleteResponse response; + RollbackAllocator rba; auto allocator = scoped!(ASTAllocator)(); auto cache = StringCache(StringCache.defaultBucketCount); SymbolStuff stuff = getSymbolsForCompletion(request, - CompletionType.location, allocator, cache, moduleCache); + CompletionType.location, allocator, &rba, cache, moduleCache); scope(exit) stuff.destroy(); if (stuff.symbols.length > 0) { @@ -191,8 +194,9 @@ public AutocompleteResponse symbolSearch(const AutocompleteRequest request, const(Token)[] tokenArray = getTokensForParser(cast(ubyte[]) request.sourceCode, config, &cache); auto allocator = scoped!(ASTAllocator)(); + RollbackAllocator rba; ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - request.cursorPosition, moduleCache); + &rba, request.cursorPosition, moduleCache); scope(exit) pair.destroy(); static struct SearchResults @@ -328,8 +332,9 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray, case tok!"this": case tok!"super": auto allocator = scoped!(ASTAllocator)(); + RollbackAllocator rba; ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - cursorPosition, moduleCache); + &rba, cursorPosition, moduleCache); scope(exit) pair.destroy(); response.setCompletions(pair.scope_, getExpression(beforeTokens), cursorPosition, CompletionType.identifiers, false, partial); @@ -372,14 +377,14 @@ auto getTokensBeforeCursor(const(ubyte[]) sourceCode, size_t cursorPosition, * the request's source code, cursor position, and completion type. */ SymbolStuff getSymbolsForCompletion(const AutocompleteRequest request, - const CompletionType type, IAllocator allocator, ref StringCache cache, - ref ModuleCache moduleCache) + const CompletionType type, IAllocator allocator, RollbackAllocator* rba, + ref StringCache cache, ref ModuleCache moduleCache) { const(Token)[] tokenArray; auto beforeTokens = getTokensBeforeCursor(request.sourceCode, request.cursorPosition, cache, tokenArray); ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - request.cursorPosition, moduleCache); + rba, request.cursorPosition, moduleCache); auto expression = getExpression(beforeTokens); return SymbolStuff(getSymbolsByTokenChain(pair.scope_, expression, request.cursorPosition, type), pair.symbol, pair.scope_); @@ -456,8 +461,9 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens, case tok!")": case tok!"]": auto allocator = scoped!(ASTAllocator)(); + RollbackAllocator rba; ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - cursorPosition, moduleCache); + &rba, cursorPosition, moduleCache); scope(exit) pair.destroy(); auto expression = getExpression(beforeTokens[0 .. $ - 1]); response.setCompletions(pair.scope_, expression,