Nightfury
- automatic language-independent autocompletion engine relying on EBNF syntax
Project Goal
The primary goal is to minimise the time programmers spent on typing syntax. It's aim is not to (fully) replace LSP, but to work alongside it.
Concept
For instance, take this variable declaration in Java: double PI;.
You would start typing this by first pressing the letter 'd'. Nightfury sees that and compares it against an internal data structure. If only the token double is possible at the location in the code, it'll automatically autocomplete it for you. But what now? The Java syntax demands a variable name here, a string which the programmer is free to choose themselves. Nightfury can't (and won't) interfere with that, instead quietly listening for a token that terminates the identifier, a semicolon in this case.
To at least try to be language-independent, the project uses the ebnf parser crate as well as a custom translator to convert conventional EBNF-diagrams into its internal data structure.
Features
- EBNF-based tree generator
- constructs seem to work fine on their own
- needs more testing to catch edge cases when combining
- IDE-independent client-server architecture
- lots of customization-potential
Running
Reading the FSM
Run the program in debug mode. Most of its output is debugging information, which will be documented someday. For now, you just need the section after FSM:. This is the FSM nightfury generated from the provided ebnf. It currently supports three types of nodes:
Keyword: some keyword, has two important fields:expanded(the actual keyword) andshort(the character sequence you need to type for it to be autocompleted)- Note: if nightfury can definitely determine what keyword should be inserted before you finish typing the entire short-sequence, it will insert it without needing you to finish typing the
shortsequence
- Note: if nightfury can definitely determine what keyword should be inserted before you finish typing the entire short-sequence, it will insert it without needing you to finish typing the
UserDefinedRegex: section for a userdefined token, e.g. identifiers. Your input has to match the regex for it to be completed- Note: in certain cases, nightfury can look ahead and insert the next keyword automatically, without you needing to type its
shortsequence
- Note: in certain cases, nightfury can look ahead and insert the next keyword automatically, without you needing to type its
Null: placeholder node, used to either combine paths or split them apart
Sidenote: there is technically another type, UserDefined, which marks userdefined areas that are explicitly terminated by a character. It's unused as EBNF doesn't have a way of expressing such a thing right now.
The indentation shows you the general flow of the graph. If you see a "Cycle to ID", then that means there is a node link that cannot cleanly be displayed in the tree view (e.g. cycles)
Architecture
libcrate: actual logic, largely client-independentbincrate: demo app, will be made into an example in the future