diet-complete 0.0.3
Error correcting diet parser with integrated auto-completion and neat AST tools
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
DietComplete
An error correcting diet parser based on the diet-ng spec. See SPEC.md for the added grammar by this repository.
Example
import std.algorithm;
import std.conv;
import std.stdio;
import dietc.complete;
void main()
{
// Create completion engine from filename
// You can also pass a parsed document with a callback for other files in the future (from extend tags)
auto complete = new DietComplete("views/filename.dt");
size_t offset = 12;
// Use completeAt to get completion results for a specific byte offset in the code
auto completion = complete.completeAt(offset);
if (completion is Completion.completeD)
{
size_t dOffset;
string dCode;
complete.extractD(offset, /*out*/ dCode, /*out*/ dOffset);
// special instruction that D code should be completed here
writeln("Complete D code ", dCode, " at ", dOffset);
}
else
completion.map!(a => text(a.type, ": ", a.text)).each!writeln;
}
- 0.0.3 released 5 years ago
- Pure-D/DietComplete
- MIT
- Copyright © 2018-2019 webfreak
- Dependencies:
- none
- Versions:
-
0.0.3 2019-Jul-09 0.0.2 2019-Jul-09 0.0.1 2018-Sep-11 ~master 2020-Jan-13 - Download Stats:
-
-
10 downloads today
-
78 downloads this week
-
245 downloads this month
-
14491 downloads total
-
- Score:
- 2.2
- Short URL:
- diet-complete.dub.pm