dlang-community / dcd Goto Github PK
View Code? Open in Web Editor NEWThe D Completion Daemon is an auto-complete program for the D programming language
License: GNU General Public License v3.0
The D Completion Daemon is an auto-complete program for the D programming language
License: GNU General Public License v3.0
Create a Notepad++ plugin for DCD. Notepad++ uses Scintilla, so the behavior should be very similar to the Textadept plugin.
http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Development
The server should ignore invalid requests like this:
Sockets shut down.
std.file.FileException@std/file.d(2394): /home/dav1d/workspaces/BraLa: No such file or directory
Instead of shutting down.
Autocompletion is not aware of the alias this feature of D.
The statement import std.stdio: writeln
should cause only the "writeln" symbol to be imported into the scope of the import statement.
The submodules aren't up to date and cause compilation to fail with dmd Git head without first checking out the master branches of them.
DCD has no support for the Uniform Function Call Syntax.
Starting the server with the source directory of dub as import directory leads to immediate crash.
Best regards,
Robert
dub: https://github.com/rejectedsoftware/dub
robert@linuxPC source $ pwd
/home/robert/projects/dub/source
robert@linuxPC source $ dcd-server -I .
Loading and caching completions for ./dub/compilers/ldc.d
Getting symbols for module ./dub/compilers/ldc.d
Loading and caching completions for ./dub/compilers/gdc.d
Getting symbols for module ./dub/compilers/gdc.d
Loading and caching completions for ./dub/compilers/compiler.d
Getting symbols for module ./dub/compilers/compiler.d
Loading and caching completions for ./dub/compilers/dmd.d
Getting symbols for module ./dub/compilers/dmd.d
Loading and caching completions for ./dub/dependency.d
Getting symbols for module ./dub/dependency.d
Loading and caching completions for ./dub/project.d
Getting symbols for module ./dub/project.d
Loading and caching completions for ./dub/dub.d
Getting symbols for module ./dub/dub.d
Loading and caching completions for ./dub/package_.d
Getting symbols for module ./dub/package_.d
Loading and caching completions for ./dub/internal/std/process.d
Getting symbols for module ./dub/internal/std/process.d
Loading and caching completions for ./dub/internal/std/processcompat.d
Getting symbols for module ./dub/internal/std/processcompat.d
Loading and caching completions for ./dub/internal/vibecompat/core/log.d
Getting symbols for module ./dub/internal/vibecompat/core/log.d
Loading and caching completions for ./dub/internal/vibecompat/core/file.d
Getting symbols for module ./dub/internal/vibecompat/core/file.d
Loading and caching completions for ./dub/internal/vibecompat/data/json.d
Getting symbols for module ./dub/internal/vibecompat/data/json.d
Loading and caching completions for ./dub/internal/vibecompat/data/utils.d
Getting symbols for module ./dub/internal/vibecompat/data/utils.d
Loading and caching completions for ./dub/internal/vibecompat/inet/path.d
Getting symbols for module ./dub/internal/vibecompat/inet/path.d
Loading and caching completions for ./dub/internal/vibecompat/inet/url.d
Getting symbols for module ./dub/internal/vibecompat/inet/url.d
Loading and caching completions for ./dub/packagemanager.d
Getting symbols for module ./dub/packagemanager.d
Could not resolve type
Loading and caching completions for ./dub/installation.d
Getting symbols for module ./dub/installation.d
Shutting down sockets...
Sockets shut down.
dcd-server(d_array_bounds+0x26) [0x5c8b86]
dcd-server() [0x5b88f5]
dcd-server(const(pure nothrow ref @Property @safe const(ubyte) function()) stdx.d.lexer.LexSource!(ubyte[]).LexSource.front+0x6a) [0x5ade2a]
dcd-server(pure nothrow @safe void stdx.d.lexer.TokenRange!(stdx.d.lexer.LexSource!(ubyte[]).LexSource).TokenRange.nextChar()+0x40) [0x5b1770]
dcd-server(pure void stdx.d.lexer.TokenRange!(stdx.d.lexer.LexSource!(ubyte[]).LexSource).TokenRange.lexComment!(false).lexComment()+0x11a) [0x5b3dfa]
dcd-server(void stdx.d.lexer.TokenRange!(stdx.d.lexer.LexSource!(ubyte[]).LexSource).TokenRange.advance()+0x1248) [0x5af598]
dcd-server(void stdx.d.lexer.TokenRange!(stdx.d.lexer.LexSource!(ubyte[]).LexSource).TokenRange.popFront()+0x51) [0x5ae349]
dcd-server(stdx.d.lexer.TokenRange!(stdx.d.lexer.LexSource!(ubyte[]).LexSource).TokenRange stdx.d.lexer.byToken!(ubyte[]).byToken(ubyte[], stdx.d.lexer.LexerConfig)+0x9a) [0x5adc9a]
dcd-server(actypes.ACSymbol[] modulecache.ModuleCache.getSymbolsInModule(immutable(char)[])+0x1e3) [0x586133]
dcd-server(void modulecache.ModuleCache.addImportPath(immutable(char)[])+0x16b) [0x585f1b]
dcd-server(Dmain+0x249) [0x5223f9]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x18) [0x5c9294]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])).void tryExec(scope void delegate())+0x2a) [0x5c8dc6]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char, extern (C) int function(char[][])).void runAll()+0x40) [0x5c92e4]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char*, extern (C) int function(char[][])).void tryExec(scope void delegate())+0x2a) [0x5c8dc6]
dcd-server(_d_run_main+0x1ae) [0x5c8d82]
dcd-server(main+0x17) [0x5c8bcf]
Using test.d as follows:
import std.s
Running the server and client as follows:
./dcd-server
./dcd-client -c10 test.d
Server throws:
[email protected](7372): Range violation
----------------
./dcd-server(_d_array_bounds+0x26) [0x5be82e]
./dcd-server() [0x5cf60e]
./dcd-server(pure nothrow @safe const(stdx.d.lexer.Token) std.range.SortedRange!(const(stdx.d.lexer.Token)[], "a < b").SortedRange.opIndex(ulong)+0x68) [0x575970]
./dcd-server(messages.AutocompleteResponse autocomplete.complete(messages.AutocompleteRequest, immutable(char)[][])+0x5f2) [0x585632]
./dcd-server(_Dmain+0x5bb) [0x51a6bb]
./dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x18) [0x5bef3c]
./dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x5bea6e]
./dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x40) [0x5bef8c]
./dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x5bea6e]
./dcd-server(_d_run_main+0x1ae) [0x5bea2a]
./dcd-server(main+0x17) [0x5be877]
/lib64/libc.so.6(__libc_start_main+0xf5) [0x3b77221b75]
According to addr2line, the line where it fails is autocomplete.d:104.
Hi Brian,
I'm not sure if this is a bug or a configuration issue?
I was curious to see if DCD worked with Zeus.
When I run the server on Windows 7 (64 bit) I get this error:
C:\Program Files (x86)\Zeus>dcd-server.exe
Import directories: []
Startup complete
Shutting down sockets...
Sockets shut down.
std.socket.SocketOSException@std\socket.d(2438): Unable to set socket blocking: An operation was attempted on something
that is not a socket.
----------------
0x0047DF34 in @property void std.socket.Socket.blocking(bool)
0x0047BE54 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()
0x0047BE8F in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()
0x0047BA8D in _d_run_main
0x00470E0C in main
0x749D33AA in BaseThreadInitThunk
0x772B9F72 in RtlInitializeExceptionChain
0x772B9F45 in RtlInitializeExceptionChain
----------------
I got the same error running the dcd-server on Windows XP.
Running the gocode server on the same machine works fine:
C:\Program Files (x86)\Zeus>gocode.exe
The above command line starts the gocode server.
Cheers Jussi
The server uses 168 megabytes of memory when caching phobos, derelict, dcd, and dscanner. See if it's possible to reduce this.
Variables by the name of _argptr and _arguments should be placed in the scope of a function taking a variable argument list.
Currently the identifiers format looks like this:
identifiers
parts v
name v
getPartByName f
I think that should be changed to (4 spaces = 1 tab):
identifiers
v parts
v name
f getPartByName
Allowing the client/server to share more information about variables and functions, like variable type, return-type, qualifiers/attributes of functions (protected, const, nothrow etc.). Also function arguments:
identifiers
v int[] parts
v string name
f Part[] getPartByName(string name, int something) const nothrow @safe
This alone allows nicer completions, but combined with the next point about calltips it will be amazing ;)
For calltips send not only the actual calltips but also identifiers which could be used as completion, furthermore send this information if the cursor is anywhere between (
and )
:
identifiers
v int[] parts
v string name
f float getX() @safe
calltips
void foo(string name, float x)
This would allow the plugin to smartly find out the current cursor position the argument list and display a completion list according to it, with its own group of best matching arguments (_
= cursor, ()
= completion list, []
= completion group):
foo(_) -> ([name], [parts, getX])
foo(name, _) -> ([getX], [parts, name])
Even better would be if the server would complete after a comma, and send the list accordingly, this would get rid of some logic in the plugin.
Resolving location of /home/dav1d/workspaces/d/BraLa/src/d/nbd/nbt.d
Program received signal SIGSEGV, Segmentation fault.
0x0000000000571229 in acvisitor.AutocompleteVisitor.visit() ()
(gdb) bt full
#0 0x0000000000571229 in acvisitor.AutocompleteVisitor.visit() ()
No symbol table info available.
#1 0x000000000057cdff in stdx.d.ast.Declaration.accept() ()
No symbol table info available.
#2 0x0000000000576f9f in stdx.d.ast.ASTVisitor.visit() ()
No symbol table info available.
#3 0x00000000005822ef in stdx.d.ast.TemplateDeclaration.accept() ()
No symbol table info available.
#4 0x0000000000579b9f in stdx.d.ast.ASTVisitor.visit() ()
No symbol table info available.
#5 0x000000000057f881 in stdx.d.ast.MixinTemplateDeclaration.accept() ()
No symbol table info available.
#6 0x00000000005786e7 in stdx.d.ast.ASTVisitor.visit() ()
No symbol table info available.
#7 0x000000000057cd63 in stdx.d.ast.Declaration.accept() ()
No symbol table info available.
#8 0x0000000000576f9f in stdx.d.ast.ASTVisitor.visit() ()
No symbol table info available.
#9 0x000000000057fa2c in stdx.d.ast.Module.accept() ()
No symbol table info available.
#10 0x00000000005726c0 in acvisitor.AutocompleteVisitor.visit() ()
No symbol table info available.
#11 0x000000000056e7ba in modulecache.ModuleCache.getSymbolsInModule() ()
No symbol table info available.
#12 0x000000000056e545 in modulecache.ModuleCache.addImportPath() ()
No symbol table info available.
That's the file: https://github.com/Dav1dde/nbd/blob/master/nbt.d
I will investigate this further.
Edit: -g -gc
esolving location of /home/dav1d/workspaces/d/BraLa/src/d/nbd/nbt.d
Program received signal SIGSEGV, Segmentation fault.
0x000000000057478d in _D9acvisitor19AutocompleteVisitor5visitMFC4stdx1d3ast11ConstructorZv (this=0x7ffff663df80, dec=0x7ffff6625c80) at acvisitor.d:159
159 symbol.calltip = format("%s this%s", parentSymbol.name,
(gdb) bt full
#0 0x000000000057478d in _D9acvisitor19AutocompleteVisitor5visitMFC4stdx1d3ast11ConstructorZv (this=0x7ffff663df80, dec=0x7ffff6625c80) at acvisitor.d:159
_TMP1966 = 0x7ffff663df80
symbol = 0x7ffff65c6900
_TMP1967 = 0x7ffff65c6900
parameterSymbols = {0x7ffff65c6800, 0x7ffff65c6780}
__aggr3930 = {0x7ffff6625c00, 0x7ffff6625a80}
__key3931 = 2
parameter = 0x7ffff6625a80
paramSymbol = 0x7ffff65c6780
_TMP1969 = 0x7ffff65c6780
_TMP1970 = {0x7ffff65c6800, 0x7ffff65c6780}
p = 0x7ffff6627000
functionBody = 0x7ffff663df80
s = 0x7ffff663df80
_TMP1972 = 0x57d251 <_D4stdx1d3ast10ASTVisitor5visitMFC4stdx1d3ast12StorageClassZv+105>
__aggr3939 = 0x0
__key3940 = 0
parameterSymbol = 0x7ffff6627000
_TMP1973 = 0x7ffff65c6980
_TMP1974 = 0x5f4fd0 <acvisitor.AutocompleteVisitor.__vtbl()>
^C _TMP1975 = Quit
(gdb) bt
#0 0x000000000057478d in _D9acvisitor19AutocompleteVisitor5visitMFC4stdx1d3ast11ConstructorZv (this=0x7ffff663df80, dec=0x7ffff6625c80) at acvisitor.d:159
#1 0x0000000000580e59 in _D4stdx1d3ast11Declaration6acceptMFC4stdx1d3ast10ASTVisitorZv (this=0x7ffff5ad3200, visitor=0x7ffff663df80) at dscanner/stdx/d/ast.d:952
#2 0x000000000057a899 in _D4stdx1d3ast10ASTVisitor5visitMFC4stdx1d3ast11DeclarationZv (this=0x7ffff663df80, declaration=0x7ffff5ad3200) at dscanner/stdx/d/ast.d:91
#3 0x00000000005867de in _D4stdx1d3ast19TemplateDeclaration6acceptMFC4stdx1d3ast10ASTVisitorZv (this=0x7ffff6627280, visitor=0x7ffff663df80) at dscanner/stdx/d/ast.d:2396
#4 0x000000000057d801 in _D4stdx1d3ast10ASTVisitor5visitMFC4stdx1d3ast19TemplateDeclarationZv (this=0x7ffff663df80, templateDeclaration=0x7ffff6627280) at dscanner/stdx/d/ast.d:199
#5 0x0000000000583b44 in _D4stdx1d3ast24MixinTemplateDeclaration6acceptMFC4stdx1d3ast10ASTVisitorZv (this=0x7ffff5ac2b40, visitor=0x7ffff663df80) at dscanner/stdx/d/ast.d:1696
#6 0x000000000057c1b1 in _D4stdx1d3ast10ASTVisitor5visitMFC4stdx1d3ast24MixinTemplateDeclarationZv (this=0x7ffff663df80, mixinTemplateDeclaration=0x7ffff5ac2b40)
at dscanner/stdx/d/ast.d:148
#7 0x0000000000580dbd in _D4stdx1d3ast11Declaration6acceptMFC4stdx1d3ast10ASTVisitorZv (this=0x7ffff5ad3800, visitor=0x7ffff663df80) at dscanner/stdx/d/ast.d:948
#8 0x000000000057a899 in _D4stdx1d3ast10ASTVisitor5visitMFC4stdx1d3ast11DeclarationZv (this=0x7ffff663df80, declaration=0x7ffff5ad3800) at dscanner/stdx/d/ast.d:91
#9 0x0000000000583d0b in _D4stdx1d3ast6Module6acceptMFC4stdx1d3ast10ASTVisitorZv (this=0x7ffff5a98bc0, visitor=0x7ffff663df80) at dscanner/stdx/d/ast.d:1721
#10 0x0000000000575d3f in _D9acvisitor19AutocompleteVisitor5visitMFC4stdx1d3ast6ModuleZv (this=0x7ffff663df80, mod=0x7ffff5a98bc0) at acvisitor.d:364
#11 0x0000000000571b56 in _D11modulecache11ModuleCache18getSymbolsInModuleFAyaZAC7actypes8ACSymbol (moduleName=...) at modulecache.d:94
#12 0x00000000005718c4 in _D11modulecache11ModuleCache13addImportPathFAyaZv (path=...) at modulecache.d:64
#13 0x000000000050d4e0 in _Dmain (args=...) at server.d:113
#14 0x00000000005af92c in rt.dmain2._d_run_main() ()
#15 0x00000000005af45e in rt.dmain2._d_run_main() ()
#16 0x00000000005af97c in rt.dmain2._d_run_main() ()
#17 0x00000000005af45e in rt.dmain2._d_run_main() ()
#18 0x00000000005af41a in _d_run_main ()
#19 0x00000000005af267 in main ()
Unfortunatly I can't paste the full bt full
traceback, since gdb stops "printing" it, I have to Ctrl+c
it...
On line 23 of init.lua it should be textadept.editing.autocomplete_word(keywords)
as the _M was dropped.
Apologies if you are not targeting beta versions of TA.
I'd also just like to complement your work on this project. It is excellent and the client/server architecture and ability to easily hook it up with programmable editors is awesome. DCD really improves my experience of working with my D projects.
Using test.d as follows:
import std.
Run the server and run the client using:
./dcd-server
./dcd-client -c1 test.d
You will notice the server increasing in memory usage until it blows up. The issue seems to be an infinite loop in lexer.d
advance
function.
It would be nice if the server could return the result sorted by best match. Example:
module foo;
struct Foo
{
string a;
int b;
}
void main ()
{
Foo foo;
int c = foo. // cursor here
}
In the above code it's pretty easy to see that the best match is b
. Because c
is declared as int
and the type of b
is int
as well. As a start, only simple algorithm can be used, basically just to check direct matches. No need to start with implicit conversions, alias this and so on.
DDoc comments should be available within the editor.
The protocol could be enhanced to send more information to the client to allow semantic highlighting in the editor plugins. Semantic highlighting could include visual effects on class names, interface functions, constants etc.
if add on -inline option,error compile code.in this project.
tell puremagic 'I unconcerned DCD project'.
http://d.puremagic.com/issues/post_bug.cgi
To enable a class view in the clients a request should be implemented which lists all parsed global symbols. Some logic needs to be implemented to only list project symbols and not standard library functions and classes (maybe via different kinds of include dirs). The output format could be CTAGS like. Additionally the request could be parameterized to just include symbols of the current module to allow an outline view support.
The inheritance resolution code does not do any de-duplication when figuring out fields and methods inherited from super classes and interfaces.
Given the following code (vertical pipe is the cursor position)
struct SomeStruct(T) { T field; }
SomeStruct!(float) bar;
bar.field.|
DCD should show completions such as "max", "epsilon", etc.
Editors should be able to specify a cursor location and ask DCD to return the file name and line of the declaration of the symbol at the cursor.
No issue but just to let you know I've added support for DCD autocomplete to the latest Zeus release.
Setup details can be found here: http://www.zeusedit.com/zforum/viewtopic.php?t=7020
Cheers Jussi
Author: Zeus IDE
added /usr/local/include/d2 to the paths for DCD to scan. doing this causes dcd_server to crash with the following debug info.
Shutting down sockets...
Sockets shut down.
dcd-server(d_array_bounds+0x26) [0x5c9096]
dcd-server() [0x5ad1a9]
dcd-server(const(@Property stdx.d.lexer.Token function()) stdx.d.parser.Parser.current+0x36) [0x5ab792]
dcd-server(stdx.d.ast.Declaration stdx.d.parser.Parser.parseDeclaration()+0x146) [0x5a0052]
dcd-server(stdx.d.ast.Module stdx.d.parser.Parser.parseModule()+0x94) [0x5a4570]
dcd-server(stdx.d.ast.Module stdx.d.parser.parseModule(const(stdx.d.lexer.Token)[], immutable(char)[], void function(immutable(char)[], int, int, immutable(char)[]))+0x60) [0x59ce4c]
dcd-server(actypes.ACSymbol[] modulecache.ModuleCache.getSymbolsInModule(immutable(char)[])+0x23b) [0x5865d7]
dcd-server(void modulecache.ModuleCache.addImportPath(immutable(char)[])+0x16b) [0x586367]
dcd-server(Dmain+0x25f) [0x522573]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char, extern (C) int function(char[][])).void runMain()+0x18) [0x5c97a4]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x5c92d6]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])).void runAll()+0x40) [0x5c97f4]
dcd-server(extern (C) int rt.dmain2.d_run_main(int, char, extern (C) int function(char[][])).void tryExec(scope void delegate())+0x2a) [0x5c92d6]
dcd-server(_d_run_main+0x1ae) [0x5c9292]
dcd-server(main+0x17) [0x5c90df]
The server/client should be enhanced to allow to find all usages of the symbol under the cursor. Filenames and locations could then be returned by the server to allow plugins in the supported editors which highlight the usages.
Using revision da48901 on Arch Linux.
Same file on both:
dcd-server -I /usr/include/dlang/dmd
Loading and caching completions for /usr/include/dlang/dmd/crc32.d
Getting symbols for module /usr/include/dlang/dmd/crc32.d
Loading and caching completions for /usr/include/dlang/dmd/object.di
Getting symbols for module /usr/include/dlang/dmd/object.di
Loading and caching completions for /usr/include/dlang/dmd/index.d
Getting symbols for module /usr/include/dlang/dmd/index.d
Couln't parse /usr/include/dlang/dmd/index.d due to exception: (13:4): Expected "'" to end character literal
Loading and caching completions for /usr/include/dlang/dmd/etc/linux/memoryerror.d
Getting symbols for module /usr/include/dlang/dmd/etc/linux/memoryerror.d
Loading and caching completions for /usr/include/dlang/dmd/etc/c/sqlite3.d
Getting symbols for module /usr/include/dlang/dmd/etc/c/sqlite3.d
Loading and caching completions for /usr/include/dlang/dmd/etc/c/curl.d
Getting symbols for module /usr/include/dlang/dmd/etc/c/curl.d
Loading and caching completions for /usr/include/dlang/dmd/etc/c/zlib.d
Getting symbols for module /usr/include/dlang/dmd/etc/c/zlib.d
Loading and caching completions for /usr/include/dlang/dmd/std/typecons.d
Getting symbols for module /usr/include/dlang/dmd/std/typecons.d
Could not resolve type
Could not resolve type
Loading and caching completions for /usr/include/dlang/dmd/std/socketstream.d
Getting symbols for module /usr/include/dlang/dmd/std/socketstream.d
Loading and caching completions for /usr/include/dlang/dmd/std/path.d
Getting symbols for module /usr/include/dlang/dmd/std/path.d
Loading and caching completions for /usr/include/dlang/dmd/std/numeric.d
Getting symbols for module /usr/include/dlang/dmd/std/numeric.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/processinit.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/processinit.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/math/biguintcore.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/math/biguintcore.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/math/gammafunction.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/math/gammafunction.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/math/biguintnoasm.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/math/biguintnoasm.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/math/errorfunction.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/math/errorfunction.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/math/biguintx86.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/math/biguintx86.d
Loading and caching completions for /usr/include/dlang/dmd/std/internal/windows/advapi32.d
Getting symbols for module /usr/include/dlang/dmd/std/internal/windows/advapi32.d
Shutting down sockets...
Sockets shut down.
[email protected](6435): Range violation
----------------
dcd-server(_d_array_bounds+0x16) [0x81d3886]
dcd-server() [0x81be8ff]
dcd-server(const(@property stdx.d.lexer.Token function()) stdx.d.parser.Parser.current+0x62) [0x81bcc72]
dcd-server(bool stdx.d.parser.Parser.isDeclaration()+0x4c) [0x81bbca4]
dcd-server(stdx.d.ast.ConditionalDeclaration stdx.d.parser.Parser.parseConditionalDeclaration()+0x89) [0x81b2989]
dcd-server(stdx.d.ast.Declaration stdx.d.parser.Parser.parseDeclaration()+0x6d4) [0x81b3724]
dcd-server(stdx.d.ast.Module stdx.d.parser.Parser.parseModule()+0xaf) [0x81b6d1f]
dcd-server(stdx.d.ast.Module stdx.d.parser.parseModule(const(stdx.d.lexer.Token)[], immutable(char)[], void function(immutable(char)[], int, int, immutable(char)[])*)+0x3f) [0x81b0647]
dcd-server(actypes.ACSymbol[] modulecache.ModuleCache.getSymbolsInModule(immutable(char)[])+0x19f) [0x81a157f]
dcd-server(void modulecache.ModuleCache.addImportPath(immutable(char)[])+0xd9) [0x81a13b9]
dcd-server(_Dmain+0x1ee) [0x81596fe]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x10) [0x81d3d80]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x18) [0x81d3a20]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x37) [0x81d3dc7]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x18) [0x81d3a20]
dcd-server(_d_run_main+0x121) [0x81d39f1]
dcd-server(main+0x14) [0x81d38c4]
/usr/lib/libc.so.6(__libc_start_main+0xf3) [0xb75989d3]
----------------
> dcd-server -I /usr/include/dlang/ldc
Loading and caching completions for /usr/include/dlang/ldc/object.di
Getting symbols for module /usr/include/dlang/ldc/object.di
Loading and caching completions for /usr/include/dlang/ldc/etc/linux/memoryerror.d
Getting symbols for module /usr/include/dlang/ldc/etc/linux/memoryerror.d
Loading and caching completions for /usr/include/dlang/ldc/etc/c/sqlite3.d
Getting symbols for module /usr/include/dlang/ldc/etc/c/sqlite3.d
Loading and caching completions for /usr/include/dlang/ldc/etc/c/curl.d
Getting symbols for module /usr/include/dlang/ldc/etc/c/curl.d
Loading and caching completions for /usr/include/dlang/ldc/etc/c/zlib.d
Getting symbols for module /usr/include/dlang/ldc/etc/c/zlib.d
Loading and caching completions for /usr/include/dlang/ldc/std/typecons.d
Getting symbols for module /usr/include/dlang/ldc/std/typecons.d
Could not resolve type
Could not resolve type
Loading and caching completions for /usr/include/dlang/ldc/std/socketstream.d
Getting symbols for module /usr/include/dlang/ldc/std/socketstream.d
Loading and caching completions for /usr/include/dlang/ldc/std/path.d
Getting symbols for module /usr/include/dlang/ldc/std/path.d
Loading and caching completions for /usr/include/dlang/ldc/std/numeric.d
Getting symbols for module /usr/include/dlang/ldc/std/numeric.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/processinit.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/processinit.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/math/biguintcore.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/math/biguintcore.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/math/gammafunction.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/math/gammafunction.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/math/biguintnoasm.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/math/biguintnoasm.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/math/errorfunction.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/math/errorfunction.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/math/biguintx86.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/math/biguintx86.d
Loading and caching completions for /usr/include/dlang/ldc/std/internal/windows/advapi32.d
Getting symbols for module /usr/include/dlang/ldc/std/internal/windows/advapi32.d
Shutting down sockets...
Sockets shut down.
[email protected](6435): Range violation
----------------
dcd-server(_d_array_bounds+0x16) [0x81d3886]
dcd-server() [0x81be8ff]
dcd-server(const(@property stdx.d.lexer.Token function()) stdx.d.parser.Parser.current+0x62) [0x81bcc72]
dcd-server(bool stdx.d.parser.Parser.isDeclaration()+0x4c) [0x81bbca4]
dcd-server(stdx.d.ast.ConditionalDeclaration stdx.d.parser.Parser.parseConditionalDeclaration()+0x89) [0x81b2989]
dcd-server(stdx.d.ast.Declaration stdx.d.parser.Parser.parseDeclaration()+0x6d4) [0x81b3724]
dcd-server(stdx.d.ast.Module stdx.d.parser.Parser.parseModule()+0xaf) [0x81b6d1f]
dcd-server(stdx.d.ast.Module stdx.d.parser.parseModule(const(stdx.d.lexer.Token)[], immutable(char)[], void function(immutable(char)[], int, int, immutable(char)[])*)+0x3f) [0x81b0647]
dcd-server(actypes.ACSymbol[] modulecache.ModuleCache.getSymbolsInModule(immutable(char)[])+0x19f) [0x81a157f]
dcd-server(void modulecache.ModuleCache.addImportPath(immutable(char)[])+0xd9) [0x81a13b9]
dcd-server(_Dmain+0x1ee) [0x81596fe]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x10) [0x81d3d80]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x18) [0x81d3a20]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x37) [0x81d3dc7]
dcd-server(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x18) [0x81d3a20]
dcd-server(_d_run_main+0x121) [0x81d39f1]
dcd-server(main+0x14) [0x81d38c4]
/usr/lib/libc.so.6(__libc_start_main+0xf3) [0xb758b9d3]
----------------
The client/server should be enhanced to allow an action which returns the declaration (or maybe definiton?) of the symbol currently under the cursor. The filename and location of declaration should be returned. This way editors could implement an "Jump to declaration" action.
With either the cursor at 8 or 9:
./dcd-server
./dcd-client -c8 < file.d
File.d contains:
import s
A range violation occurs and the server dies.
addr2line points to dscanner/stdx/d/parser.d:6403
DCD should be able to determine the types of variables in the following situations:
auto x = new Y;
I get a segmentation fault when running
dcd-server -I .
Expected behavior is that it includes the current directory. Otherwise, works fine when using absolute pathing. Using revision 80a9956 compiled with dmd 2.063.2 on Arch Linux.
The server segfaults before the first line of "main()", so it's safe to say it doesn't work.
If the client can read from stdin I think it will be easier for text editors to handle unsaved files. Instead of: A. force saving the file or B. save the file to a temporary file. The editor can just pass what it has in the buffer to the client.
KTextEditor has no easy way of getting the correct byte offset, but you can easily query line and column of the cursor. Adding support in D to jump to this position is way easier than doing that in C++ with KTextEditor.
Create DCD plugin for SublimeText. Use https://github.com/DisposaBoy/GoSublime as a reference on how to create the plugin.
A.d:
module A;
class Aclass { void Amember(); }
B.d:
module B;
import A;
class Bclass : Aclass { void Bmember(); }
main.d:
module main;
import B;
class MainClass : Bclass {}
void main()
{
Bclass instanceB = new Bclass();
MainClass instanceM = new MainClass();
instanceB. // autocomplete here
instanceM. // autocomplete here
}
Amember
and Bmember
provided in DCD output for both.
Only Bmember
is provided in either autocomplete suggestion list.
On commit 8083e9a (Oct. 2nd).
Importing module A
in main.d allows DCD to find void Amember()
.
As I'm not sure if this is a bug in DCD or in the Dscanner source tree, here too is the commit and date for the Dscanner branch cloned on my machine for DCD: dlang-community/D-Scanner@cd3bb40 (Sep. 15).
Thanks so much for this project!
Currently DCD doesn't seem to be able to handle incomplete code in all cases. Example:
module foo;
struct Foo
{
int a;
}
void main ()
{
Foo foo;
foo.
}
Trigger code completion for the above works fine. But if I remove the last closing curly brace I get the following error in the server "Could not find declaration of foo".
DCD uses Parser as a class but the submodule to dscanner points at a commit that predates the change of Parser from a struct to a class.
string[] args;
args. //completion shows e.g. length property
but
string args[];
args. // "Could not find declaration of args" in server output.
Of course this holds for static arrays and any other type.
Small problem easy fix
server.d line 177 void warnAboutOldConfigLocation()
version (linux) if ("~/.config/dcd".expandTilde().isFile())
"~/.config/dcd" doesn't exist so isFile throws.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.