Open naam00 opened 8 years ago
It's unlikely that I'd have time to look at this, but if anyone's interested, take a look at the ace editor documentation (search for "Code Folding"), and see if you can find a way to integrate it into the ink ace mode.
But after a quick look at Ace's folding implementation, it seems that it relies on a "stop marker" (e.g. for code that uses brackets like {
and }
). Unfortunately we have no such thing in ink, which could make it tricky... but maybe looking at a language like Python that uses whitespace might give you an answer.
Hi I'm trying to implement the code folding feature, but as a little test I edited the ace-ink.js file to include a new ending tag, like this:
"#divert": [{
// -> DONE|END
regex: /(->|<-)(\s*)(DONE|END|NEWEND)(\s*)/,
token: [
"divert.operator", // ->
"divert", // whitespace
"divert.to-special", // DONE / END
"divert" // whitespace
]
}
but when I install and run the editor doesn't seems to recognize the new word,. Do I have to change another file in order to make this work?
Hrm. Not at my computer so I can't double check, but theoretically that should be it! So, not sure I'm afraid... On Sat, 30 Jul 2016 at 16:19, Miguel Angel Maciel notifications@github.com wrote:
Hi I'm trying to implement the code folding feature, but as a little test I edited the ace-ink.js file to include a new ending tag, like this:
"#divert": [{ // -> DONE|END regex: /(->|<-)(\s)(DONE|END|NEWEND)(\s)/, token: [ "divert.operator", // -> "divert", // whitespace "divert.to-special", // DONE / END "divert" // whitespace ] }
but when I install and run the editor doesn't seems to recognize the new word,. Do I have to change another file in order to make this work?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/inkle/inky/issues/22#issuecomment-236370802, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0bV-00YZH3g7XTCNq0lz38GYEeXGpuks5qa2uOgaJpZM4I_XE7 .
Hi, I already solved it, I just had to clone the repository again. I have a question.
I have implemented the code folding feature, but since the ink language doesn't count the indentation space to make a block, this feature could misbehave if a user enters tabs at some points.
One suggestion is to use a code-folding keyword, that doesn't have to be merged in the ink language, but can be an inky editor feature, like the
It was a dark and stormy night, when I heard a knock on my front door.
I didn't know what to do
//FOLD options
* [Open door]
-> OpenDoor
-> InBed
* [Watch by the window]
I saw a human form in my front door.
** [Open the door]
-> OpenDoor
//ENDFOLD
== OpenDoor
Nothing...
Just the darkest night I'd ever seen
I closed the door and returned to my bed
-> InBed
== InBed
I wonder if that was just my imagination
-> END
I was imagining that you could use knot and stitch declarations as the top level code fold markers, and then use the number of bullets in a choice or gather for the lower level code fold markers, rather than whitespace. Any reason that wouldn't work...?
With Pull Request #331 , while it doesn't address this particular issue, an inkFoldingRules class has been added in, which should make it easier to solve this issue.
Is it possible to fold a choice branch? If not: would be a great addition!