Closed ryuukk closed 1 year ago
Actually the 2 previous commits are not needed if i move the code to the third phase where all symbols are fully resolved, that wasn't fully useless since we got more tests now, so i'll be working on that now, then i'll apply review recommendations
Was stress testing this PR on my project and found an issue:
I don't get any completion for the following:
pollfd[] fds;
auto ptr = &fds[i];
If i remove &
then i get completion
I forgot about this PR i'll try to apply suggestions and fix the one last bit soonish
Another problem:
HashMap!(const(char)[], int) map;
Having const
there breaks template resolution, i'll have to fix that
try making a minimal version first before we fix things like const rules, which are generally quite broken in DCD anyway
â ïļ This PR introduces new warnings:
2023-10-05T03:51:11.466 [warning] localuse.d:121:findLocalUse No or ambiguous symbol for the identifier at cursor
2023-10-05T03:51:11.472 [warning] complete.d:575:setImportCompletions Could not find ["tc036"]
2023-10-05T03:51:11.491 [warning] complete.d:575:setImportCompletions Could not find ["tc036"]
2023-10-05T03:51:11.498 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("a") from position 11
2023-10-05T03:51:11.543 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("things") from position 48
2023-10-05T03:51:11.543 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("things") from position 48
2023-10-05T03:51:11.543 [warning] symbols.d:61:findDeclaration Could not find symbol declaration
2023-10-05T03:51:11.601 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("te") from position 46
2023-10-05T03:51:11.601 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring(")") from position 46
2023-10-05T03:51:11.601 [warning] doc.d:52:getDoc Could not find symbol
2023-10-05T03:51:11.665 [warning] first.d:760:visit Could not resolve location of module 'tc_access_modifiers/bar'
2023-10-05T03:51:11.696 [warning] first.d:760:visit Could not resolve location of module 'tc_access_modifiers/bar'
2023-10-05T03:51:11.773 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("foo") from position 11
2023-10-05T03:51:11.822 [warning] complete.d:469:importCompletion Could not resolve location of empty
2023-10-05T03:51:11.826 [warning] main.d:331:runServer Received a search request without source code
2023-10-05T03:51:11.827 [warning] main.d:331:runServer Received a autocomplete request without source code
2023-10-05T03:51:11.829 [warning] main.d:331:runServer Received a doc request without source code
2023-10-05T03:51:11.831 [warning] main.d:331:runServer Received a localUse request without source code
2023-10-05T03:51:11.880 [warning] complete.d:204:dotCompletion cursor positioned within a UTF sequence
2023-10-05T03:51:11.931 [warning] complete.d:469:importCompletion Could not resolve location of point
2023-10-05T03:51:11.950 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("super") from position 28
2023-10-05T03:51:11.953 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("super") from position 59
2023-10-05T03:51:12.135 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("\"foo\"") from position 127
2023-10-05T03:51:12.139 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("\"foo\"") from position 131
2023-10-05T03:51:32.801 [warning] localuse.d:121:findLocalUse No or ambiguous symbol for the identifier at cursor
2023-10-05T03:51:32.806 [warning] complete.d:575:setImportCompletions Could not find ["tc036"]
2023-10-05T03:51:32.832 [warning] complete.d:575:setImportCompletions Could not find ["tc036"]
2023-10-05T03:51:32.842 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("a") from position 11
2023-10-05T03:51:32.941 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("things") from position 48
2023-10-05T03:51:32.942 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("things") from position 48
2023-10-05T03:51:32.942 [warning] symbols.d:61:findDeclaration Could not find symbol declaration
2023-10-05T03:51:33.066 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("te") from position 46
2023-10-05T03:51:33.066 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring(")") from position 46
2023-10-05T03:51:33.066 [warning] doc.d:52:getDoc Could not find symbol
2023-10-05T03:51:33.219 [warning] first.d:760:visit Could not resolve location of module 'tc_access_modifiers/bar'
2023-10-05T03:51:33.277 [warning] first.d:760:visit Could not resolve location of module 'tc_access_modifiers/bar'
2023-10-05T03:51:33.510 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("foo") from position 11
2023-10-05T03:51:33.666 [warning] complete.d:469:importCompletion Could not resolve location of empty
2023-10-05T03:51:33.670 [warning] main.d:331:runServer Received a search request without source code
2023-10-05T03:51:33.672 [warning] main.d:331:runServer Received a autocomplete request without source code
2023-10-05T03:51:33.674 [warning] main.d:331:runServer Received a doc request without source code
2023-10-05T03:51:33.676 [warning] main.d:331:runServer Received a localUse request without source code
2023-10-05T03:51:33.770 [warning] complete.d:204:dotCompletion cursor positioned within a UTF sequence
2023-10-05T03:51:33.895 [warning] complete.d:469:importCompletion Could not resolve location of point
2023-10-05T03:51:33.928 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("super") from position 28
2023-10-05T03:51:33.937 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("super") from position 59
2023-10-05T03:51:34.578 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("\"foo\"") from position 127
2023-10-05T03:51:34.588 [warning] util.d:232:getSymbolsByTokenChain Could not find declaration of istring("\"foo\"") from position 131
â This PR fixes following deprecations:
../../../.dub/packages/msgpack-d/1.0.4/msgpack-d/src/msgpack/unpacker.d(18,26): Deprecation: using `in` parameters with `extern(C)` functions is deprecated
Total deprecations: 110
Total warnings: 52
Build statistics:
statistics (-before, +after)
client size=1065920 bin/dcd-client
-server size=3096472 bin/dcd-server
-rough build time=77s
+server size=3113304 bin/dcd-server
+rough build time=79s
-DCD run_tests.sh Elapsed (wall clock) time (h:mm:ss or m:ss): 0:08.60
-DCD run_tests.sh Maximum resident set size (kbytes): 43680
+DCD run_tests.sh Elapsed (wall clock) time (h:mm:ss or m:ss): 0:08.73
+DCD run_tests.sh Maximum resident set size (kbytes): 45860
-short requests: (230x)
+short requests: (232x)
min request time = 0.011ms
- 10th percentile = 0.125ms
- median time = 0.453ms
- 90th percentile = 0.752ms
- max request time = 1.566ms
+ 10th percentile = 0.114ms
+ median time = 0.450ms
+ 90th percentile = 0.800ms
+ max request time = 1.624ms
long requests over 10ms: (51x)
- min request time = 18.322ms
- 10th percentile = 19.762ms
- median time = 21.405ms
- 90th percentile = 23.398ms
- max request time = 32.025ms
+ min request time = 19.821ms
+ 10th percentile = 20.640ms
+ median time = 22.136ms
+ 90th percentile = 25.041ms
+ max request time = 32.946ms
top 5 GC sources in server:
bytes allocated, allocations, type, function, file:line
- 78109696 843 void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3634
- 15257216 476788 void[] core.lifetime._d_newitemT!(Data)._d_newitemT /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/druntime/import/core/lifetime.d:2833
- 14316800 164422 void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3634
- 9773344 305417 Data std.array.Appender!string.Appender.this /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3509
- 7371616 281 ubyte[] msgpack.unpacker.Unpacker.InternalBuffer!().initializeBuffer ../../../.dub/packages/msgpack-d/1.0.4/msgpack-d/src/msgpack/common.d:628
+ 126985216 856 void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3634
+ 15280416 477513 void[] core.lifetime._d_newitemT!(Data)._d_newitemT /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/druntime/import/core/lifetime.d:2833
+ 14396864 165286 void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3634
+ 9775680 305490 Data std.array.Appender!string.Appender.this /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3509
+ 7372240 283 ubyte[] msgpack.unpacker.Unpacker.InternalBuffer!().initializeBuffer ../../../.dub/packages/msgpack-d/1.0.4/msgpack-d/src/msgpack/common.d:628
Hmm, something has changed in DCD or libdparse, i rebased and nothing works anymore
I don't understand what's going on with the tests
Another problem found:
alias StreamBE = Stream!false;
void read(StreamBE* reader)
{
reader.
}
I don't get completion, not sure if that's a problem for this PR, i'll have to test later, typing it here so i don't forget
If i remove the *
then i get completion
EDIT:
Ok i can confirm that it works with master, so this is a problem with this PR
To reproduce:
struct ReaderTest(bool LE)
{
void read_test(){}
}
alias ReaderTestBE = ReaderTest!true;
struct Test
{
void read(ReaderTestBE* reader)
{
reader.
}
}
Remove the *
and you'll get completion
Something got broken since the time i came up with this PR, tests were all passing, now it's all broken..
Was there undocumented new changes?
I added a new test case for the problem above and a fix
failed merge / rebase? You can see in the commits that there is a lot of unrelated stuff
failed merge / rebase? You can see in the commits that there is a lot of unrelated stuff
maybe, i am git noob, i don't know what i am doing with git commands lol, i hate git
I'll try to fix it for you, but can you make sure that everything you have right now is pushed or stashed? Since I'll be force pushing you will most likely need to reset your local state afterwards.
so after rebase the issues still persist, most likely internals in DCD have changed since you made your PR, since this PR is quite old now. Might make sense to just take the diff and the test cases and reapply them manually to master, taking what makes sense and reusing what exists.
I'm not sure what to do with this PR
I'm using it and it works great for simple templates, but it broke some tests since few commits went into DCD in the mean time
I don't want to spent any more time investigating the tests because i want to try to get rid of libdparse and use DMD as a library instead, the end goal is to try to make use of -vgc_ast for both templates/mixins
Or perhaps add a new flag for DMD, so it could instead of writing stuff in file, simple just return proper data structure for DCD when used as a library, we'll see where this goes
I'm polishing this PR before starting the work on the other stuff
Getting there:
Was stress testing this PR on my project and found an issue:
I don't get any completion for the following:
pollfd[] fds; auto ptr = &fds[i];
If i remove
&
then i get completion
This problem is now fixed
Now supports arrays!
fuck this got closed because i think i deleted the fork....
fuck git
is there a way to get this cloned?
Recursion is disabled due to an issue with the way i do the mapping (i'll have to probably rewrite it)
But for now this works very nicely
Template support in DCD is now a thing! ð
Some screenshots: