Change of 'word' breaks 'before' param
Hi,
I tried to switch to 0.4.0 and the change of fetching method for word (https://github.com/f/omelette/commit/b74b23209f5b8254f0d28b120fdfbf034086c30c#diff-564d24cceffda49c18bf427e92b8baa3R23) makes the parameter before undefined when an incomplete word is tabbed.
Ex:
lorem <tab><tab> -> a1 b1 👍
lorem a<tab> -> a1 👍
lorem a1 <tab><tab> -> a2 b2 c2 👍
lorem a1 a<tab> -> nothing 👎
My script that goes like this
const autocomplete = {
'a1': {
'a2': {
'a3': {
'a4': {},
'b4': {}
},
'b3': {}
},
'b2': {},
'c2': {}
},
'b1': {
'a2': {},
'b2': {
'a3': {
'a4': {},
'b4': {}
},
'b3': {}
},
'c2': {}
}
};
const completion = omelette('lorem');
completion.on('$1', ({ reply }) => {
reply(Object.keys(autocomplete));
});
completion.on('$2', ({ reply, before }) => {
try {
reply(Object.keys(autocomplete[before]));
} catch (e) {}
});
completion.on('$3', ({ reply, before, line }) => {
const [, lvl1] = line.split(' ');
try {
reply(Object.keys(autocomplete[lvl1][before]));
} catch (e) {}
});
completion.on('$4', ({ reply, before, line }) => {
const [, lvl1, lvl2] = line.split(' ');
try {
reply(Object.keys(autocomplete[lvl1][lvl2][before]));
} catch (e) {}
});
completion.init();
-Out of context-
This tree thingy made me excited! Very nice idea! I wrote a PoC for Omelette to support tree syntax.
Can you check https://github.com/f/omelette/tree/completion-tree#autocompletion-tree?
The problem still exists btw, I'll check it out.
Ups, accidentally closed :)
Wow this is way more than I asked for! Works really well and simplifies my implementation. Kudos 👍
Wdyt should i merge it?
7 May 2017 Paz 16:34 tarihinde Jb [email protected] şunu yazdı:
Wow this is way more than I asked for! Works really well and simplifies my implementation. Kudos 👍
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/f/omelette/issues/10#issuecomment-299706724, or mute the thread https://github.com/notifications/unsubscribe-auth/AAL_ffFoieFVi9l0pV3HKXIKiyNkyA6rks5r3ch1gaJpZM4NSwdx .
Hell yeah!
https://github.com/f/omelette/blob/master/README.md#autocompletion-tree 😍 Thank you @jblandry for this great improvement!
FYI: The original bug is still there.
Sorry about it, can you explain the original bug again please?
Everything is in the first post of this thread :)
Just hit this as well.
My workaround is to implement before manually using line, but i'd really rather not to