I'm sure there's a sensible explanation for this, but I get weird auto complete suggestions in sublime text 3 when coding in ruby or a ruby section in a markdown. Examples - I was hoping it would suggestion the .capitalize method, but instead:
In .md file:
In .rb file:
What I've tried
I looked in my autocomplete preferences, but I don't see anything out of place:
// Enable auto complete to be triggered automatically when typing.
"auto_complete": true,
Question
Why the autocomplete is making bizarre suggestions?
The auto_complete feature of sublime text 3 just scans the files inside of the folder structures and provides those "words" as autocomplete. What you are looking for is called CodeIntel or intelli-sense. Unfortunately those features are usually only available on full blown IDEs.
Sublime has some plugins which are a bit old but should still work:
https://packagecontrol.io/packages/Ruby%20Completions (last update 6 years ago)
https://packagecontrol.io/packages/SublimeCodeIntel (last update 4 years ago)
As an alternative you could use LSP but this requires that you have specific language servers installed:
https://packagecontrol.io/packages/LSP (recent updates)
Related
I'm using the latest build of Sublime Text 3. When typing %i[foo bar] Sublime does not seem to recognize this and I don't get the proper highlighting.
Has anyone else experienced this? If so, is there a way I can fix this on my end or is this something that Sublime HQ would have to fix?
The %i[foo bar] # [:foo :bar] literal notation for a symbol array was only implemented in Ruby 2.0, while the Ruby language definition that ships with ST3 is mostly focused on 1.9 and earlier. I searched around a bit, but unfortunately I couldn't find any .tmLanguage files that are updated for 2.0, let alone include this literal notation, so I can't point you to a ready-made solution. But, I do have a few suggestions.
First, head over to the unofficial Sublime Text Issues tracker and post a bug report. We're not sure how much attention is paid to this list by the developer, but it at least broadens the issue's visibility and may prompt someone to post a fix. You can also reply to this thread on the Sublime Text forum and perhaps reference your issue.
The second option, if you have good regex-fu, is to hack the Ruby.tmLanguage file and add support yourself. I was going to post directions on how to do it, but then I tried it myself and it seemed to work, so feel free to use my work:
Go to Preferences -> Browse Packages to open up the Packages folder in your system's file explorer.
Create a folder called Ruby2.
Copy the contents of this gist into a new file, and save it in your Ruby2 directory as Ruby2.tmLanguage.
Restart Sublime, switch to your problematic code, and select View -> Syntax -> Ruby2. Both lines should now be highlighted the same way. Here's a before and after screenshot using the Neon Color Scheme:
I hope this helps. I'm not a Rubyist, so if I made any blatant errors please let me know.
From my (brief) research there definitely seems to be a need for an updated version of Ruby.tmLanguage for all the new features in 2.0, so hopefully any issues you post will prompt someone to start/publish a project. I've already done something similar for Python, but my Ruby skillz just aren't there for this project :)
Good luck!
All,
I have been working with vim for some time now, and love everything about it - there is only one thing I really miss from IDEs like RubyMine, and that is advanced autocompletion.
For reference, here is my standard VIM setup: https://github.com/wrwright/.vim
I have tried ctags with omnicomplete + supertab, and the one major element I miss is the ability to bring up a context sensitive list of attributes/constants/methods. For example, as I learn RubyMotion, I'd love to have some help remembering iOS SDK constants/attributes/methods, but my VIM autocomplete stops with suggesting class names..or if it does suggest methods/attributes, it lists a ton of methods/attributes that don't even apply to the class I'm working with.
I'd like to (simple example) be able to type UIColor.bl and have it autocomplete with UIColor.blueColor (or suggest if there are multiple options that start with "bl" that are properties of UIColor.
RubyMine does this very well, and if I can get VIM to be similarly smart with autocomplete it would be heavenly (and a great boon while learning RubyMotion/iOS Development.
I have also tried SnipMate (and even a RubyMotion tailored variation at https://github.com/rcyrus/snipmate-snippets-rubymotion), but that doesn't seem to offer the features I'm looking for either.
Relatively satisfied with stock Vim's omnicomplete + vim-ruby and vim-rails having completion abilities on par with NetBeans but with all the bells&whistles of Vim and much lower resource requirements, of course.
From my .vimrc concerning completion options :
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
One thing that I have had a bit of luck with Rubymotion is YouCompleteMe and enabling tag Support. you will need a lot of ram(YCM uses ~2GB when indexing a large tag file) because the tags that rubymotion uses are about 40k tags.
The downside is that the rubymotion people don't seem to want to review pull requests and provide any feedback so I am not sure if they will add the needed things to the rake task that creates the tag files for ycm to work correctly out of the box.
To get it to work you need to set the tags files correct
set tags=./tags;,tags;
and then you need to setup ycm to complete off tags.
let g:ycm_collect_identifiers_from_tags_files = 1
you need to make the ctags file compatible with ycm as well. This pull request does that. You need to add a language field to the ctags creation and then change bridgesupport to ruby.
pull request for that
after that you need to run rake ctags in the root of your project.
If you don't want to modify the project.rb file you could probably create your own rake task that does pretty much the same thing.
Yes, Vim is an awesome... text editor.
As such, it can't be expected to match any IDE's "code awareness". Furthermore, it completely relies on the community for providing more than default support for a given language. If google or the rubymotion site didn't help you to find a serious "autocompletion" solution I doubt you'll find it here.
The process explained in the blog post below sounds ok, if not very precise on the vim configuration front.
http://rayhightower.com/blog/2013/02/12/automatic-ctags-with-rubymotion-and-vim/
I am looking for the simple color code software to edit scss file for windows.
I am sorry if the question is repeated but i am tired of searching and found mostly broken files.
Please Suggest
I'm making the assumption that you are asking for a windows text-editor that supports SCSS syntax highlighting, and not a color-picking utility.
If so, I would recommend
notepad++ with user defined SCSS hightlighting [EDIT - old link broke, swapping out for new one] that you can download here or another here
or, if you are willing to pay $60, Sublime Text 2 is the best windows/mac/linux text editor (IMHO). There is a SCSS Plugin that should have everything you need.
If that is not what you are looking for, please clarify your question so we can help you better.
One of Xcode's most powerful features is it's Intellisense completion, which brings up a list of potential candidates as you type the name of a Foundation/Cocoa/UIKit API. I am very interested in MacRuby, PyObjC, or the more recent RubyMotion, however without code completion these tools seem like more trouble than they're worth.
Is there any code completion feature (not necessarily Intellisense) for any of the three technologies above, for any text editor (but preferably for Vim or Xcode)? Bonus points for an IDE solution which allows for building and running the application in a single command (like Xcode's Run button).
It's my understanding that Xcode 4 dropped support for MacRuby/PyObjC, so Intellisense is no longer available. Should I install Xcode 3 alongside Xcode 4 for the code completion? How is everyone else doing it (surely you guys use some form of code completion -- I can't believe anyone can remember all the classes in Foundation/Cocoa/UIKit)?
RubyMotion comes with vi ctag support. Run rake ctags to create them.
FWIW, there is a Code completion package for Sublime Text 2, which can also be installed via the package manager of the Sublime text.
And it seems to work rather well for me.
Yes, you can give yourself Vim code completion by running $ rake ctags in the root directory of your RubyMotion app. To take that a step further, use a shell script to generate ctags automatically every time you create a new RubyMotion app. This article shows how to build such a script:
http://rayhightower.com/blog/2013/02/12/automatic-ctags-with-rubymotion-and-vim/
How can I make zen coding support less file in sublime text2?
Install latest version of ST 2 (right now, -build 2165), and using package control (version 1.4.1), install the zen coding plugin (rather package). Then the expansion engine works fine.
I am windows user, and it was not working until last version (-build 2139), though MAC users were approving its execution.
Links:
Package control
Awesome Software and both plugins too.
Edit:
Sorry, the answer is not relative, but still let it be here as it is the best alternative till date.
To see what is your expansion key, go to :
$PACKAGES_PATH/ZenCoding/zen-settings.sublime-settings for keys and their default values.
Please give an example how you want to employ LESS using ZC,
like for html, we use:
.container>(.content>.article>.p>lorem)+(aside>h1{Side Bar}+ul>li*4>a{home,about,contact,blog})
My personal opinion will be using ST 2's snippet-expansion.
Never mind, To learn more about how to adapt for LESS, Try this source instead:
Zen Coding Discussion group.
Learn Zen-Coding from its developer ;-P .