So we lookup by the definition MyTemplate!(int, float) and we get a properly constructed type!
Problems: only available after compilation
So the code should be compilable (not usable while editing your code)
Depending on projects, compilation can be slow so this is not a good real-time feature
Whenever a user compile its project, hook the command, add the thing to get the AST ouput, and cache the result
So whenever we generate the auto completion result, we can use this cached data to construct proper types, this way we can turn this into a real-time feature!
The compiler arg is: -vcg-ast
It will create a file name next to the module file: mymodule.d.cg, so this is the file that needs to get parsed
I wonder if it can be made for DMD to output the content to stdout instead of a new file
It seems pretty fast, on my game project, it only add 50miliseconds to compile time
I just noticed it's possible to get AST after all semantic phases with DMD
What if server-d would manage to get that output to retrieve proper type of templats?
Example: https://run.dlang.io/is/h4fjXB (click on AST)
Will generate:
So we lookup by the definition
MyTemplate!(int, float)
and we get a properly constructed type!Problems: only available after compilation
So the code should be compilable (not usable while editing your code)
Depending on projects, compilation can be slow so this is not a good real-time feature
Whenever a user compile its project, hook the command, add the thing to get the AST ouput, and cache the result
So whenever we generate the auto completion result, we can use this cached data to construct proper types, this way we can turn this into a real-time feature!
The compiler arg is:
-vcg-ast
It will create a file name next to the module file:
mymodule.d.cg
, so this is the file that needs to get parsedI wonder if it can be made for DMD to output the content to stdout instead of a new file
It seems pretty fast, on my game project, it only add 50miliseconds to compile time