textmate / swift.tmbundle

TextMate support for Swift
72 stars 30 forks source link

Auto-completion and documentation look-up #10

Closed macavon closed 2 years ago

macavon commented 9 years ago

If Textmate is to be seen as a serious alternative to Xcode for editing Swift, this bundle needs to provide comparable auto-completion and documentation look-ups, the way the Objective-C bundle does for that language.

I think that someone who knew their way around the Obj-C bundle shouldn't find it too difficult to adapt the code to index a project and perform these operations within it, but there seems to be a problem with the built-in frameworks – I can't get at the relevant declarations. The trick described in http://ericasadun.com/2014/08/20/swift-xcode-beta-6-accessing-swift-native-definitions/, which worked with Xcode 6 beta doesn't seem to work with the current release version. I can't get it to work, anyway.

I may get a chance to look into this myself later, but I don't presently understand how the existing scripts work, so this is really a request for anybody who is deeper into bundle development to give it a go, please.

I'm not trying to start an editor war over whether Xcode or TM gets to be the Swift editor of choice, but I can't be the only one who is more comfortable in TM, so it would be nice to be able to use it for as much Swift work as possible. Especially as Swift editing in Xcode seems to be perenially borked, judging from what I read in the Apple Developer forums.

sorbits commented 8 years ago

Documentation lookup added in 5db5af5a02646e99beaac4d6b05f55a8b8cd677e.

It is currently passing the current word/selection to docsetutil. Ideally we would change the behavior when caret is on a function call/prototype to parse out the parameter names and do a lookup for the current function. Shouldn’t actually be too hard, just a regexp match against TM_CURRENT_LINE.

macavon commented 7 years ago

I just came across this:

https://github.com/terhechte/TextMateSwiftCompletion

which uses SourceKitten to add completions. I'd be entirely out of my depth trying to integrate this, or something like it, into this bundle, but perhaps there's somebody watching the issue who could do it.

Would be pretty neat.