0
Fixed

Crash with Golang tmbundle

Matt Keranen 11 years ago updated by Alexander Blach (Developer) 11 years ago 3

Installed a Textmate bundle for Go into ~/Library/Containers/com.textasticapp.textastic-mac/Data/Library/Application Support/Textastic with


git clone git://github.com/AlanQuatermain/go-tmbundle.git Go.tmbundle


Upon restart and opening a .go file, Textastic crashes:


Process:         Textastic [52162]
Path:            /Applications/Textastic.app/Contents/MacOS/Textastic
Identifier:      com.textasticapp.textastic-mac
Version:         1.1 (10)
App Item ID:     572491815
App External ID: 15056171
Code Type:       X86-64 (Native)
Parent Process:  launchd [154]
User ID:         502
Date/Time:       2013-08-01 17:18:11.015 -0400
OS Version:      Mac OS X 10.8.4 (12E55)
Report Version:  10
Interval Since Last Report:          1207848 sec
Crashes Since Last Report:           60
Per-App Interval Since Last Report:  713006 sec
Per-App Crashes Since Last Report:   3
Anonymous UUID:                      8FBEE994-3FCF-346B-B5CE-89CD304E101B
Crashed Thread:  2  Dispatch queue: com.apple.root.default-priority
Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSArray arrayByAddingObject:]: object cannot be nil'
abort() called
terminate called throwing an exception


Answer

Answer
Fixed

The Go language grammar uses features of TextMate 2 which seems to support an extended syntax for language grammars. This extension allows to define patterns within captures which was not supported in TextMate 1. Textastic doesn't support this syntax and expected a scope name instead which resulted in a crash.


The crash happens while parsing this line:


    for k, v := range m {



Although Textastic won't fully support the new features, the crash will be fixed in the next version and the Go bundle is usable. It just won't highlight the variable names 100% correctly.

Hello, thanks for your report.


Does this happen with any (i.e. even an empty) .go file? If not, can you send me a .go file that causes it to crash?

It does not happen on a simple "Hello World" file, but something in this snippet triggers the crash:


package main

import (
    "fmt"
)
func main() {
    m = make(map[string]int64)
    for k, v := range m {
        fmt.Printf("%s,%d,", k, v)
    }
}


If I remove the tmbundle it loads without issue.

Thanks, I can reproduce it now. I assume that it is a problem in the language definition, but even if it is, it shouldn't crash the app. I'll try to find out what's happening.

Answer
Fixed

The Go language grammar uses features of TextMate 2 which seems to support an extended syntax for language grammars. This extension allows to define patterns within captures which was not supported in TextMate 1. Textastic doesn't support this syntax and expected a scope name instead which resulted in a crash.


The crash happens while parsing this line:


    for k, v := range m {



Although Textastic won't fully support the new features, the crash will be fixed in the next version and the Go bundle is usable. It just won't highlight the variable names 100% correctly.