swift-emacs / swift-mode

Emacs support for Apple's Swift programming language.
GNU General Public License v3.0
370 stars 47 forks source link

Feature request: jump to declaration #140

Closed Pitometsu closed 7 years ago

Pitometsu commented 7 years ago

Is it possible to achieve "jump to symbol declaration" in swift-mode?

taku0 commented 7 years ago

We can use ctags:

  1. Append this ctags setting from swift.vim to ~/.ctags.
  2. Run find . -name '*.swift' -print0 | xargs -0 ctags -e in your project root directory. This will create an index file named TAGS. We need Exuberant Ctags or universal ctags. ctags bundled with Emacs does not seems to work. If you get Invalid character class name error, replace [[:<:]] and [[:>:]] in the .ctags file with \b.
  3. Type M-. in Swift code. Emacs may ask you where is TAGS file.

Alternatively, we may able to utilize SourceKit, SourceKitten, and/or SourceKittenDaemon to be smarter, but it will need a lot of work.

Pitometsu commented 7 years ago

Confirm: universal ctags works enough good. Many thanks!