vicoapp / vico

Mac Programmers Text Editor
http://www.vicoapp.com/
658 stars 89 forks source link

broken Haskell #66

Closed joshkuten closed 11 years ago

joshkuten commented 11 years ago

I just built from master and installed this bundle.

When I type something like:

stuff :: a -> a

I only get as far as stuff : -- typing the second : exits me from insert mode and seems to break things. I cannot get it to do anything except move the curser around some. Other windows work but the broken one becomes useless.

The module works on textmate without issue.

I don't know what to do to debug this further.

Shadowfiend commented 11 years ago

Let me have a look at that. There have been a couple of bundles lately that have had some interesting effects. One thing you could do is run it from the command line (with make run) and see if you get an exception report. Either way, I will investigate myself as well, hopefully tonight.

joshkuten commented 11 years ago

looks like each key stroke renders this:

2013-10-24 14:52:26.491 Vico[30445:303] Exception detected while handling key input.
2013-10-24 14:52:26.491 Vico[30445:303] *** NSRunStorage, _NSBlockNumberForIndex(): index (31) beyond array bounds (31)
2013-10-24 14:52:26.493 Vico[30445:303] (
    0   CoreFoundation                      0x00007fff8a67541c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff89aa4e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8a6752cc +[NSException raise:format:] + 204
    3   AppKit                              0x00007fff92835767 _NSBlockNumberForIndex + 85
    4   AppKit                              0x00007fff928383c1 -[NSLayoutManager textContainerForGlyphAtIndex:effectiveRange:] + 274
    5   AppKit                              0x00007fff929ba87c -[NSTextView drawsVerticallyForCharacterAtIndex:] + 198
    6   AppKit                              0x00007fff929ba79e -[NSTextInputContext drawsVerticallyForCharacterAtIndex:] + 41
    7   AppKit                              0x00007fff929ba736 -[NSTextInputContext remapsArrowKeysForVerticalOrientation] + 76
    8   AppKit                              0x00007fff9299ae29 -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] + 200
    9   AppKit                              0x00007fff929ba188 -[NSTextInputContext handleEvent:] + 435
    10  AppKit                              0x00007fff92999b5d -[NSView interpretKeyEvents:] + 180
    11  AppKit                              0x00007fff929b9ecd -[NSTextView keyDown:] + 658
    12  Vico                                0x00000001100f91c6 -[ViTextView keyDown:] + 134
    13  AppKit                              0x00007fff9296681b -[NSWindow sendEvent:] + 1843
    14  AppKit                              0x00007fff92907ca2 -[NSApplication sendEvent:] + 3395
    15  AppKit                              0x00007fff92757a29 -[NSApplication run] + 646
    16  AppKit                              0x00007fff92742803 NSApplicationMain + 940
    17  Vico                                0x000000011012df53 main + 179
    18  libdyld.dylib                       0x00007fff89fe15fd start + 1
    19  ???                                 0x0000000000000002 0x0 + 2
)

or something like this:

2013-10-24 14:53:33.586 Vico[30445:303] !!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 32

and sometimes certain key combos will alter somethings, but it's kind of erratic. Maybe the bundle tries to move the cursor beyond some limit when :: is entered.

screen shot 2013-10-24 at 2 56 33 pm 2

you can see here that I was able to enter some text somewhere, but it does not actually show up in the real file:

screen shot 2013-10-24 at 2 57 59 pm

Shadowfiend commented 11 years ago

Wow! That's exciting! Thanks for the spelunkingl I'll see if I can find a quick fix for it! I'm actually wondering if this isn't related to the way the completion window is implemented. It's a bit hackier than it should be, and redoing it in a way that interacts with the editor better is on the to-do list. I hope we can fix this without having to redo it though, as that will be a more involved process and I was hoping to put it off a bit longer >_>

Shadowfiend commented 11 years ago

The branch I've just attached to this issue (complex-capture-highlighting) fixes the bad behavior. It probably doesn't highlight the :: segment properly, because the issue is that Vico doesn't deal with captures at the beginning of a block that have complex highlighting definitions (specifically, definitions that do more than just assign a scope to that capture). I pushed a stopgap that guards for the bad condition and just doesn't highlight the capture.

I'll work on actually adding support for the complex pattern in the coming days.

Thanks for giving me an opportunity to dive into a corner of the codebase I hadn't gone into yet :D

Shadowfiend commented 11 years ago

Heh. In fact, TextMate's documentation says that the Haskell bundle's syntax file is invalid by using a pattern where it's only supposed to have a name >_>

I'll fix it anyway :p

Shadowfiend commented 11 years ago

Ok, turns out I was motivated tonight. The branch should now properly highlight the Haskell function name as as function name. Try it on for size when you get a chance.

joshkuten commented 11 years ago

Works great for me so far

Shadowfiend commented 11 years ago

Awesome! I'll let you work with it for a day or two and then merge if I don't hear any horror stories :)

JoshRagem commented 11 years ago

Hi, this is my non-work account.

The parsing is working well, but I got this error when making on my home machine:

git submodule update --init --recursive -- .
fatal: reference is not a tree: a6738814e36e5175536f9dde884023d62e8d73cb
Unable to checkout 'a6738814e36e5175536f9dde884023d62e8d73cb' in submodule path 'Bundles/vicoapp-php.tmbundle'

Seems the branch references a sub-module commit that does not exist on the remote repo. I was still able to build by switching to master and building (cloning submodules) and then switching back and re-building. This is only related to the original issue because it is on the complex-capture-highlighting branch.

Shadowfiend commented 11 years ago

Ugh… Not sure how that snuck its way into that branch… I've been doing some work with the submodules today, so it's possible that switching branches will get you in trouble, or that I screwed up the PHP submodule there. Grrr. I'll merge this into master, which should be working properly. If it isn't, please go ahead and open another issue. I'm investing some time right now to get things building end-to-end in XCode so that I can set up one of these fancy XCode bots and finally start producing a snapshot build of Vico so people don't have to compile it if they're not developing, but I think that's going to lead to some instability in the project for the next few days.

Hang tight!