-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor mode for Swift #123
Comments
I don't think that swift-mode works like js2-mode. Which is to say, js2-mode implements a complete Javascript parser in order to allow accurate highlighting, refactoring, etc. Are you proposing creating a full Swift parser in elisp? |
@ryanprior I guess that would be the best route. Having a Swift parser would definitely help build something like js2-mode and a refactor mode. Maybe utilize something in Apple's new Swift repos? |
irony-mode has a server that uses llvm's libclang to generate accurate data for auto-completion, documentation, etc for C, C++, and Objective-C. Swift also uses llvm, so we might be able to extend irony to cover Swift. It would be nice to have a single platform that can understand both Objective-C and Swift. irony doesn't have any facilities for refactoring yet, but if we built them for Swift then it would be that much easier to extend them to irony's other languages. Another possible avenue would be to extend Semantic to support Swift. That could be done directly in elisp. However, Semantic tends to be fairly slow, and we would have to track changes in upstream Swift language and reflect them in our own implementation. The benefit is that Semantic already has various kinds of refactoring tools and provides a great platform for building more. There is a thread that connects these two approaches: in 2013 there was some work done to provide the information Semantic needs using irony's server as a backend. js2-refactor uses another approach entirely, which is to write a parser in elisp from scratch. I wouldn't go that route personally, but I'm interested to hear your thoughts and definitely want to build some great Emacs tooling around Swift. |
@ryanprior I definitely think that using The refactoring bit will come easier once we have a parser that understands Swift. So, I think working on extending irony to support Swift is the first battle. I've never used irony so I would first have to understand how it all works. Any tips or places to start with irony that would help me understand exactly how the auto-completion, documentation, etc is handled? Also, I don't know if you saw but auto-completion for Swift is already sort of working with company-sourcekit so we might be able to use it as a reference. Also, I do think that building off of Either way, let me know your thoughts. |
I'd start with the user documentation for To make a comparison to Although I use So the first steps are ask the irony maintainers to see if they have opinions, read more into how irony's server works, and learn about Swift's toolchain. |
@ryanprior Thanks for the response, I'll follow the issue opened up for |
I've been trying to start a refactoring mode for Swift that would work something like js2r-refactor by Magnar. I keep thinking that
Swift-mode
would need to be updated to find nodes, etc. Just wanted to know what any of you thought about this mode and if anybody would like to help.Thanks!
The text was updated successfully, but these errors were encountered: